Closed szebedy closed 6 years ago
PX4 do not support that message. Read PX4 firmware docs on how to configure message rates.
PX4 has support for MAV_CMD_GET_MESSAGE_INTERVAL and MAV_CMD_SET_MESSAGE_INTERVAL.
https://mavlink.io/en/messages/common.html#MAV_CMD_GET_MESSAGE_INTERVAL
Yes, but that iface is not yet supported by mavros (requires new rosapi call).
@vooon , @dagar Thanks for pointing me to the right direction. Could you suggest a way to get the MAV_CMD_SET_MESSAGE_INTERVAL mavlink command to PX4?
I tried rosrun mavros mavcmd int 511 105 10000 100 1 1 1 1
, but no success. The numbers stand for the following:
511: https://mavlink.io/en/messages/common.html#MAV_CMD_GET_MESSAGE_INTERVAL
105: https://github.com/PX4/Firmware/blob/4453e4201b7a245cff52beeb38a293161aea4c48/Tools/mavlink_px4.py#L506
1 1 1 1: Had to fill up with something, otherwise got mavcmd int: error: too few arguments
Also increased the IMU rate with the mavlink module of PX4 mavlink stream -u 14556 -s HIGHRES_IMU -r 100
. Still the rate stays 50 when I check it with rostopic hz /mavros/imu/data
. What needs to be done outside of mavros so that is publishes the /mavros/imu/data
topic faster?
Try also command long, mavcmd long 511 105 1000 0 0 0 0 0 0
Thanks for the quick reply @vooon
Tried rosrun mavros mavcmd long 511 105 1000 0 0 0 0 0
, unfortunately the rate is still 50.
What triggers mavros to publish on /mavros/imu/data
? I've found that the data is published here in the function handle_attitude_quaternion
, but I haven't found what triggers that function.
@szebedy the Aero is streaming the data through UDP right? What's the port it is using? Why are you plugging through TCP instead? mavlink stream -u 14556 -s HIGHRES_IMU -r 100
will only work if the Aero is actually streaming through that UDP port.
What triggers mavros to publish on
/mavros/imu/data
? I've found that the data is published here in the functionhandle_attitude_quaternion
, but I haven't found what triggers that function.
It triggers when MAVROS receives a HIGHRES_IMU
msg from the stream.
@TSC21 Very good remark, the Aero Flight Controller is actually streaming the data through a serial port (/dev/ttyS1) to the compute board. However, to make things "easier", the compute board has a proxy which exposes the serial port as a network socket (port 5760).
Therefore I tried mavlink stream -d /dev/ttyS1 -s HIGHRES_IMU -r 100
, but unfortunately the streaming rate remains 50 :(
On PX4 data_raw
shoud have same rate as HIGHRES_IMU, but data
combine ATTITUDE_QUATERNION
and hr-imu, so try change it's rate too.
the compute board has a proxy which exposes the serial port as a network socket (port 5760).
Then the problem may be on the proxy. I would guarantee that the bottleneck is not there.
Thank you so much @vooon (and @TSC21), that did the trick!!! So the current solutions are:
Execute the following in QGC Mavlink Console:
mavlink stream -d /dev/ttyS1 -s HIGHRES_IMU -r 100
mavlink stream -d /dev/ttyS1 -s ATTITUDE_QUATERNION -r 100
In a terminal
rosrun mavros mavcmd long 511 105 10000 0 0 0 0 0
rosrun mavros mavcmd long 511 31 10000 0 0 0 0 0
Is it possible to include these two commands in a ROS launch file (or in a C++ ROS node)?
Is it possible to include these two commands in a ROS launch file (or in a C++ ROS node)?
Just put:
mavlink stream -d /dev/ttyS1 -s HIGHRES_IMU -r 100
or
mavlink stream -d /dev/ttyS1 -s ATTITUDE_QUATERNION -r 100
in https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/4070_aerofc, reprogram your Aero board and reboot it. And you won't need to even use the ROS commands. Closing this then.
Also just a remark:
If you want to get data from mavros/imu/data_raw
, you just need to increase the stream of HIGHRES_IMU
. If you want to get from mavros/imu/data
(filtered attitude), you just increase from ATTITUDE_QUATERNION
. Not need to increase for both (as you would increase the bandwidth usage for no reason). You were simply getting the data from the wrong topic in the first place. If you issued rostopic hz /mavros/imu/data_raw
, you would have saw the increase on the data rate.
Just put:
mavlink stream -d /dev/ttyS1 -s HIGHRES_IMU -r 100
or
mavlink stream -d /dev/ttyS1 -s ATTITUDE_QUATERNION -r 100
in https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/4070_aerofc, reprogram your Aero board and reboot it. And you won't need to even use the ROS commands. Closing this then.
@TSC21 For some reason this didn't have any effect, any idea why? I inserted mavlink stream -d /dev/ttyS1 -s ATTITUDE_QUATERNION -r 100
to the end of https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/4070_aerofc, built with make aerofc-v1_default
, then uploaded with make aerofc-v1_default upload
. The upload completes, I reboot but the rate of mavros/imu/data
stays 50.
@TSC21 aero does not have extras.txt
script feature? Pixhawk can execute extras.txt script from SD card, that allows to setup streams.
@TSC21 For some reason this didn't have any effect, any idea why? I inserted mavlink stream -d /dev/ttyS1 -s ATTITUDE_QUATERNION -r 100 to the end of https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/4070_aerofc, built with make aerofc-v1_default, then uploaded with make aerofc-v1_default upload. The upload completes, I reboot but the rate of mavros/imu/data stays 50.
Maybe it's overwritten by this line: https://github.com/PX4/Firmware/blob/ab279d5fe9e014cec26add8a56bd5e676152b1c5/src/modules/mavlink/mavlink_main.cpp#L2042
My current working solution is to replace configure_stream("ATTITUDE_QUATERNION", 50.0f);
to configure_stream("ATTITUDE_QUATERNION", 100.0f);
, then build and upload.
Issue details
I am trying to increase the update rate of the IMU using the ~set_stream_rate service call. I tried increasing and decreasing the rate as well, unfortunately without success.
I have tried the following: In a terminal:
rosservice call /mavros/set_stream_rate 1 200 1
(also tried it with 0 200 1, 0 10 1, 0 10 0 etc.)In C++:
None of these worked, have no idea why. I also don't know how to proceed with debugging.
MAVROS version and platform
Mavros: 0.25.1 ROS: Kinetic Ubuntu: 16.04
Autopilot type and version
[ ] ArduPilot [ x ] PX4
Version: 1.7.3
Node logs
Diagnostics
Check ID