mavlink / mavros

MAVLink to ROS gateway with proxy for Ground Control Station
Other
880 stars 990 forks source link

Mavros message interpreted differently on ardupilot and pixhawk #1636

Open shubham-shahh opened 2 years ago

shubham-shahh commented 2 years ago

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

vooon commented 2 years ago

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

shubham-shahh commented 2 years ago

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.

vooon commented 2 years ago

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?

shubham-shahh commented 2 years ago

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

vooon commented 2 years ago

Could you make some video of that different response?

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