How to use mavros_controller with ArduCopter?

I am sorry I attached it now

I did the maual takeoff and then I ran mavros controllers and it was suppose to move to the position x=5, y=0 and z=1, it again flipped in sometime. I have attached the logs here I am running the model in SITL

Are running your own attitude controller here?

yes, I am using mavros_controller for attitude control

Does that have any ability to set rate limits?

rate limits as in the max x, y and z angular velocity? correct me if I am worng

yes, maximum angular rates

I have set max accleration to 0.5m/s

As far as I can see the aircraft is following the rate command exactly as it should.

The rate commands coming from mavros are stupidly high and are unstable. You will need to reduce the gains by a factor of 10 and limit the maximum rates to more reasonable values if you can.

This is position control, not attitude control. The mavros canā€™t maintain a target lean angle so it has no hope in achieving a target acceleration.

okay, let me try, Iā€™ll change the gains of mavros controllers and try

I reduced the mavros controllers gain by approx factor of 10 and results were similar, now I will try reducing the gains of the copter logs

You didnā€™t change anything on the mavros controllers. I am seeing almost exactly the same crazy commands.

This is clearly not an ArduCopter problem, an ArduCopter tuning problem or a problem with the PR. Mavros is commanding the aircraft to crash and the aircraft is then doing what it is told to do.

The only thing that makes sense looking at this is that mavros is commanding the rates in degrees per second instead of radians.

This is completly the wrong thing to do. The problem is not there and you are just blindly trying things hoping it works.

In any case mate, I am satisfied that this is not a problem with ArduCopter and that the problem is with mavros or the settings you are using there.

Good luck.

okay thanks Iā€™ll look into it

Thanks once again for all the info

mavros controllers are publishing body rates in rad/s confirmed here

Hi, @Leonardthall, I am publishing a simple ros message on topic /mavros/setpoint_raw/attitude, the message is

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;

I am doing a manual takeoff and then publishing this message, the drone shoots off in altitude and starts moving in +X direction, it follows a parabolic path and crashes

here are the logs

any thoughts? any help is appreciated

thanks

What did you expect to do in this flight?
Looks like AP performed your command exactly. I guess the crash was due to lack of thrust

Hi, I am using this repo to test FAST path planner, the repo uses mavros_controllers to make sure the MAV follows the trajectory, it uses PX4 by default, I changed the firmware to ardupilot, but the MAV seems to crash which I use it in this pipeline

thanks

Did you test your command at PX4?
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;
I think result will be the same.

thatā€™s what I thought, but No, in PX4, the copter slowly started moving in +X direction with minimum z since I didnā€™t pass any z value and thrust is 0.5

Hi,
When I publish the following ros message

mavros_msgs::AttitudeTarget msg;

  msg.header.stamp = ros::Time::now();
  msg.header.frame_id = "map";
  msg.body_rate.x = 0.0;
  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 = 1.0;

the copter starts following an inclining path in +X direction rather than a straight-up path, can you please tell me why is that happening?

thanks, logs