How to use mavros_controller with ArduCopter?

I just tested it again and it all worked:

can you please test it with the repo i mentioned? and where can i set GUID_OPTIONS 8, since I am not using any GCS, how can I set this param in SITL

Sorry but you will have to test your repo. I can only test my code.

you can set parameters:

https://ardupilot.org/dev/docs/using-sitl-for-ardupilot-testing.html#setting-parameters

okay thanks for all the info, Iā€™ll post the results of testing


Why in my case it is not recognising the command?

You have to load the module first

module load message

If you want it to continue to move you need to ignore the attitude too.

So type:

module load message
Then
message SET_ATTITUDE_TARGET 0 1 0 128 [1,0,0,0] 0 0 3.14 0.5

okay thanks, Iā€™ll try it

Any luck. I am about to go to bed.

No, I used all the above info and tried running the path planner with the mavros controllers but still it is exhibiting same behaviour

Just for perspective, when mavros controllers publish body rates, it works as intended with PX4, autopilot

Any suggestions on how can I debug this problem?

Do you have the log for me.

Did the direct command work for you?

Hang on, are you saying you do get the correct response when you command normal body rate commands. But it is only when you run your whole script that it causes a problem?

I did that test just to make sure that my copter is having the same frame of reference in both the cases

I will run the path planner stack again and Iā€™ll share the logs

This is the log file when I run ardupilot with mavros_controller log file

one of the sample message being published on the topic


header:
seq: 1232
stamp:
secs: 506
nsecs: 966000000
frame_id: ā€œmapā€
type_mask: 128
orientation:
x: -0.00979128452178
y: 0.00281856491637
z: -2.7598803652e-05
w: 0.999948091492
body_rate:
x: 0.143888078962
y: 0.0323702044223
z: -0.145392262634
thrust: 0.0

So in the log

So as far as I can see you have taken off in guided mode and immediately commanded a roll and pitch rate of 1.3 degrees per second and a yaw rate of 572 degrees per second (crazy high) and a throttle of 64%.

I can see that the aircraft commanded attitude is following the guided command. However the aircraft flips on take off.

Is this running the models in SITL or is it connected to some other flight model. The reason I ask is the logs look like the simulated aircraft is not stable or has not been setup properly. This may simple be because the guided inputs are crazy and the aircraft doesnā€™t get a chance to take off and basically flipps immediately OR it may be because you are running a different flight model that doesnā€™t match the autopilot setup.

In general here mate I think this is your code not ArduCopter. There is not take off command and you are immediately commanding a huge yaw input before the aircraft can take off. I can see the targets are following the guided inputs. I can see that the Guided inputs are crazy and the aircraft hasnā€™t been given a chance to take off.

Please donā€™t mention PX4 again. I donā€™t care what PX4 does or does not do and it isnā€™t relevant here. I have logs that show what you are commanding is crazy and the aircraft canā€™t follow these commands for some reason. The question is why.

If you want any more of my help you need to make more of an effort to answer my questions clearly.

Did you manually command body rate commands using guided mode like this?

module load message
message SET_ATTITUDE_TARGET 0 1 0 128 [1,0,0,0] 0 0 3.14 0.5

And did it yaw at 180 degrees per second as you would expect?

I suspect your code is the problem here. To convince me there is a problem with the PR you will need to take off properly using either a take off command or manually, then start your script using requested rates that are sensible.

Hi, Thanks for all the insights, when I manually commanded the message you mentioned, in logs, I can see there is a mismatch in desired pitch roll and attained pitch roll, I will try your suggestion of starting the script after manually taking it off below I have attached the log file when I used the message command manually
thanks logs

It doesnā€™t look like you attached the log.