Rangefinder and PRX confusion

Hi,

I just played around with my Benewake TFmini again. The TFmini alone is working fine as rangefinder and PRX type 4.
However I also tried to use an arduino and a servo to sweep the TFmini to get two Rangefinders for obstacle avoidance
(rangefinder avoidance, not PRX stop)
My sketch sends DISTANCE_SENSOR messages, one for each direction the sensor is pointing in. I tried three steps with orientation 0, 1 and 7 and also two steps with 1 and 7.
According to some information I found while digging around, rangefinder type 10 (Mavlink) should now consume DISTANCE_SENSOR messages, but I could not get it to work. PRX type 2 works without a problem, the MP proximity window is showing 2 or 3 segments, depending on how I configured the arduino.
At some point I suddenly got Rangefinder1, Rangefinder2, Rangefinder3 parameters in MP status screen, all showing 0. I never saw this before and it disappeared again during testing.
What mavlink message does the arduino have to send to work with Rangefinder type 10?
I know I asked this before, but I never got a definitive answer…

@count74, So I guess the plan is to use Rover’s Dodge avoidance? This method of avoidance is very old and with careful tuning it can work in very specific situations but it’s not a good general purpose solution. We’ve got “BendyRuler” and “Dijkstra’s” methods coming in the next version of Rover. There are some videos of these algorithms in action in the simulator and on a real vehicle on my youtube channel.

Putting that all aside, if you really want to get Dodge working then here are some points that may help:

  • the arduino should send DISTANCE_SENSOR messages. there should be an orientation field in these messages and this field should match the RNGFNDx_ORIENT parameter for the range finder that should receive the distance.
  • the lidar should be setup as two Lidar, no need to set up the proximity sensor.
1 Like

Thanks for your advice, Randy.
I tried the setup again today, but I could not get it to work.
I am sending two DISTANCE_SENSOR messages, with orientation 1 and 7, id1 and id2. The Rangefinder orientation is also set to 1 and 7.
Do I need to use a specific component id?
Right now i am using 158.

@count74,

I wonder how you’re testing whether it’s working or not. It’s probably best to look directly at the dataflash logs to see if the range finder data is appearing.

It’s possible to make the distances appear in MP’s radar view but only by setting the PRX_TYPE = 4. Whether it appears in the radar view or not though actually doesn’t affect whether it’s used by Dodge. Dodge doesn’t even look at the RNGFNDx_ORIENT parameter values.

I think @ppoirier has done something very similar to this.

TBH, as mentioned above, the Dodge method doesn’t work well so I’m tempted to just recommend waiting for Rover-3.6 which should include much better object avoidance features.

I am actually using PRX type 4 to see if there is any data coming through. PRX type 2 shows the range values in the proximity screen, type 4 shows nothing. There are also three Rangefinder values in the Missionplanner status screen, all zero.
But as you suggested, I will just wait for the avoidance features of ardurover 3.6.
Thanks for your time!

Did you looked at my (very rudimentary) code ?