Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mavros apm not publishing topics #1903

Open
JayanthAmmapalli opened this issue Oct 4, 2023 · 4 comments
Open

mavros apm not publishing topics #1903

JayanthAmmapalli opened this issue Oct 4, 2023 · 4 comments

Comments

@JayanthAmmapalli
Copy link

JayanthAmmapalli commented Oct 4, 2023

Issue details

I am new to pichawk and mavros please guide me though this error of not getting messges in mavros topics.
The FCU is pixhawk cube orange with latest firmware i.e, chibi OS 4.4.1. The FCU is connected to onbord computer with micro USB. After starting mavros with roslaunch mavros apm.launch fcu_url:=/dev/ttyACM1:115200, the mavros is getting stuck at line [ INFO] [1696379422.304927156]: MAVROS started. MY ID 1.240, TARGET ID 1.1. During this time i can see the rostopic list and all the topics in it. After sometime getting error :
[ERROR] [1696379963.787417128]: 0: DROPPED Message TIMESYNC: MAVConnSerial::send_message: TX queue overflow

But when echoing they are all empty except for /mavros/state. I can echo all the topics when running mavros with telemetry antennas.

MAVROS version and platform

Mavros installed with sudo apt install ros-noetic-mavros
ROS: Noetic
Ubuntu: 20.04

Autopilot type and version

[ *] ArduPilot
[ ] PX4

Version: ?3.7.1?

Node logs

SUMMARY

CLEAR PARAMETERS

  • /mavros/

PARAMETERS

  • /mavros/cmd/use_comp_id_system_control: False
  • /mavros/conn/heartbeat_mav_type: ONBOARD_CONTROLLER
  • /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/rangefinder_pub/field_of_view: 0.0
  • /mavros/distance_sensor/rangefinder_pub/frame_id: lidar
  • /mavros/distance_sensor/rangefinder_pub/id: 0
  • /mavros/distance_sensor/rangefinder_pub/send_tf: False
  • /mavros/distance_sensor/rangefinder_pub/sensor_position/x: 0.0
  • /mavros/distance_sensor/rangefinder_pub/sensor_position/y: 0.0
  • /mavros/distance_sensor/rangefinder_pub/sensor_position/z: -0.1
  • /mavros/distance_sensor/rangefinder_sub/id: 1
  • /mavros/distance_sensor/rangefinder_sub/orientation: PITCH_270
  • /mavros/distance_sensor/rangefinder_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_id: 4
  • /mavros/fake_gps/gps_rate: 5.0
  • /mavros/fake_gps/horiz_accuracy: 0.5
  • /mavros/fake_gps/mocap_transform: False
  • /mavros/fake_gps/mocap_withcovariance: False
  • /mavros/fake_gps/satellites_visible: 6
  • /mavros/fake_gps/speed_accuracy: 0.0
  • /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_hil_gps: True
  • /mavros/fake_gps/use_mocap: True
  • /mavros/fake_gps/use_vision: False
  • /mavros/fake_gps/vert_accuracy: 0.5
  • /mavros/fcu_protocol: v2.0
  • /mavros/fcu_url: /dev/ttyACM1:115200
  • /mavros/gcs_url:
  • /mavros/global_position/child_frame_id: base_link
  • /mavros/global_position/frame_id: map
  • /mavros/global_position/gps_uere: 1.0
  • /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/guided_target/tf/child_frame_id: target_position
  • /mavros/guided_target/tf/frame_id: map
  • /mavros/guided_target/tf/listen: False
  • /mavros/guided_target/tf/rate_limit: 50.0
  • /mavros/image/frame_id: px4flow
  • /mavros/imu/angular_velocity_stdev: 0.0003490659 // 0...
  • /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/landing_target/camera/fov_x: 2.0071286398
  • /mavros/landing_target/camera/fov_y: 2.0071286398
  • /mavros/landing_target/image/height: 480
  • /mavros/landing_target/image/width: 640
  • /mavros/landing_target/land_target_type: VISION_FIDUCIAL
  • /mavros/landing_target/listen_lt: False
  • /mavros/landing_target/mav_frame: LOCAL_NED
  • /mavros/landing_target/target_size/x: 0.3
  • /mavros/landing_target/target_size/y: 0.3
  • /mavros/landing_target/tf/child_frame_id: camera_center
  • /mavros/landing_target/tf/frame_id: landing_target
  • /mavros/landing_target/tf/listen: False
  • /mavros/landing_target/tf/rate_limit: 10.0
  • /mavros/landing_target/tf/send: True
  • /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/mission/use_mission_item_int: True
  • /mavros/mocap/use_pose: True
  • /mavros/mocap/use_tf: False
  • /mavros/mount/debounce_s: 4.0
  • /mavros/mount/err_threshold_deg: 10.0
  • /mavros/mount/negate_measured_pitch: False
  • /mavros/mount/negate_measured_roll: False
  • /mavros/mount/negate_measured_yaw: False
  • /mavros/odometry/estimator_type: 3
  • /mavros/odometry/frame_tf/desired_frame: ned
  • /mavros/plugin_blacklist: ['actuator_contro...
  • /mavros/plugin_whitelist: []
  • /mavros/px4flow/frame_id: px4flow
  • /mavros/px4flow/ranger_fov: 0.118682
  • /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_raw/thrust_scaling: 1.0
  • /mavros/setpoint_velocity/mav_frame: LOCAL_NED
  • /mavros/startup_px4_usb_quirk: False
  • /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: True
  • /mavros/vision_speed/twist_cov: True
  • /mavros/wheel_odometry/child_frame_id: base_link
  • /mavros/wheel_odometry/count: 2
  • /mavros/wheel_odometry/frame_id: map
  • /mavros/wheel_odometry/send_raw: True
  • /mavros/wheel_odometry/send_twist: False
  • /mavros/wheel_odometry/tf/child_frame_id: base_link
  • /mavros/wheel_odometry/tf/frame_id: map
  • /mavros/wheel_odometry/tf/send: True
  • /mavros/wheel_odometry/use_rpm: False
  • /mavros/wheel_odometry/vel_error: 0.1
  • /mavros/wheel_odometry/wheel0/radius: 0.05
  • /mavros/wheel_odometry/wheel0/x: 0.0
  • /mavros/wheel_odometry/wheel0/y: -0.15
  • /mavros/wheel_odometry/wheel1/radius: 0.05
  • /mavros/wheel_odometry/wheel1/x: 0.0
  • /mavros/wheel_odometry/wheel1/y: 0.15
  • /rosdistro: noetic
  • /rosversion: 1.16.0

NODES
/
mavros (mavros/mavros_node)

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

setting /run_id to 33e6f6fe-624d-11ee-9ab3-853d88163260
process[rosout-1]: started with pid [9226]
started core service [/rosout]
process[mavros-2]: started with pid [9234]
[ INFO] [1696379422.212961110]: FCU URL: /dev/ttyACM1:115200
[ INFO] [1696379422.214301360]: serial0: device: /dev/ttyACM1 @ 115200 bps
[ INFO] [1696379422.214733453]: GCS bridge disabled
[ INFO] [1696379422.220128347]: Plugin 3dr_radio loaded
[ INFO] [1696379422.220795968]: Plugin 3dr_radio initialized
[ INFO] [1696379422.220806067]: Plugin actuator_control blacklisted
[ INFO] [1696379422.223501625]: Plugin adsb loaded
[ INFO] [1696379422.224468073]: Plugin adsb initialized
[ INFO] [1696379422.224477147]: Plugin altitude blacklisted
[ INFO] [1696379422.224521888]: Plugin cam_imu_sync loaded
[ INFO] [1696379422.224708114]: Plugin cam_imu_sync initialized
[ INFO] [1696379422.224746605]: Plugin camera loaded
[ INFO] [1696379422.224926746]: Plugin camera initialized
[ INFO] [1696379422.224964989]: Plugin cellular_status loaded
[ INFO] [1696379422.225656048]: Plugin cellular_status initialized
[ INFO] [1696379422.225731554]: Plugin command loaded
[ INFO] [1696379422.227853779]: Plugin command initialized
[ INFO] [1696379422.227905068]: Plugin companion_process_status loaded
[ INFO] [1696379422.228512388]: Plugin companion_process_status initialized
[ INFO] [1696379422.228517765]: Plugin debug_value blacklisted
[ INFO] [1696379422.228576256]: Plugin distance_sensor loaded
[ INFO] [1696379422.230846707]: Plugin distance_sensor initialized
[ INFO] [1696379422.230911156]: Plugin esc_status loaded
[ INFO] [1696379422.231294939]: Plugin esc_status initialized
[ INFO] [1696379422.231347654]: Plugin esc_telemetry loaded
[ INFO] [1696379422.231579073]: Plugin esc_telemetry initialized
[ INFO] [1696379422.231640996]: Plugin fake_gps loaded
[ INFO] [1696379422.235627625]: Plugin fake_gps initialized
[ INFO] [1696379422.235634530]: Plugin ftp blacklisted
[ INFO] [1696379422.235714311]: Plugin geofence loaded
[ INFO] [1696379422.238111554]: Plugin geofence initialized
[ INFO] [1696379422.238206526]: Plugin global_position loaded
[ INFO] [1696379422.247715446]: Plugin global_position initialized
[ INFO] [1696379422.247800563]: Plugin gps_input loaded
[ INFO] [1696379422.249064493]: Plugin gps_input initialized
[ INFO] [1696379422.249128734]: Plugin gps_rtk loaded
[ INFO] [1696379422.250583468]: Plugin gps_rtk initialized
[ INFO] [1696379422.250634318]: Plugin gps_status loaded
[ INFO] [1696379422.251852320]: Plugin gps_status initialized
[ INFO] [1696379422.251905492]: Plugin guided_target loaded
[ INFO] [1696379422.254679186]: Plugin guided_target initialized
[ INFO] [1696379422.254695523]: Plugin hil blacklisted
[ INFO] [1696379422.254788997]: Plugin home_position loaded
[ INFO] [1696379422.255928141]: Plugin home_position initialized
[ INFO] [1696379422.256055819]: Plugin imu loaded
[ INFO] [1696379422.258169521]: Plugin imu initialized
[ INFO] [1696379422.258229121]: Plugin landing_target loaded
[ INFO] [1696379422.261559374]: Plugin landing_target initialized
[ INFO] [1696379422.261623473]: Plugin local_position loaded
[ INFO] [1696379422.263317870]: Plugin local_position initialized
[ INFO] [1696379422.263371433]: Plugin log_transfer loaded
[ INFO] [1696379422.264456533]: Plugin log_transfer initialized
[ INFO] [1696379422.264504885]: Plugin mag_calibration_status loaded
[ INFO] [1696379422.264884327]: Plugin mag_calibration_status initialized
[ INFO] [1696379422.264942614]: Plugin manual_control loaded
[ INFO] [1696379422.265725672]: Plugin manual_control initialized
[ INFO] [1696379422.265791455]: Plugin mocap_pose_estimate loaded
[ INFO] [1696379422.266644375]: Plugin mocap_pose_estimate initialized
[ INFO] [1696379422.266720417]: Plugin mount_control loaded
[ WARN] [1696379422.268237313]: Could not retrive negate_measured_roll parameter value, using default (0)
[ WARN] [1696379422.268329779]: Could not retrive negate_measured_pitch parameter value, using default (0)
[ WARN] [1696379422.268418101]: Could not retrive negate_measured_yaw parameter value, using default (0)
[ WARN] [1696379422.268738616]: Could not retrive debounce_s parameter value, using default (4.000000)
[ WARN] [1696379422.268826757]: Could not retrive err_threshold_deg parameter value, using default (10.000000)
[ INFO] [1696379422.268851837]: Plugin mount_control initialized
[ INFO] [1696379422.268904553]: Plugin nav_controller_output loaded
[ INFO] [1696379422.269096823]: Plugin nav_controller_output initialized
[ INFO] [1696379422.269141144]: Plugin obstacle_distance loaded
[ INFO] [1696379422.269853621]: Plugin obstacle_distance initialized
[ INFO] [1696379422.269900409]: Plugin odom loaded
[ INFO] [1696379422.270824253]: Plugin odom initialized
[ INFO] [1696379422.270871388]: Plugin onboard_computer_status loaded
[ INFO] [1696379422.271453367]: Plugin onboard_computer_status initialized
[ INFO] [1696379422.271528882]: Plugin param loaded
[ INFO] [1696379422.272510036]: Plugin param initialized
[ INFO] [1696379422.272573912]: Plugin play_tune loaded
[ INFO] [1696379422.273179044]: Plugin play_tune initialized
[ INFO] [1696379422.273188556]: Plugin px4flow blacklisted
[ INFO] [1696379422.273244146]: Plugin rallypoint loaded
[ INFO] [1696379422.274056481]: Plugin rallypoint initialized
[ INFO] [1696379422.274101923]: Plugin rangefinder loaded
[ INFO] [1696379422.274286964]: Plugin rangefinder initialized
[ INFO] [1696379422.274367657]: Plugin rc_io loaded
[ INFO] [1696379422.275289741]: Plugin rc_io initialized
[ INFO] [1696379422.275299103]: Plugin safety_area blacklisted
[ INFO] [1696379422.275350878]: Plugin setpoint_accel loaded
[ INFO] [1696379422.276084779]: Plugin setpoint_accel initialized
[ INFO] [1696379422.276181117]: Plugin setpoint_attitude loaded
[ INFO] [1696379422.279692441]: Plugin setpoint_attitude initialized
[ INFO] [1696379422.279776518]: Plugin setpoint_position loaded
[ INFO] [1696379422.285433857]: Plugin setpoint_position initialized
[ INFO] [1696379422.285506093]: Plugin setpoint_raw loaded
[ INFO] [1696379422.288340912]: Plugin setpoint_raw initialized
[ INFO] [1696379422.288420414]: Plugin setpoint_trajectory loaded
[ INFO] [1696379422.289874134]: Plugin setpoint_trajectory initialized
[ INFO] [1696379422.289945384]: Plugin setpoint_velocity loaded
[ INFO] [1696379422.291543097]: Plugin setpoint_velocity initialized
[ INFO] [1696379422.291726941]: Plugin sys_status loaded
[ INFO] [1696379422.295384692]: Plugin sys_status initialized
[ INFO] [1696379422.295479371]: Plugin sys_time loaded
[ INFO] [1696379422.296996130]: TM: Timesync mode: MAVLINK
[ INFO] [1696379422.297100748]: TM: Not publishing sim time
[ INFO] [1696379422.297470396]: Plugin sys_time initialized
[ INFO] [1696379422.297532579]: Plugin terrain loaded
[ INFO] [1696379422.297751910]: Plugin terrain initialized
[ INFO] [1696379422.297803510]: Plugin trajectory loaded
[ INFO] [1696379422.299371320]: Plugin trajectory initialized
[ INFO] [1696379422.299429681]: Plugin tunnel loaded
[ INFO] [1696379422.300338244]: Plugin tunnel initialized
[ INFO] [1696379422.300413551]: Plugin vfr_hud loaded
[ INFO] [1696379422.300612997]: Plugin vfr_hud initialized
[ INFO] [1696379422.300622452]: Plugin vibration blacklisted
[ INFO] [1696379422.300681158]: Plugin vision_pose_estimate loaded
[ INFO] [1696379422.302809016]: Plugin vision_pose_estimate initialized
[ INFO] [1696379422.302821080]: Plugin vision_speed_estimate blacklisted
[ INFO] [1696379422.302892582]: Plugin waypoint loaded
[ INFO] [1696379422.304410746]: Plugin waypoint initialized
[ INFO] [1696379422.304424302]: Plugin wheel_odometry blacklisted
[ INFO] [1696379422.304514680]: Plugin wind_estimation loaded
[ INFO] [1696379422.304736200]: Plugin wind_estimation initialized
[ INFO] [1696379422.304889276]: Built-in SIMD instructions: SSE, SSE2
[ INFO] [1696379422.304900823]: Built-in MAVLink package version: 2022.12.30
[ INFO] [1696379422.304915526]: Known MAVLink dialects: common ardupilotmega ASLUAV AVSSUAS all cubepilot development icarous matrixpilot paparazzi standard storm32 uAvionix ualberta
[ INFO] [1696379422.304927156]: MAVROS started. MY ID 1.240, TARGET ID 1.1
[ERROR] [1696379507.198396521]: 0: DROPPED Message TIMESYNC: MAVConnSerial::send_message: TX queue overflow
[ERROR] [1696379507.293626381]: 0: DROPPED Message HEARTBEAT: MAVConnSerial::send_message: TX queue overflow

Diagnostics

place here result of:
header: 
  seq: 36
  stamp: 
    secs: 1696379461
    nsecs: 805915006
  frame_id: ''
status: 
  - 
    level: 1
    name: "mavros: FCU connection"
    message: "not connected"
    hardware_id: "/dev/ttyACM1:115200"
    values: 
      - 
        key: "Received packets:"
        value: "0"
      - 
        key: "Dropped packets:"
        value: "0"
      - 
        key: "Buffer overruns:"
        value: "0"
      - 
        key: "Parse errors:"
        value: "0"
      - 
        key: "Rx sequence number:"
        value: "0"
      - 
        key: "Tx sequence number:"
        value: "217"
      - 
        key: "Rx total bytes:"
        value: "0"
      - 
        key: "Tx total bytes:"
        value: "432"
      - 
        key: "Rx speed:"
        value: "0.000000"
      - 
        key: "Tx speed:"
        value: "0.000000"
  - 
    level: 2
    name: "mavros: GPS"
    message: "No satellites"
    hardware_id: "/dev/ttyACM1:115200"
    values: 
      - 
        key: "Satellites visible"
        value: "0"
      - 
        key: "Fix type"
        value: "0"
      - 
        key: "EPH (m)"
        value: "Unknown"
      - 
        key: "EPV (m)"
        value: "Unknown"
  - 
    level: 1
    name: "mavros: Mount"
    message: "Can not diagnose in this targeting mode"
    hardware_id: "/dev/ttyACM1:115200"
    values: 
      - 
        key: "Mode"
        value: "255"
  - 
    level: 2
    name: "mavros: Heartbeat"
    message: "No events recorded."
    hardware_id: "/dev/ttyACM1:115200"
    values: 
      - 
        key: "Heartbeats since startup"
        value: "0"
      - 
        key: "Frequency (Hz)"
        value: "0.000000"
      - 
        key: "Vehicle type"
        value: "Generic micro air vehicle"
      - 
        key: "Autopilot type"
        value: "Generic autopilot"
      - 
        key: "Mode"
        value: ''
      - 
        key: "System status"
        value: "Uninit"
  - 
    level: 0
    name: "mavros: System"
    message: "Normal"
    hardware_id: "/dev/ttyACM1:115200"
    values: 
      - 
        key: "Sensor present"
        value: "0x00000000"
      - 
        key: "Sensor enabled"
        value: "0x00000000"
      - 
        key: "Sensor health"
        value: "0x00000000"
      - 
        key: "CPU Load (%)"
        value: "0.0"
      - 
        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: 2
    name: "mavros: Battery"
    message: "No data"
    hardware_id: "/dev/ttyACM1:115200"
    values: 
      - 
        key: "Voltage"
        value: "-1.00"
      - 
        key: "Current"
        value: "0.0"
      - 
        key: "Remaining"
        value: "0.0"
  - 
    level: 2
    name: "mavros: Time Sync"
    message: "No events recorded."
    hardware_id: "/dev/ttyACM1:115200"
    values: 
      - 
        key: "Timesyncs since startup"
        value: "0"
      - 
        key: "Frequency (Hz)"
        value: "0.000000"
      - 
        key: "Last RTT (ms)"
        value: "0.000000"
      - 
        key: "Mean RTT (ms)"
        value: "0.000000"
      - 
        key: "Last remote time (s)"
        value: "0.000000000"
      - 
        key: "Estimated time offset (s)"
        value: "0.000000000"


### Check ID

ERROR. I got 0 addresses, but not your target 1:1

---
Received 0 messages, from 0 addresses
sys:comp   list of messages

@vooon
Copy link
Member

vooon commented Oct 5, 2023

Check your connection url, as with current one nothing came at all, see "Rx total bytes: 0".

@mbr4477
Copy link

mbr4477 commented Jan 10, 2024

Might vary by AP configuration, but make sure you have told the AP to start sending messages. For example, to get global position data @ 1 Hz you might need call the /mavros/set_message_interval service with { message_id: 33, message_rate: 1.0 }. Then try echoing (for example) /mavros/global_position/rel_alt to see relative altitude.

@JayanthAmmapalli
Copy link
Author

I am facing a similar issue of not seeing any data published in ros topics after starting mavros. I was able to solve this problem by establishing a connecting with GCS software like Mission Planner or Qgroundcontrol first and then switching to mavros will start publishing data in all these topics.

Can @mbr4477 please elaborate on how to manually start sending messages for the topics in mavros.

@mbr4477
Copy link

mbr4477 commented Feb 4, 2024

Disclaimer: I've only been using the ArduCopter simulator, so not sure if the PX4 has any big differences.

@JayanthAmmapalli MAVROS uses MAVLink to talk to the AP. The MAVROS documentation isn't super clear, but that means plugins depend on certain messages being sent from the AP over MAVLink.

I'll use global position as an example, but this all applies for other topics/plugins as well. For the global position plugin, we can see here that it has what appear to be handlers for GPS_RAW_INT, GLOBAL_POSITION_INT, GPS_GLOBAL_ORIGIN, and LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET MAVLink messages. These MAVLink messages have definitions here.

Looking further down the global_position.cpp plugin code, we see that the GLOBAL_POSITION_INT handler unpacks the MAVLink data and publishes to various topics. The trick then is to get the AP to send back the GLOBAL_POSITION_INT message to kick all this off on the MAVROS side. My guess is that it works when you connect the GCS because that GCS sends messages to kick off telemetry. Without it, you need to do it yourself.

To start the GLOBAL_POSITION_INT stream, we need to send MAV_CMD_SET_MESSAGE_INTERVAL via MAVROS. From the MAVLink docs, we can see that the GLOBAL_POSITION_INT message has a message id of 33. Thus, to send this with a rate of 40 Hz, we can do this:

from mavros.srv import MessageInterval
from rclpy.node import Node

def main():
    rclpy.init()
    node = Node("mavros_client")
    logger = node.get_logger()

    client = node.create_client(
        MessageInterval, 
        "mavros/set_message_interval"
    )
    
    logger.info("Waiting for MessageInterval service . . .")
    while not client.service_is_ready():
        rclpy.spin_once(node)
    logger.info("MessageInterval service is ready")
    
    req = MessageInterval.Request()
    req.message_id = 33
    req.message_rate = 40.0

    logger.info(
        "Calling MessageInterval with" 
        + f" msg id = {req.message_id}, rate = {req.message_rate}"
    )
    future = client.call_async(req)
    while not future.done():
        rclpy.spin_once(node)
    res = future.result()
    logger.info("Call completed with success = {res.success}")
    
    node.destroy_node()
    rclpy.shutdown()

 if __name__ == "__main__":
    main()

This is a short-lived node that just spins up, calls the service, and shuts down. More likely you'd want to include these calls in the initialization steps of your existing MAVROS client node. Untested, but hopefully it's enough to point you in the right direction.

This is just for global position data. To get things like IMU data, you'll have to call the MessageInterval service more times to start streaming the other required MAVLink message(s), e.g., MAVLink message id 27 for raw imu data and message id 31 for the attitude quaternion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants