Page 1 of 2

Can't Retrieve Raw Distances

Posted: Thu Jan 17, 2019 1:03 am
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!

Re: Can't Retrieve Raw Distances

Posted: Thu Jan 17, 2019 4:43 pm
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

Re: Can't Retrieve Raw Distances

Posted: Sat Jan 26, 2019 4:36 pm
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?

Re: Can't Retrieve Raw Distances

Posted: Thu Jan 31, 2019 4:58 pm
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.

Re: Can't Retrieve Raw Distances

Posted: Mon Feb 04, 2019 8:31 pm
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!

Re: Can't Retrieve Raw Distances

Posted: Thu Feb 07, 2019 1:19 pm
by smoker77
Hello,
Yes, with latest software (v6.07) you can get raw distances data from modem instead hedge.

Re: Can't Retrieve Raw Distances

Posted: Fri Feb 08, 2019 7:16 am
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.

Re: Can't Retrieve Raw Distances

Posted: Fri Feb 08, 2019 9:41 pm
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 ?

Re: Can't Retrieve Raw Distances

Posted: Mon Feb 11, 2019 10:28 pm
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];

Re: Can't Retrieve Raw Distances

Posted: Tue Feb 12, 2019 6:39 pm
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).