Websocket not working for Distance_sensor/lidarlite_pub


I have several websockets working, but I can not get the lidarlite_pub to work, do not get any callback in my subscribe function.

I use the settings from the online doc:

var distanceData = new ROSLIB.Topic({
ros : ros,
name : ‘//mavros/distance_sensor/lidarlite_pub’,
messageType : ‘sensor_msgs/Range’

Hope you can help me, I use a flytpi .

best regards,



It seems name: does not have a namespace.
Moreover, would request to send run logs

Also, please use the ros-cli api to first ensure that data is being received by FlytOS.



For some reason I lost the namespace in my creating of the issue here, but it is present in my code:

var laserDistance = new ROSLIB.Topic({
ros: ros,
name: ‘/’ + namespaceFlytbase + ‘/mavros/distance_sensor/lidarlite_pub’,
messageType: ‘sensor_msgs/Range’,
//throttle_rate: 500,

We have tested in ros-cli api as well, but we get no response via ros cli (we can get it for other messaegs when we test):
flytos@flytos:~$ rostopic echo /flytos/mavros/distance_sensor/lidarlite_pub

^Cflytos@flytos:~$ rostopic echo /flytos/mavros/distance_sensor/rangefinder_pub
^Cflytos@flytos:~$ rostopic echo /flytos/mavros/distance_sensor/sonar_1_sub
^C^[[Aflytos@flytos:~$ rostopic echo /flytos/mavros/distance_sensor/sonar_2_sub
flytos@flytos:~$ rostopic echo /flytos/sonar_sensor_sub

Logfile attached from pi:

flyt_runlogs.log (77.6 KB)



Have you checked, if you are getting DISTANCE_SENSOR data in QGC.
Are you sure you sonar/lidar is working?

What is your sensor, and how did you configure Pixhawk for the same.


I use mission planner and I can see the sonarrange undrr Status tab. It changes values to correct values as I put obstacles infront of the sensor. The value is also visible under the Initial tab->Optional Hardware-Range finder.

The sensor is connected on the GPS2 port which is the serial 4 on pixhawk 2.

The sensor is a Lightware Lidar SF11:




There seems to be a bug in APM. I am looking into it.
It should send data on 2 topics: DISTANCE_SENSOR and RANGEFINDER.
Somehow it is sending on RANGEFINDER but not on DISTANCE_SENSOR.
Unfortunately, FlytOS only listens on DISTANCE_SENSOR.


I am looking into the issue right now.


I am still looking into it, but I cannot pin point a bug in APM’s code.
Nevertheless, I am raising an issue. A solution should be made available in a few days time.


Thank you!
Looking forward for the solution, and just let me know if you want me to do some more testing and to provide any more info, and I will do my best to assist,

best regards,


Hey @SebastianW,

I could not take a closer look at the issue.
I would try to find the bug today.


Hi, any updated info on this issue?


Hi @SebastianW,

Sorry for the delayed response.
Here is the conclusion:

APM earlier used to send Lidar/Sonar data on two separate topic RANGE_FINDER and DISTANCE_SENSOR.
Unfortunately, in the latest update, they stopped sending data on DISTANCE_SENSOR topic which FlytOS listens to, and thus you cannot fetch any data on rostopic echo /flytos/mavros/distance_sensor/rangefinder_pub.

I have tested APM’s master branch and it has this issue fixed.
You can either wait for the next release or flash APM’s master branch on your Pixhawk. But using ‘master’ branch is frowned upon.