Using Dronekit to Read Distance Measurements Sent by RPLIDAR A1 Through MAVLink (Getting Vehicle Attributes!)


Since I am a beginner with minimal knowledge about the whole Ardupilot project. I’ll try to be as clear as I can asking the following question.

I am trying to build a semi(fully)-autonomous hexacopter that can perform some object avoidance. I have followed the instructions provided in the Wiki on how to wire and connect the RPLIDAR A2 to Pixhawk 2.1. I’ve also set the parameter values as explained in the Wiki page (
I am assuming that the RPLIDAR A1 wiring will be identical to that of the RPLIDAR A2.
After connected the RPLIDAR A1 to Pixhawk 2.1, I started Mission Planner and expected to receive distance measurements on the sonardistance state or one of the rangfinder states.
I was then told that the RPLIDAR A1 is not a rangefinder and that those state or attributes are used with the one-point (single-point) lidars .

I want to know if it is possible to get distance readings through MAVLink using Dronekit-python scripts. Is there a similar command like (print “Rangefinder: %s” % vehicle.rangefinder) - for example - that could work with the RPLIDAR A1?

I know I am missing a lot of info, however, I am sure many of you who are experienced with this know what I am trying to get at and have some answers for me.

Any help or advice would be greatly appreciated! Thank you all!


ArduPilot does not support RPLIDAR A1.
The data format is the same.
At startup, it is not recognized because the device information length from RPLIDAR is different from A2.
The AP_Proximity_RPLidarA2.cpp driver needs to be changed to A1 message length.


Thank you for you reply! I am really sorry it took me a while to respond but I am new to this forum.

What you say, the A1 model isn’t compatible. I think there’s now escaping from having to use the A2 then. However I still cannot find suffecient documentation on coding the A2 with Pixhawk cube 2.1. I can only find the set up wiki page.

Is there any Dronekit-python examples out there? I would love to maily rely on Dronkit since I only know Python.