how to get x,y coordinates of hedge on the serial port of arduino?

Frequent questions asked online, offline, in forums are answered here
HEMANT
Posts: 9
Joined: Thu Mar 23, 2017 4:51 pm

Re: how to get x,y coordinates of hedge on the serial port of arduino?

Postby HEMANT » Sat Mar 25, 2017 7:16 pm

thanks to everyone who helped me .
now i got the perfect coordinate data on the serial port of arduino
Screenshot (151).png
Screenshot (151).png (126.78 KiB) Viewed 815 times
hedgehog_sample_uart_v3.rar
(1.38 KiB) Downloaded 30 times

this is the code

smoker77
Posts: 96
Joined: Sat Feb 06, 2016 4:03 pm

Re: how to get x,y coordinates of hedge on the serial port of arduino?

Postby smoker77 » Sat Mar 25, 2017 7:40 pm

I'm glad the problem is solved. I just found that your serial port speed settings in system and in terminal mismatched. But you found this by yourself.

nolanmac
Posts: 2
Joined: Mon Aug 07, 2017 9:08 pm

Re: how to get x,y coordinates of hedge on the serial port of arduino?

Postby nolanmac » Mon Aug 07, 2017 9:14 pm

HEMANT wrote:thanks to everyone who helped me .
now i got the perfect coordinate data on the serial port of arduino
Screenshot (151).png
hedgehog_sample_uart_v3.rar

this is the code


I am using this exact same setup and downloaded your code but instead of printing the correct coordinates I get:

X=0 Y=0 H=0

on every line of the serial monitor. This is extremely frustrating because the dashboard shows the correct coordinates and accurately tracks the hedgehog beacon. It just does not seem to be streaming the correct info to my arduino. Was there anything that you needed to change in the Dashboard to get this to work? I've made sure that the BAUD is correct and the other settings I can see from your screenshot are the same as mine. Any ideas as to why I'm getting 0, 0, 0 as my location?

smoker77
Posts: 96
Joined: Sat Feb 06, 2016 4:03 pm

Re: how to get x,y coordinates of hedge on the serial port of arduino?

Postby smoker77 » Mon Aug 07, 2017 10:50 pm

Hello,
Please check your settings by following points:
1. Check the hedgehog serial port speed (setting in the section 'interfaces' in dashboard) is same as setting in Arduino software (115200 bps) and same as speed in serial monitor.
2. The map should be frozen.
3. The arduino example is old version, which supports only low resolution data format. For new versions of firmware you need to use newer version of example: http://marvelmind.com/downloads/hedgeho ... rt_v4a.zip
Or use old version of example, but disable high resolution mode as shown here: http://marvelmind.com/downloads/millimeters.PNG

Also, note there is some unexpected feature in HEMANT's code:
the condition for printing coordinartes to serial port 'if (hedgehog_pos_updated=true) ' is true regardless data updated or not.
So the values are printed every time, even when no data available.
If the coordinates should be printed only after data update, this condition must be replaces by
'if (hedgehog_pos_updated)' or 'if (hedgehog_pos_updated == true)'.

nolanmac
Posts: 2
Joined: Mon Aug 07, 2017 9:08 pm

Re: how to get x,y coordinates of hedge on the serial port of arduino?

Postby nolanmac » Tue Aug 08, 2017 3:44 pm

smoker77 wrote:Hello,
Please check your settings by following points:
1. Check the hedgehog serial port speed (setting in the section 'interfaces' in dashboard) is same as setting in Arduino software (115200 bps) and same as speed in serial monitor.
2. The map should be frozen.
3. The arduino example is old version, which supports only low resolution data format. For new versions of firmware you need to use newer version of example: http://marvelmind.com/downloads/hedgeho ... rt_v4a.zip
Or use old version of example, but disable high resolution mode as shown here: http://marvelmind.com/downloads/millimeters.PNG

Also, note there is some unexpected feature in HEMANT's code:
the condition for printing coordinartes to serial port 'if (hedgehog_pos_updated=true) ' is true regardless data updated or not.
So the values are printed every time, even when no data available.
If the coordinates should be printed only after data update, this condition must be replaces by
'if (hedgehog_pos_updated)' or 'if (hedgehog_pos_updated == true)'.


I checked everything you suggested (high-res mode is off, bps is 115200 on arduino, serial monitor, and beacon UART, map is frozen) and after changing if (hedgehog_pos_updated=true) to just if (hedgehog_pos_updated), the program does not print anything at all. So my hedgehog beacon is never sending valid coordinate because it can never get to line 66 where hedgehog_pos_updated gets set to true.

Again, the dashboard application works flawlessly. Maybe you can help me figure out what is going on, I have printed out the bytes in hex that the beacon is sending my arduino.

UART received: FF, 47, 2, 0, 1, 0, A0, 33, FF, 47, 2, 0, 1, 0, A0, 33, FF, 47, 2, 0, 1, 0, A0, 33 and this pattern just repeats. That 6th byte, to my understanding should represent the number of beacons in the packet, but it's zero. Just for reference I am using 4 beacons plus 1 mobile hedgehog so something doesn't add up here. Any other ideas??

smoker77
Posts: 96
Joined: Sat Feb 06, 2016 4:03 pm

Re: how to get x,y coordinates of hedge on the serial port of arduino?

Postby smoker77 » Tue Aug 08, 2017 6:33 pm

Yes, the packet you posted means zero number of stationary beacons.
This is very strange if the map not frozen.
Please share the screenshot of the dashboard when you see such packets.


Return to “FAQ”

Who is online

Users browsing this forum: No registered users and 2 guests