I would have guessed that the RANGEFINDER message is used, but as I said I did check the communication and no message #173 is ever sent. Are you sure about this?
I did check again, you are right the message is sent. But there seems to be a checksum problem so my software has ignored the #173 messages. Thank you!
I am working on the matter right now and I figured the right Python message to the autopilot to be
msg = vehicle.message_factory.distance_sensor_encode(
time_us, # time since system boot, not used
min_distance, # min distance cm
max_distance, # max distance cm
dist_cm, # current distance, must be int
0, # type = laser?
0, # onboard id, not used
mavutil.mavlink.MAV_SENSOR_ROTATION_PITCH_270, # must be set to MAV_SENSOR_ROTATION_PITCH_270 for mavlink rangefinder, represents downward facing
0 # covariance, not used
)
Here is the problem I see. If the rangefinder type is set to 10 and is enabled with EK2_RNG_USE_HGT > 0, then the altitude is messed up in case I do not provide any value.
Here is a datalog coming from the SITL (3.6.dev, today’s master). As you see, even though the rangefinder reading is 0, so out of range (minimum is set to 10), the estimated altitude is completely messed up and I have very high variance on Velocity and Pos Vert
Hi Karl
I have a similar problem. I have a four-directions rangefinder made by me (as my final year project) implemented using an Arduino. This system is on-board to a hexacopter. I must send this information (dist1, dist2, dist3, dist4) using a mavlink message (through the Pixhawk) to the Mission Planner in order to use them during the hexa control process (Im using Python scripting to control the vehicles flight). Could you please indicate me which command(s) should I used to achieve it, and how I can access the data in MP? Is it possible to send them as already existing, but not used parameters in MP as for example RPM # 226, rpm1, rpm2 or BATTERY_STATUS2 (for second battery, if such buttery does not really exist in practice), voltage, current e.t.c. and then to access them through python scripting as (get current state) cs.rpm1 e.t.c.???