Get GPS & Navigation Info from Mapfactor Navigator 14 TCP - how difficult?

HouseBot Plugin Development Discussions.
TonyG
Member
Posts: 94
Joined: Wed Jul 22, 2009 7:35 am

Re: Get GPS & Navigation Info from Mapfactor Navigator 14 TCP - how difficult?

Post by TonyG »

I think what you are seeing is the TCP server for the SW Remote. It's listening on 5015 also.
Thanks Scott - that certainly solves that question.

I have focussed on trying and testing the TCP link using all known tried and tested ports. I've also used "socketTest 3" (TCP client/server testing) connecting to Mapfactor Navigator TCP (send & received), and a useful "reverse test" on Housebot TCP with messages successfully sending and receiving.

I'm now convinced the TCP basic connection is good between Navigator and Housebot. I think the issue may lie with something like:
1) Formatting of data within TCP plugin - how is it being sent in terms of ASCII or HEX etc?
2) No ability to use \n or \n\r within TCP plugin (from what I have read in the HB forums)
3) Something even more trivial such as timeouts?

Not sure where I go from here...

EDIT:
If anyone can test this themselves, it's a free application: http://navigatorfree.mapfactor.com/en/

Go to settings: remote communication device, for the TCP setup. No GPS needed for commands such as $software_version
ScottBot
Site Admin
Posts: 2786
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: Get GPS & Navigation Info from Mapfactor Navigator 14 TCP - how difficult?

Post by ScottBot »

Tony,

I downloaded it and gave it a quick try, but for some reason wasn't able to connect. I didn't spend a lot of time on it, and wasn't exactly sure what I was supposed to do to get the IP communications flowing.

My intention was to see if I could see the data flow a little better by viewing it in a IP Socket Device that I enhanced to test this. Maybe you can get more out of it, since you know what you are doing.

Try downloading this plugin and create an IP Socket Device. You'll need to unzip it into your /Plugins/Devices directory and restart Housebot. Watch the error log if you don't see what you expect in the Received Data Property.
Scott
TonyG
Member
Posts: 94
Joined: Wed Jul 22, 2009 7:35 am

Re: Get GPS & Navigation Info from Mapfactor Navigator 14 TCP - how difficult?

Post by TonyG »

Scott,

Thanks for your help. I've been looking at the IP Socket Device you sent, and I'm getting similar results to the TCP device from Osler. All this time I've been trying to send a command from Housebot, and although the TCP device is saying the message is sent, I'm not getting the expected response back.

Change of tack - today, I've used the "message" feature of Mapfactor Navigator, which uses the TCP connection to send/receive chat messages.

Receiving works! Housebot (both IP devices) receives data and displays the text in the received data property. I've run the following sequence twice to show what I'm getting for your IP Socket device and the TCP device from Osler:

Sequence:
1) Change Connected property to 1
2) Try sending "$software_version" data out of HB (to Navigator)
3) Send message from Mapfactor Navigator message console (to HB)

Using IP Socket Device

[IP Socket Device.Connected] has changed to [No]
[IP Socket Device.Connected] has changed to [Yes]
Socket Server is ready and waiting for connections.
[IP Socket Device.Send Data] has changed to [$software_version]
[IP Socket Device.Received Data] has changed to [Chat message from Mapfactor Navigator to HB]
Using Oslers TCP Device
TCConnected changed to 1
Attempting connection to 192.168.1.82:4243.
[NEW TCP.TCConnected] has changed to [1]
Connection established.
TCSendData changed to $software_version
Sending data ($software_version).
[NEW TCP.TCSendData] has changed to []
[NEW TCP.TCSendData] has changed to [$software_version]
Data sent.
Data (Chat message Mapfactor Navigator to HB) arrived.
[NEW TCP.TCReceivedData] has changed to [Chat message Mapfactor Navigator to HB]
So, the connection is working - Mapfactor can send messages to Housebot. Good progress in terms of understanding what is currently working.

I shall spend some further time on sending data out of Housebot. I've already tried so many ideas, and have used \n \r\n for command terminators without success.

Cheers,

Tony
TonyG
Member
Posts: 94
Joined: Wed Jul 22, 2009 7:35 am

Re: Get GPS & Navigation Info from Mapfactor Navigator 14 TCP - how difficult?

Post by TonyG »

Quick summary, and some progress:

Navigator >> Housebot = works (can receive chat messages)
Housebot >> Navigator = connection, but no actions

Is this about new lines / carriage returns???
Using SocketTest v3 I can see sending Mapfactor chat messages creates a new line after each message sent. I cannot get a new line (carriage return) on any message I'm sending out of the IP Socket Device (or Oslers TCP plugin), and this maybe the problem.

I'm trying to send a "\n" or "\r\n" - and I'm not sure if I'm doing the right thing in simply adding "\n" or "\r\n" into the command terminator field? Using SocketTest v3 -I can see \r\n is coming out as a symbol, and not returning any carriage return.

If I can get the message sent with a new line this may yet work!

****UPDATE****
Housebot now sending TCP IP commands to Mapfactor Navigator - and getting responses back!!


It was the command terminator. Used "0D0A" instead of \r\n and that did it.

Example 1: (useful test command, not requiring GPS)
Command Terminator: 0D0A
Connected: Yes
Media Centre IP Address: 127.0.0.1
Media Centre Port: 23
Received Data: v.15.0.2 (the response back from Navigator 15 free)
Send Data: $software_version (the command sent from housebot))
ScottBot
Site Admin
Posts: 2786
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: Get GPS & Navigation Info from Mapfactor Navigator 14 TCP - how difficult?

Post by ScottBot »

:!: :!: :D :!: :!:
Scott
TonyG
Member
Posts: 94
Joined: Wed Jul 22, 2009 7:35 am

Re: Get GPS & Navigation Info from Mapfactor Navigator 14 TCP - how difficult?

Post by TonyG »

Thinking this may not need to be a plugin, "just" a script.

I'm using the new IP Socket Device Scott attached earlier in this thread - now working well with the right terminators.
I've set up a sleep timer to drive a repeating task to send the command $last_position. I get back 5 values separated by a comma in Received Data

e.g. 51.334012,-2.823696,21,1,114
(latitude(degrees),longitude(degrees),altitude(meters),speed(km/h),course(degrees))

I've set up a null device with 5 matching property values: Latitude, Longitude, Altitude, Speed, Course.

What I need now is a script that reads the received message from the IP Socket device Received Data, and splits the 5 values into the respective properties in the null device.

I've been searching and trawling existing Housebot VBS scripts, and I get the basic "get and set" elements. I'm working on the idea of using "split"

Code: Select all

' Get the full string Property Value.  This will be formatted something like :
LastPosition = GetPropertyValue("IP Socket Mapfactor Position.Received Data")

' Let VB break out the received components into its own format
arrData = Split(LastPosition, ",")
intLat = arrData(0)
intLon = arrData(1)
intAltitude = arrData(2)
intSpeed = arrData(3)
intCourse = arrData(4)

' Set the HouseBot normalized Property value correctly.
SetPropertyValue "Mapfactor Last Position.Altitude", Altitude 
This doesn't work, and I'm very much out of my depth here!

If anyone can provide some help that would be very welcome - even if it's a relevant example I can plagiarise.
TonyG
Member
Posts: 94
Joined: Wed Jul 22, 2009 7:35 am

Re: Get GPS & Navigation Info from Mapfactor Navigator 14 TCP - how difficult?

Post by TonyG »

Working!

Code: Select all

' Get the full string Property Value.  This will be formatted something like :
LastPosition = GetPropertyValue("IP Socket Mapfactor Position.Received Data")

' Let VB break out the received components into its own format
arrData = Split(LastPosition, ",")
intLat = arrData(0)
intLon = arrData(1)
intAltitude = arrData(2)
intSpeed = arrData(3)
intCourse = arrData(4)

' Set the HouseBot normalized Property value correctly.
SetPropertyValue "IP Socket Mapfactor Position.Altitude", intAltitude
SetPropertyValue "IP Socket Mapfactor Position.Speed", intSpeed
SetPropertyValue "IP Socket Mapfactor Position.Course", intCourse
Post Reply