How to adjust the sample rate of distance sensor (rangefinder)

I follow the Pixhawk instruction (by this link: Distance Sensors (Rangefinders) · PX4 v1.9.0 User Guide) and run the rangefinder successfully.
The sensor type is Lidar-Lite
I am curious about how to increase the sampling rate.
Now my sample rate is only 2 hz

You seam to be using PX4 firmware. This is an ArduPilot firmware forum.

Those are two different firmwares.
Please post in the PX4 support forum or start using ArduPilot firmware. :slight_smile:

1 Like

I guess you could try something like this:

rosrun mavros mavsys message_interval --id XX --rate YY
substituting XX to the correct sensor id mapping and set YY rate in Hertz

2 Likes

Thank you very much for the information.
I tried several ways ref: How to adjust the sample rate of distance sensor (rangefinder) - #13 by AlexWUrobot - PX4 Autopilot - Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink
but the sampling rate is still about 2.444 Hz, by rostopic hz /mavros/distance_sensor/lidarlite_pub.


I feel confused why the sampling rate is fluctuated from 1.69~2.44 Hz and
why the default sampling is not 10 Hz,
Thank you very much for your help :slight_smile:

I follow the configuration with two batteries (1 for pixhawk and motors, 2 for rangefinder) like
image
ref: LIDAR-Lite Rangefinder — Copter documentation

I also exam the sampling rate by arduino UNO and find the sampling rate of the distance sensor is 80 ~90 Hz.


ref: How to adjust the sample rate of distance sensor (rangefinder) - #13 by AlexWUrobot - PX4 Autopilot - Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink

Therefore, I feel confused about the sampling rate of /mavros/distance_sensor/lidarlite_pub is only 2Hz.

I am thinking about the possible reasons:

  1. try to provide the distance sensor and pixhawk with the same battery, instead of two separate batteries
  2. try to use 9600 baud rate, instead of 115200. Currently, I use roslaunch mavros px4.launch fcu_url:=/dev/ttyUSB0:115200 on the linux terminal in the Jetson TX1 computer, which communicate with Pixhawk4 (fmu-v5).

The Jetson TX1 computer use the USB cable to telem2 port of the Pixhawk.
The distance sensor use the I2C port of the Pixhawk.