Mavros: Low update rate on Mavros topic

Created on 20 Feb 2019  ·  7Comments  ·  Source: mavlink/mavros

This is only bug and feature tracker, please use it
to report bugs or request features.


Issue details

Hello everyone,
I'm working on a indoor drone project and recently I noticed something bad:
the topics are being updating in a very low rate (less than 1Hz) (including the topic mavros/local_position/pose that is important to control the drone on OFFBOARD mode).
It's turning the flight control difficult by setposition topic because the drone doesn't know its correct altitude in real time. When I test this test algorithm (fly 1 meter and hold its position), on Gazebo Simulator, the Mavros topics are updating in a nice rate.
In order to verify if the problem is the telemetry system, I tested the information update rate on QGroundControl and when I move the drone, the information are instantaneously updated. Then, I suppose the telemetry system (3DR Radio Link) is not the problem.

I'm launching mavros by this command:

roslaunch mavros px4.launch fcu_url:=/dev/ttyUSB0:57600

If there's a way to solve this problem (high latency on topic updating using telemetry) please tell me.

MAVROS version and platform

Mavros: 0.18.4
ROS: Lunar 1.13.7
Ubuntu: 16.04

Autopilot type and version

[ ] ArduPilot
[X] PX4

Version: 3.7.1 (PX4FMU_V3) Pixhawk 2

Node logs

started roslaunch server http://lucas-Inspiron-7460:40689/

SUMMARY

CLEAR PARAMETERS

  • /mavros/

PARAMETERS

  • /mavros/cmd/use_comp_id_system_control: False
  • /mavros/conn/heartbeat_rate: 1.0
  • /mavros/conn/system_time_rate: 1.0
  • /mavros/conn/timeout: 10.0
  • /mavros/conn/timesync_rate: 10.0
  • /mavros/distance_sensor/hrlv_ez4_pub/field_of_view: 0.0
  • /mavros/distance_sensor/hrlv_ez4_pub/frame_id: hrlv_ez4_sonar
  • /mavros/distance_sensor/hrlv_ez4_pub/id: 0
  • /mavros/distance_sensor/hrlv_ez4_pub/orientation: PITCH_270
  • /mavros/distance_sensor/hrlv_ez4_pub/send_tf: True
  • /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/x: 0.0
  • /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/y: 0.0
  • /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/z: -0.1
  • /mavros/distance_sensor/laser_1_sub/id: 3
  • /mavros/distance_sensor/laser_1_sub/orientation: PITCH_270
  • /mavros/distance_sensor/laser_1_sub/subscriber: True
  • /mavros/distance_sensor/lidarlite_pub/field_of_view: 0.0
  • /mavros/distance_sensor/lidarlite_pub/frame_id: lidarlite_laser
  • /mavros/distance_sensor/lidarlite_pub/id: 1
  • /mavros/distance_sensor/lidarlite_pub/orientation: PITCH_270
  • /mavros/distance_sensor/lidarlite_pub/send_tf: True
  • /mavros/distance_sensor/lidarlite_pub/sensor_position/x: 0.0
  • /mavros/distance_sensor/lidarlite_pub/sensor_position/y: 0.0
  • /mavros/distance_sensor/lidarlite_pub/sensor_position/z: -0.1
  • /mavros/distance_sensor/sonar_1_sub/id: 2
  • /mavros/distance_sensor/sonar_1_sub/orientation: PITCH_270
  • /mavros/distance_sensor/sonar_1_sub/subscriber: True
  • /mavros/fake_gps/eph: 2.0
  • /mavros/fake_gps/epv: 2.0
  • /mavros/fake_gps/fix_type: 3
  • /mavros/fake_gps/geo_origin/alt: 408.0
  • /mavros/fake_gps/geo_origin/lat: 47.3667
  • /mavros/fake_gps/geo_origin/lon: 8.55
  • /mavros/fake_gps/gps_rate: 5.0
  • /mavros/fake_gps/mocap_transform: True
  • /mavros/fake_gps/satellites_visible: 5
  • /mavros/fake_gps/tf/child_frame_id: fix
  • /mavros/fake_gps/tf/frame_id: map
  • /mavros/fake_gps/tf/listen: False
  • /mavros/fake_gps/tf/rate_limit: 10.0
  • /mavros/fake_gps/tf/send: False
  • /mavros/fake_gps/use_mocap: True
  • /mavros/fake_gps/use_vision: False
  • /mavros/fcu_protocol: v2.0
  • /mavros/fcu_url: /dev/ttyUSB0:57600
  • /mavros/gcs_url:
  • /mavros/global_position/child_frame_id: base_link
  • /mavros/global_position/frame_id: map
  • /mavros/global_position/rot_covariance: 99999.0
  • /mavros/global_position/tf/child_frame_id: base_link
  • /mavros/global_position/tf/frame_id: map
  • /mavros/global_position/tf/global_frame_id: earth
  • /mavros/global_position/tf/send: False
  • /mavros/global_position/use_relative_alt: True
  • /mavros/image/frame_id: px4flow
  • /mavros/imu/angular_velocity_stdev: 0.000349065850399
  • /mavros/imu/frame_id: base_link
  • /mavros/imu/linear_acceleration_stdev: 0.0003
  • /mavros/imu/magnetic_stdev: 0.0
  • /mavros/imu/orientation_stdev: 1.0
  • /mavros/local_position/frame_id: map
  • /mavros/local_position/tf/child_frame_id: base_link
  • /mavros/local_position/tf/frame_id: map
  • /mavros/local_position/tf/send: False
  • /mavros/local_position/tf/send_fcu: False
  • /mavros/mission/pull_after_gcs: True
  • /mavros/mocap/use_pose: True
  • /mavros/mocap/use_tf: False
  • /mavros/odometry/estimator_type: 3
  • /mavros/odometry/frame_tf/desired_frame: ned
  • /mavros/plugin_blacklist: ['safety_area', '...
  • /mavros/plugin_whitelist: ['sys_*', 'comman...
  • /mavros/px4flow/frame_id: px4flow
  • /mavros/px4flow/ranger_fov: 0.118682389136
  • /mavros/px4flow/ranger_max_range: 5.0
  • /mavros/px4flow/ranger_min_range: 0.3
  • /mavros/safety_area/p1/x: 1.0
  • /mavros/safety_area/p1/y: 1.0
  • /mavros/safety_area/p1/z: 1.0
  • /mavros/safety_area/p2/x: -1.0
  • /mavros/safety_area/p2/y: -1.0
  • /mavros/safety_area/p2/z: -1.0
  • /mavros/setpoint_accel/send_force: False
  • /mavros/setpoint_attitude/reverse_thrust: False
  • /mavros/setpoint_attitude/tf/child_frame_id: target_attitude
  • /mavros/setpoint_attitude/tf/frame_id: map
  • /mavros/setpoint_attitude/tf/listen: False
  • /mavros/setpoint_attitude/tf/rate_limit: 50.0
  • /mavros/setpoint_attitude/use_quaternion: False
  • /mavros/setpoint_position/mav_frame: LOCAL_NED
  • /mavros/setpoint_position/tf/child_frame_id: target_position
  • /mavros/setpoint_position/tf/frame_id: map
  • /mavros/setpoint_position/tf/listen: False
  • /mavros/setpoint_position/tf/rate_limit: 50.0
  • /mavros/setpoint_velocity/mav_frame: LOCAL_NED
  • /mavros/startup_px4_usb_quirk: True
  • /mavros/sys/disable_diag: False
  • /mavros/sys/min_voltage: 10.0
  • /mavros/target_component_id: 1
  • /mavros/target_system_id: 1
  • /mavros/tdr_radio/low_rssi: 40
  • /mavros/time/time_ref_source: fcu
  • /mavros/time/timesync_avg_alpha: 0.6
  • /mavros/time/timesync_mode: MAVLINK
  • /mavros/vibration/frame_id: base_link
  • /mavros/vision_pose/tf/child_frame_id: vision_estimate
  • /mavros/vision_pose/tf/frame_id: map
  • /mavros/vision_pose/tf/listen: False
  • /mavros/vision_pose/tf/rate_limit: 10.0
  • /mavros/vision_speed/listen_twist: False
  • /rosdistro: lunar
  • /rosversion: 1.13.7

NODES
/
mavros (mavros/mavros_node)

auto-starting new master
process[master]: started with pid [2541]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 9a6d39f0-3495-11e9-b342-d80f99bfeedd
process[rosout-1]: started with pid [2554]
started core service [/rosout]
process[mavros-2]: started with pid [2558]

Diagnostics

```
header:
seq: 2138
stamp:
secs: 1550618079
nsecs: 476350000
frame_id: ''
status:


  • level: 0
    name: "mavros: FCU connection"
    message: "connected"
    hardware_id: "/dev/ttyUSB0:57600"
    values:



    • key: "Received packets:"

      value: "3164"



    • key: "Dropped packets:"

      value: "0"



    • key: "Buffer overruns:"

      value: "0"



    • key: "Parse errors:"

      value: "0"



    • key: "Rx sequence number:"

      value: "40"



    • key: "Tx sequence number:"

      value: "56"



    • key: "Rx total bytes:"

      value: "2350842"



    • key: "Tx total bytes:"

      value: "915507"



    • key: "Rx speed:"

      value: "661.000000"



    • key: "Tx speed:"

      value: "320.000000"


  • level: 2
    name: "mavros: GPS"
    message: "No satellites"
    hardware_id: "/dev/ttyUSB0:57600"
    values:



    • key: "Satellites visible"

      value: "0"



    • key: "Fix type"

      value: "0"



    • key: "EPH (m)"

      value: "99.99"



    • key: "EPV (m)"

      value: "99.99"


  • level: 0
    name: "mavros: Heartbeat"
    message: "Normal"
    hardware_id: "/dev/ttyUSB0:57600"
    values:



    • key: "Heartbeats since startup"

      value: "2793"



    • key: "Frequency (Hz)"

      value: "0.999995"



    • key: "Vehicle type"

      value: "Quadrotor"



    • key: "Autopilot type"

      value: "PX4 Autopilot"



    • key: "Mode"

      value: "MANUAL"



    • key: "System status"

      value: "Standby"


  • level: 0
    name: "mavros: System"
    message: "Normal"
    hardware_id: "/dev/ttyUSB0:57600"
    values:



    • key: "Sensor present"

      value: "0x00000000"



    • key: "Sensor enabled"

      value: "0x00000000"



    • key: "Sensor helth"

      value: "0x00000000"



    • key: "CPU Load (%)"

      value: "28.8"



    • key: "Drop rate (%)"

      value: "0.0"



    • key: "Errors comm"

      value: "0"



    • key: "Errors count #1"

      value: "0"



    • key: "Errors count #2"

      value: "0"



    • key: "Errors count #3"

      value: "0"



    • key: "Errors count #4"

      value: "0"


  • level: 0
    name: "mavros: Battery"
    message: "Normal"
    hardware_id: "/dev/ttyUSB0:57600"
    values:



    • key: "Voltage"

      value: "10.18"



    • key: "Current"

      value: "0.0"



    • key: "Remaining"

      value: "0.0"


  • level: 2
    name: "mavros: Time Sync"
    message: "No events recorded."
    hardware_id: "/dev/ttyUSB0:57600"
    values:



    • key: "Timesyncs since startup"

      value: "0"



    • key: "Frequency (Hz)"

      value: "0.000000"



    • key: "Last dt (ms)"

      value: "9.376617"



    • key: "Mean dt (ms)"

      value: "0.000000"



    • key: "Last system time (s)"

      value: "3023.959504000"



    • key: "Time offset (s)"

value: "1550615055.404127836"

Check ID


OK. I got messages from 1:1.

Received 371 messages, from 1 addresses
sys:comp list of messages

1:1 0, 1, 36, 230, 32, 105, 74, 141, 77, 111, 241, 147, 245, 4, 24, 132, 106, 30

Thanks for the help!

question

Most helpful comment

I solved this issue just changing the parameter "MAV_0_RATE" (from 1200 (default) to 57600) without change baud rate parameters. Previously I was trying to change the SER_TEL1_BAUD parameter (from 57600 to 115200) but it didn't solve the issue and the telemetry didn't work with this baud rate. Then I tested just the MAV_0_RATE and it worked well.

All 7 comments

With that baud rate in that telemetry link it looks perfectly normal that you are getting the data at those rates, considering that the link rate profiles of PX4 for these kind of links are quite low. I would follow https://docs.px4.io/en/peripherals/serial_configuration.html and try to setup your link baud rate to 115200.

Dear TSC21,

Thank you for reply me.

I followed what you recommended me but I hadn't success. When I change the link baudrate to 115200, I can't access the drone via telemetry. The QGroundControl only displays: "Waiting for Vehicle Connection". I tried to follow that link you posted here and I changed these parameters (aiming to change the baudrate link):

SER_TEL1_BAUD - from "57600" to "115200"
MAV_0_RATE - from "1200" to "115200"
MAV_0_MODE - from "0" to "1" (normal -> custom)

If there's something wrong in this procedure, please, tell me.

Thank you very much.

Please bring this matter to PX4 Slack.

I solved this issue just changing the parameter "MAV_0_RATE" (from 1200 (default) to 57600) without change baud rate parameters. Previously I was trying to change the SER_TEL1_BAUD parameter (from 57600 to 115200) but it didn't solve the issue and the telemetry didn't work with this baud rate. Then I tested just the MAV_0_RATE and it worked well.

I solved this issue just changing the parameter "MAV_0_RATE" (from 1200 (default) to 57600) without change baud rate parameters. Previously I was trying to change the SER_TEL1_BAUD parameter (from 57600 to 115200) but it didn't solve the issue and the telemetry didn't work with this baud rate. Then I tested just the MAV_0_RATE and it worked well.

Hi, how did you go about changing the MAV_0_RATE? I've looked for it in the parameter list in Mission Planner but can't find it.

I solved this issue just changing the parameter "MAV_0_RATE" (from 1200 (default) to 57600) without change baud rate parameters. Previously I was trying to change the SER_TEL1_BAUD parameter (from 57600 to 115200) but it didn't solve the issue and the telemetry didn't work with this baud rate. Then I tested just the MAV_0_RATE and it worked well.

Hi, how did you go about changing the MAV_0_RATE? I've looked for it in the parameter list in Mission Planner but can't find it.

It depends on the PX4 version you are running. I accessed this parameter by QGroundControl. You can check the parameters here:

https://docs.px4.io/v1.9.0/en/advanced_config/parameter_reference.html

If you are not finding the parameter by QGroundControl I recommend you set this parameter by PX4 command line

For anyone who is still looking for a solution.

I wanted to increase the publishing rate of Odometry & HIGHRES_IMU messages.

Here's how I solved this problem:

1- Increase the baud rate of the serial communication by changing these PX4 parameters on QGroundControl, and then reboot the UAV.

SER_TEL1_BAUD - from "57600" to "115200" 
MAV_0_RATE - from "1200" to "115200" 
MAV_0_MODE - from "0" to "1" (normal -> custom) 

References:

https://docs.px4.io/master/en/peripherals/serial_configuration.html#how-to-configure-a-port

https://github.com/mavlink/mavros/issues/1182#issuecomment-465672331

2- Change the rate that Mavlink publishes the ODOMETRY/ HIGHRES_IMU messages in. This can be done by writing this command on the microSD card in PX4. How?

  • Remove the card from Pixhawk and connect to your PC. Then go to ./fs/etc/extras.txt

  • If this directory (or part of it) does not exist, create it. Then, inside extras.txt, we should write:

mavlink stream -d /dev/ttyS0 -s HIGHRES_IMU -r 200 
mavlink stream -d /dev/ttyS0 -s ODOMETRY -r 200 

Reference:
https://dev.px4.io/v1.9.0/en/concept/system_startup.html#starting-additional-applications

For completeness, here is my setup details:

MAVROS version and platform

Mavros: 1.4

ROS: Melodic

Ubuntu: 18.04

Autopilot type and version

PX4

Version: v1.10.1

PX4_FMU_V5 (V500)

NuttX, v7.29.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pavloblindnology picture pavloblindnology  ·  13Comments

pablogarciaaunon picture pablogarciaaunon  ·  14Comments

cesarecaputi picture cesarecaputi  ·  13Comments

zhahaoyu picture zhahaoyu  ·  12Comments

szebedy picture szebedy  ·  18Comments