ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Mavros topics not publishing?

asked 2014-09-24 13:35:40 -0600

Eric Schneider gravatar image

updated 2014-09-27 19:20:12 -0600

Hi,

I've been trying to connect to a Pixhawk quadcopter using the mavros library ( http://wiki.ros.org/mavros ) and I had some issues. We are using a pixhawk and a 3DR Iris quadcopter, and we launch the mavros code with

roslaunch mavros apm2_radio.launch

The code launches with no errors are we see a long list of topics being displayed:

/diagnostics
/mavlink/from
/mavlink/to
/mavros/battery
/mavros/fix
/mavros/gps_vel
/mavros/imu/atm_pressure
/mavros/imu/data
/mavros/imu/data_raw
/mavros/imu/mag
/mavros/imu/temperature
/mavros/mission/waypoints
/mavros/radio_status
/mavros/rc/in
/mavros/rc/out
/mavros/rc/override
/mavros/state
/mavros/time_reference
/rosout
/rosout_agg

The good news is that the /mavros/state, /diagnostics, and /mavros/radio_status seem to be publishing correctly

$:rostopic echo /mavros/state
    header: 
      seq: 100
      stamp: 
        secs: 1411583514
        nsecs: 793784329
      frame_id: ''
    armed: False
    guided: False
    mode: ALT_HOLD

The bad news is that every other topic is empty. No GPS data, no battery data, no RC data, etc. Has anyone else run this code and knows how to get this data to publish?

The closest thing online I found is this online book: http://erlerobotics.gitbooks.io/erler...

The problem is, they experienced the same problem but gave no reason/fix for it.

Thanks!

EDIT: Adding information On a fresh install of Ubuntu 14.04 and a newly installed mavros

sudo apt-get install mavros

I tried to get sensor data from a 3DR Iris Pixhawk. As per @vooon 's suggestion, I used rqt_logger_level to view the mavros.ros.mavconn debug messages.

# Changed the default fcu_url to ttyUSB0 instead of ttyACM0, because that's the port my 3DR modem was on.
<arg name="fcu_url" default="/dev/ttyUSB0:57600" />

Launched the file using px4.launch, enabled mavconn Debug messages, and watched the message ID's that showed up.

  1. First, during the section where you get the heartbeat, there were a mixture of 0, 166, and 109 messages.
  2. Then message ID 253 was published three times in a row, in conjunction with FCU lines for ArduCopter V3.1.2, PX4 and PX4v2:

    [DEBUG] [1411862177.961715937]: serial0:recv: Message-Id: 253 [51 bytes] Sys-Id: 1 Comp-Id: 1 [ INFO] [1411862177.961821314]: FCU: ArduCopter V3.1.2 (e2ed3dd1)

  3. After that, during bootup, there is a fast stream of 22 IDs split up by 0, 166, and 109

  4. At the end of a long stream of 22's it gets 43, 44, 40, 39, and 47 in quick succession:

    [DEBUG] [1411862299.848786274]: serial0:send: Message-Id: 43 [2 bytes] [DEBUG] [1411862299.929775171]: serial0:recv: Message-Id: 44 [4 bytes] Sys-Id: 1 Comp-Id: 1 [DEBUG] [1411862299.929917816]: serial0:send: Message-Id: 40 [4 bytes] [DEBUG] [1411862300.143771523]: serial0:recv: Message-Id: 39 [37 bytes] Sys-Id: 1 Comp-Id: 1 [ INFO] [1411862300.143899206]: WP: item #0 GAA WAYPOINT CUR params: 0, 0, 0, 0 x: 42.2936 y: -71.2638 z: 0 [DEBUG] [1411862300.143942143]: serial0:send: Message-Id: 47 [3 bytes] [ INFO] [1411862300.143995581]: WP: mission received [ WARN] [1411862300.673739713]: PR: request param #133 timeout, retries left 2, and ...

(more)
edit retag flag offensive close merge delete

Comments

Are you using APM firmware on the PX4? If not, try using the PX4 launch file. There is a quirk for PX4. Do you get a heartbeat?

tonybaltovski gravatar image tonybaltovski  ( 2014-09-24 14:24:53 -0600 )edit

I'll post the code I get upon launch in the answer below, it maxes out the comment length

Eric Schneider gravatar image Eric Schneider  ( 2014-09-24 16:13:44 -0600 )edit

Try enable .mavconn debug output using rqt_logger_level. Also use rqt to view diagnostics and topic updates. I tested with apm2_radio.launch with original APM 2.6, works. On pixhawk i only use PX4, but should no matter.

vooon gravatar image vooon  ( 2014-09-24 19:06:45 -0600 )edit

@tony - I tried using the PX4 launch file and have the same problem, unfortunately. I do get the heartbeat message: CON: Got HEARTBEAT, connected.

Eric Schneider gravatar image Eric Schneider  ( 2014-09-26 18:42:33 -0600 )edit

@vooon - I enabled the ros.mavros.mavconn Debug level and got a lot of messages like this: "serial0:recv: Message-Id: 22 [25 bytes] Sys-Id: 1 Comp-Id: 1" with a couple different message IDs. There weren't any obvious flags showing up in the debug stream.

Eric Schneider gravatar image Eric Schneider  ( 2014-09-26 18:48:23 -0600 )edit

I could easily be doing something dumb where I have to arm the quadcopter or flip some switch before it starts publishing to the sensor data topics. Currently I just turn the copter on, hit the safety button, and check whether /mavors/imu/data, /mavros/battery, etc. are getting anything

Eric Schneider gravatar image Eric Schneider  ( 2014-09-26 19:04:52 -0600 )edit

Check that following message ids are send: 30 (ATTITUDE), 27 (RAW_IMU), 24 (GPS_RAW_INT).

20-23 is parameter protocol messages.

vooon gravatar image vooon  ( 2014-09-27 01:23:33 -0600 )edit

Also what version you use?

vooon gravatar image vooon  ( 2014-09-27 01:25:57 -0600 )edit

6 Answers

Sort by » oldest newest most voted
1

answered 2014-10-08 09:52:28 -0600

Eric Schneider gravatar image

Long story short, the mavros topics weren't publishing because there were firmware updates for the various radios in the system that we hadn't implemented. 1) The radio modem that connected to the computer was correct 2) The radio modem on the Pixhawk was out of date 3) The firmware on the Pixhawk itself was out of date

It's our first time working with the Pixhawk so we didn't think to check the firmware of various components, when we upgraded using the APM Mission Planner GUI then we started getting all topics being published correctly. Thanks to @vooon for his help.

edit flag offensive delete link more

Comments

I can't mark this as the answer because my karma isn't high enough, but for us the question is closed

Eric Schneider gravatar image Eric Schneider  ( 2014-10-08 09:53:36 -0600 )edit

Sometimes this error will come up again and running APM Mission Planner, connecting, and disconnecting will help solve the issue.

Eric Schneider gravatar image Eric Schneider  ( 2014-10-11 18:44:48 -0600 )edit
3

answered 2016-04-20 09:26:29 -0600

anas ibrahim gravatar image

updated 2016-04-20 09:34:00 -0600

i know this is an old question but google still get you here first.

i had the same problem with apm 2.5 and 2.6. i had ( two apm 2.6 and one apm 2.5) one of the apm 2.6 worked with no problem. but the other two apm not.

i found a command on this link and it had this command

rosservice call /mavros/set_stream_rate 0 10 1

and everything for all apm worked after then. it also contains how t do this from C++

edit flag offensive delete link more

Comments

That solved the problem!

Gustavo Avellar gravatar image Gustavo Avellar  ( 2017-10-06 12:54:46 -0600 )edit

This worked for me!

dhsantos gravatar image dhsantos  ( 2019-11-13 12:51:55 -0600 )edit

Also worked for me, although the link above does not seem to be valid anymore.

DavidBeaudette gravatar image DavidBeaudette  ( 2020-04-08 08:48:59 -0600 )edit
0

answered 2015-04-24 13:46:49 -0600

voladoddi gravatar image

updated 2015-04-24 13:48:46 -0600

Hello @vooon and @eric-schneider , I'm stuck somewhere similar but my source of the problem is elsewhere I think.

1) I am using Ubuntu 14.04 and mavros for ROS Indigo.


2) FCU I am using 3DR Robotics Iris equipped with Pixhawk.


3) I installed mavros using sudo apt-get install ... . This part is fine. Next, I connect the USB receiver to my computer and I change the "ttyACM0" in the px4.launch file to "ttyUSB0".


4) Then I call the launch file, and I see

[ INFO] [1429900676.296419593]: FCU URL: /dev/ttyUSB0:115200
[ INFO] [1429900676.296568384]: serial0: device: /dev/ttyUSB0 @ 115200 bps
[ INFO] [1429900676.297267179]: GCS bridge disabled
[ INFO] [1429900676.338080124]: Plugin 3dr_radio loaded and initialized
[ INFO] [1429900676.340020654]: Plugin actuator_control loaded and initialized
[ INFO] [1429900676.343256392]: Plugin command loaded and initialized
[ INFO] [1429900676.349410801]: Plugin ftp loaded and initialized
[ INFO] [1429900676.355797673]: Plugin global_position loaded and initialized
[ INFO] [1429900676.358029042]: Plugin gps loaded and initialized
[ INFO] [1429900676.358063670]: Plugin image_pub blacklisted
[ INFO] [1429900676.368613134]: Plugin imu_pub loaded and initialized
[ INFO] [1429900676.371929447]: Plugin local_position loaded and initialized
[ INFO] [1429900676.423800247]: Plugin mocap_pose_estimate loaded and initialized
[ INFO] [1429900676.425444083]: Plugin param loaded and initialized
[ INFO] [1429900676.429073723]: Plugin px4flow loaded and initialized
[ INFO] [1429900676.431786149]: Plugin rc_io loaded and initialized
[ INFO] [1429900676.433578150]: SA: Set safty area: P1(1.000000 1.000000 1.000000) P2(-1.000000 -1.000000 -1.000000)
[ INFO] [1429900676.435489856]: Plugin safety_area loaded and initialized
[ INFO] [1429900676.438453801]: Plugin setpoint_accel loaded and initialized
[ INFO] [1429900676.444126377]: Plugin setpoint_attitude loaded and initialized
[ INFO] [1429900676.448153997]: Plugin setpoint_position loaded and initialized
[ INFO] [1429900676.449946335]: Plugin setpoint_velocity loaded and initialized
[ INFO] [1429900676.455628269]: Plugin sys_status loaded and initialized
[ INFO] [1429900676.458712512]: Plugin sys_time loaded and initialized
[ INFO] [1429900676.459608376]: Plugin vfr_hud loaded and initialized
[ INFO] [1429900676.464448577]: Plugin vision_pose_estimate loaded and initialized
[ INFO] [1429900676.467479429]: Plugin vision_speed_estimate loaded and initialized
[ INFO] [1429900676.470861478]: Plugin visualization loaded and initialized
[ INFO] [1429900676.473968732]: Plugin waypoint loaded and initialized
[ INFO] [1429900676.474017908]: Autostarting mavlink via USB on PX4
[ INFO] [1429900676.474039611]: Built-in mavlink dialect: ardupilotmega
[ INFO] [1429900676.474059391]: MAVROS started. MY ID [1, 240], TARGET ID [1, 50]

Now I wonder if [ INFO] [1429900676.474039611]: Built-in mavlink dialect: ardupilotmega is the problem because when I launch a new terminal and do a rostopic list I can see -

/diagnostics
/mavlink/from
/mavlink/to
/mavros/actuator_control
/mavros/battery
/mavros/global_position/compass_hdg
/mavros/global_position/global
/mavros/global_position/gp_vel
/mavros/global_position/local
/mavros/global_position/rel_alt
/mavros/gps/fix
/mavros/gps/gps_vel
/mavros/imu/atm_pressure
/mavros/imu/data
/mavros/imu/data_raw
/mavros/imu/mag
/mavros/imu/temperature
/mavros/local_position/local
/mavros/mission/waypoints
/mavros/mocap/pose
/mavros/px4flow/ground_distance
/mavros/px4flow/raw/optical_flow_rad
/mavros/px4flow/temperature
/mavros/radio_status
/mavros/rc/in
/mavros/rc/out
/mavros/rc/override
/mavros/safety_area/set
/mavros/setpoint_accel/accel
/mavros/setpoint_attitude/att_throttle
/mavros/setpoint_attitude/cmd_vel
/mavros/setpoint_position/local
/mavros/setpoint_velocity/cmd_vel
/mavros/state
/mavros/time_reference
/mavros/vfr_hud
/mavros/vision_pose/pose
/mavros/vision_speed/speed_vector
/mavros/visualization/track_markers
/mavros/visualization/vehicle_marker
/mavros/wind_estimation
/rosout
/rosout_agg ...
(more)
edit flag offensive delete link more

Comments

Did you read http://wiki.ros.org/mavros#Usage ? You shall use apm.launch because by default 3DR Pixhawk comes with APM firmware. Second don't change launch file defaults, add fcu_url:=/your/port/url. Next check /diagnostics.

vooon gravatar image vooon  ( 2015-04-24 16:51:35 -0600 )edit

Hi @vooon , I managed to get the data (like battery and etc) by updating the firmware for both radio and the drone using Mission planner and roslaunch px4.launch (didn't see your answer until now).

You're saying regardless of that, we should use apm.launch because ETH pixhawk was px4 & 3dr is APM?

voladoddi gravatar image voladoddi  ( 2015-04-24 18:14:05 -0600 )edit
vooon gravatar image vooon  ( 2015-04-25 02:11:04 -0600 )edit
0

answered 2014-10-06 12:30:05 -0600

Hi-

I am having similar issues. My setup: Ubuntu 14.04, ROS Indigo, 3DR X8 with PX4.

I am running:

$ roslaunch mavros px4.launch

$ roslaunch mavros_extras teleop.launch

I am trying to arm the quad. When I press [2] to arm, I do not get any debug messages or response. When I pressed [0] or [1] to takeoff/land, I get a command received, request failed. My joystick is working properly and I can arm/disarm using the RC controller. Is there another script that needs to be running for teleop mode using a joystick? Or perhaps a dead-man switch? Maybe a setting in a yaml or launch file?

Thank you for any assistance.

edit flag offensive delete link more

Comments

Hi Christopher, we are having a similar arming issue to this but our original topics problem has been solved, so I'm going to close the question. I'll make a new question for the arming issue

Eric Schneider gravatar image Eric Schneider  ( 2014-10-08 09:49:23 -0600 )edit

Teleop stript is not comleted and may not fully work. Issue: https://github.com/mavlink/mavros/iss...

Also i receive several reports that APM rejects arming on APM:Copter. Last time i see APM code it require some checks and may return "UNSUPPORTED" if that checks fail.

vooon gravatar image vooon  ( 2014-10-08 09:55:29 -0600 )edit

Please ask at diy-drones what steps required to ARM. Because cmd/arming is simply sends command 400. E.g. my bixler with APM:Plane use autoarm, so explicit arming not reqired, but it responds to 400 normally. PX4 on the desk don't arm (but conditions are not met).

vooon gravatar image vooon  ( 2014-10-08 10:01:14 -0600 )edit

Hi Christopher, I opened a new question here: http://answers.ros.org/question/19450...

It might be cleanest if you move your query there, but probably not a big deal

Eric Schneider gravatar image Eric Schneider  ( 2014-10-08 10:02:12 -0600 )edit
0

answered 2014-10-22 09:20:37 -0600

ant gravatar image

I am having similar issues. I am running:

$ roslaunch mavros px4.launch

Everything seems fine, when I try to arm the PX4 I type:

$ rosrun mavros mavsafety arm

One terminal said: [INFO][141398710.136667466]:FCU: command received;

whereas another terminal said: Request failed, Check mavros logs

(Arming with RC is OK)

edit flag offensive delete link more
0

answered 2019-07-11 01:12:51 -0600

indraneel gravatar image

I had a similar issue, px4.launch was executing properly but no heartbeat inspite of the UART serial communication working properly (I did a loopback test). I am using a raspberry pi 3 B with a pixracer.

What worked out for me was changing the baudrate in the launch file to 921600. Hope this helps someone!

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2014-09-24 13:35:40 -0600

Seen: 13,343 times

Last updated: Jul 11 '19