Can't Retrieve Raw Distances

Frequent questions asked online, offline, in forums are answered here
rockin_rocket
Posts: 5
Joined: Thu Jan 17, 2019 1:01 am

Can't Retrieve Raw Distances

Post by rockin_rocket »

I'm using both the python and c libraries to work with the Marvelmind system. I am trying to get the raw distances using the C library, however, I never seem to receive a data packet with that data? I made sure I enabled the "Raw Distances" on the hedge in the Dashboard. Can someone please let me know if I am missing a step or something?

Thanks!

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

Re: Can't Retrieve Raw Distances

Post by smoker77 »

Hello,
Do you trying to get raw distances data via modem or via hedge?
In current version only hedge outputs these data.
Also, Python example currently doesn't support processing of raw distances, please test with C example

Euler
Posts: 1
Joined: Fri Jan 25, 2019 12:49 pm

Re: Can't Retrieve Raw Distances

Post by Euler »

Do you know if there any plans to enable retrieving this data via modem in the future too btw, Smoker77? It would make sense to enable that, no?

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

Re: Can't Retrieve Raw Distances

Post by smoker77 »

Hello,
Yes, we plan to include support of this feature in next software update which will be published in a week or so.

rockin_rocket
Posts: 5
Joined: Thu Jan 17, 2019 1:01 am

Re: Can't Retrieve Raw Distances

Post by rockin_rocket »

I was trying to get the data via modem instead of from the hedge. With the update published today, should I be able to get the data with the modem now?

Thanks!

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

Re: Can't Retrieve Raw Distances

Post by smoker77 »

Hello,
Yes, with latest software (v6.07) you can get raw distances data from modem instead hedge.

scaby
Posts: 4
Joined: Fri Feb 08, 2019 7:12 am

Re: Can't Retrieve Raw Distances

Post by scaby »

can you also get the mobile beacon distances using python with the latest updates ? If so can you please point me to where i can get the updated python code. I checked the marvelmind github and that has not been updated.

scaby
Posts: 4
Joined: Fri Feb 08, 2019 7:12 am

Re: Can't Retrieve Raw Distances

Post by scaby »

Hello thanks for your work. Im currently using your beacons to make an autonomous lawn mower. I have only been using the python code and never realized using the c code you can get the distances of the stationary beacons. I have only been working with the mobile beacon distances. When can we expect an update to the python library to read stationary beacons ?

rockin_rocket
Posts: 5
Joined: Thu Jan 17, 2019 1:01 am

Re: Can't Retrieve Raw Distances

Post by rockin_rocket »

You will need to add in the parsing of this data to your "Marvelmind.py" code. Here's a simple way that worked for me. At approximately line 180 (if you're using the original Marvelmind.py code), add the following:

Code: Select all

elif (isDistancesMessageDetected):
	HedgeAdr, b1, b1d, b2, b2d, b3, b3d, b4, b4d, timestamp = struct.unpack_from ('<BBlxBlxBlxBlxLxxx', strbuf, pktHdrOffset + 5)
        value = [HedgeAdr, b1, b1d/1000.0, b2, b2d/1000.0, b3, b3d/1000.0, b4, b4d/1000.0, timestamp]
        self.valuesUltrasoundRawData.append(value)
        	if (self.recieveUltrasoundRawDataCallback is not None):
                	self.recieveUltrasoundRawDataCallback()
You will also need to add a distances function.This will give the distances in meters.

Code: Select all

def distances(self):
        return list(self.valuesUltrasoundRawData)[-1];

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

Re: Can't Retrieve Raw Distances

Post by smoker77 »

Hello,

Thank you, rockin_rocket, for your code.
We just updated and tested the python example in our repository:
https://github.com/MarvelmindRobotics/marvelmind.py
Now it parsed and prints raw distances (if this option is enabled in 'Interfaces' section for the hedgehog or modem).

Post Reply