mavros icon indicating copy to clipboard operation
mavros copied to clipboard

Mavros message interpreted differently on ardupilot and pixhawk

Open shubham-shahh opened this issue 4 years ago • 5 comments
trafficstars

Hi,


Issue details

I am using the topic /mavros/setpint_raw/attitude with typemask 128 (ignoring orientation) with mavros_controllers using PX4 firmware it works as expected but when I try to use the same topic with ardupilot It doesn't work well. I am wondering why for the same ros message on same mavros topics, the UAV is behaving differently. I think of mavros as a layer of abstraction. I know this is not an issue specific to mavros, but any help or insights are appreciated.

thanks

MAVROS version and platform

Mavros: 1.9.0 ROS: Melodic Ubuntu: 18.04

Autopilot type and version

[ X ] ArduPilot [ ] PX4

Version: specific PR

shubham-shahh avatar Oct 20 '21 05:10 shubham-shahh

APM and PX4 have different support options for type masks, and require to set different mode. Here for example you need to set GUIDED mode:

https://github.com/Jaeyoung-Lim/mavros_controllers/blob/d74291bc1c0e6d08028f6a0dda3956b9274c5338/geometric_controller/src/geometric_controller.cpp#L267-L288

I think you need ask for APM support in controllers package. Cc: @Jaeyoung-Lim

vooon avatar Oct 20 '21 09:10 vooon

Hi, @vooon I tried using the GUIDED mode but still the results are not appropriate. and as far as I saw the typemask scheme for this message is same for ardupilot. I asked @Jaeyoung-Lim, but he said he hasn't worked with ardupilot so no support for that.

shubham-shahh avatar Oct 20 '21 11:10 shubham-shahh

I suppose you have to read apm sources to find out what type mask you can use. Can you describe a bit more verbose what drone's is doing?

vooon avatar Oct 20 '21 14:10 vooon

Hi @vooon, Thanks for the response,

when using PX4: I am trying to use the Fast-panner, it works well with the PX4 since it has mavros_controllers which make sure that the UAV follows the trajectory given by the path planner. the mavros controller takes in the ps,vel,acc,yaw given by the planner and converts it to body rates and publishes it to /mavros/setpoint_raw/attitude with typemask 128 (ignoring orientation)

with ardupilot The output of the path planner is pos, vel, acc, yaw if I pass that to the /mavros/setopint_raw/local which takes in all the parameters I mentioned but the UAV does not follow the path given by the path planner. If I try to use mavros_controllers with ardupilot with typemask 128, the UAV does not act like it is meant to.

for example when I publish the following ROS message on /mavros/setpoint_raw/attitude for PX4 and ardupilot

msg.header.stamp = ros::Time::now(); msg.header.frame_id = “map”; msg.body_rate.x = 0.01; msg.body_rate.y = 0.0; msg.body_rate.z = 0.0; msg.type_mask = 128; // Ignore orientation messages msg.orientation.w = 0.0; msg.orientation.x = 0.0; msg.orientation.y = 0.0; msg.orientation.z = 0.0; msg.thrust = 0.5;

they both have a different response for the same message. In case of ardupilot I am using a PR which has the same typemask as PX4

thanks

shubham-shahh avatar Oct 20 '21 19:10 shubham-shahh

Could you make some video of that different response?

But probably i would rather use PX4, since required packages both developed for it.

vooon avatar Oct 20 '21 20:10 vooon