/mavros/setpoint_raw/attitude not working

Hello, I am using Ardupilot SITL with Gazebo simulator.
After switching to GUIDED mode, and taking off, I am publishing attitude setpoints, namely thrust and body rate values to quad. I am using the following topic :
http://docs.ros.org/en/api/mavros_msgs/html/msg/AttitudeTarget.html
But the Quadcopter is simply not responding. I am not any facing error messages.
I am passing header message and correct typemask values.

The rostopic echo shows output as expected
echo values

I am sucessfully able to pass position setpoints using /mavros/setpoint_position/local, but apparently quad is not responding to /setpoint_raw/attitude messages.

Grateful for any help.

Hi, Were you able to resolve it?

It it should work fine in the latest ArduCopter 4.2.0-dev (github master branch) version.
If it doesn’t, update mavros to master and apply this PR to ArduCopter: Support MAVLINK_MSG_ID_SET_ATTITUDE_TARGET by lthall · Pull Request #18833 · ArduPilot/ardupilot · GitHub

It won’t work without merging the PR? I am trying to use type mask 128 to ignore the attitude, how was /mavros/setpoint_raw/attitude topic used prior to the PR you mentioned?

This message has not been full supported yet.

Typemask 128 will not work without the mentioned PR above.

The attitude must be specified as well as the thrust parameter.
You can decide to use or not use yaw rate but the other angular velocities must be ignored as they are currently non-functional.

Okay, I’ll work with the PR and update the results

Hi, thanks for all the help, using that PR, the drone is reacting to the type_mask 128. but when I am trying to use mavros_controllers along with ardupilot, the UAV moves in random motion and then crashes. @amilcarlucas

How well tuned is that drone? how large are the commanded values?
.bin flight logs? .bag ROS files?

No info, no cookie!!!

Hi mavros_controllers works fine with PX4. below I have attached the flight log, ros bag, and the geometric controller launch file.

rostopic echo /mavros/setpoint_raw/attitude
header:
seq: 1221
stamp:
secs: 85
nsecs: 705000000
frame_id: “map”
type_mask: 128
orientation:
x: 0.00867811519853
y: 0.0350737208868
z: 0.000304572675454
w: 0.999347002625
body_rate:
x: -0.41738032697
y: -0.293725780012
z: -8.1391005419
thrust: 0.0

this is a sample message published on topic /mavros/setpoint_raw/attitude, the magnitudes doesn’t change much.

google drive link for rosbag

thanks @amilcarlucas @hendjosh 00000001.BIN (612 KB)controllerlaunch.txt (1.6 KB)

are you using the lastest mavros?

Hi, my mavros version is 1.9.0 which is the latest release @amilcarlucas

Do realize PR’s are usually at various stages of testing before merging. I’m not sure where that one is at currently. I’ve only added a few comments to it regarding parsing and haven’t tried using it myself.

Extra testers on new features are always appreciated :slight_smile:

Perhaps, @Leonardthall might be interested in providing assistance?

Unfortunately, we don’t yet have support for the Attitude_Target messages to see exactly what you sent to the copter. But you can get an idea from the GUID log message and RATE.

@Leonardthall I’m not sure where you are at in terms of coding Attitude_Target?
Also looking at these logs with your PR I’m thinking it might be time attitude_targets got their own log message that reflect the new capabilities?

This PR has the hard parts done and supports:

  • quaternion attitude
  • quaternion attitude + roll and/or pitch and/or yaw rate
  • thrust or climb rate (climb rate is not to spec and must be turned off using GUID_OPTIONS)
  • roll and/or pitch and/or yaw rate.

And the switch between the old vertical rate vs raw throttle control using the guided_options parameter is still present.

I want to move to rigorous support of these messages and this PR was intended to highlight that we need to agree on some changes moving forwards. We have done that now and just need to finish the job.

The problem with that PR is I have not done any work on the logging so I can’t see what you have sent into the controller. I can see that GUID_OPTIONS is set to 0 so thrust will be interpreted as normalised climb rate not thrust.

So before I am happy with this PR we will need to:

  • Update guided logging to make logging clearer and maybe separate logging for position vs angle commands.
  • Add and fix mavlink messages reporting the current state
  • Add messages to support angle + climb rate and maybe angle + angle rate limit + climb rate and/or throttle.

@Rihan_Aaron_Dsilva I am happy to give you a hand by updating my PR to get everything working for you if you like.

yes let’s make this PR work, currently, is the PR updated with the latest changes you mentioned?