I’m successfully controlling a fixed wing plane in SITL but am in need of a better explanation of the message. I’m using the quaternion to command roll and pitch but don’t know what values to pass in. At first since the rates are in radians/second I figured the quaternion would be in radians, so if my desired attitude is a 25 degree bank I would pass in radians(25) into the x value of the quaternion, but it seems to bank more. With pitch it is even more sensitive. Can someone explain to me the units of the quaternion and how I can translate a desired bank angle into the Q? Thanks
You need to convert first. https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles
There are helper functions directly in mavlink. https://github.com/mavlink/c_library_v1/blob/e93ac62981a338a7c823364e7c4ff1077e3f8fc1/mavlink_conversions.h
I’m also having issues understanding how to use SET_ATTITUDE_TARGET. My understanding is the q value is for the attitude quaternion so whatever the value we set here is the attitude set point we want to achieve. So are the body rates specifying how fast to move to these positions?
I want to minimize the inputs to control the quadcopter so I’m trying to understand when to set only q (as the OP is doing) or both q and the rates. If my understanding above is correct, if only q is set what rates are used?
I’m in offboard mode but would like to control the quadcopter the same way as in manual mode (i.e. control by roll pitch yaw thrust). I’ve tried to use SET_ATTITUDE_TARGET with only the body rates but I don’t get the expected performance unless I also set q.
Thanks for the help
My guess is that there are default parameters set in PX4 for roll, pitch, and yaw rates so the it will be limitted to those unless you directly specify in that message.
Yea looks like you are right, digging into the code I found this,
So if you only specify the attitude quaternion and thrust, it will calculate the optimal rates for you, and then make sure they are within rage. From QGC you can change these rate constraints by MC_PITCHRATE_MAX, MC_ROLLRATE_MAX, MC_YAWRATE_MAX
Please correct me if I’m wrong
@dagar How does the yaw input for attitude target affect the plane? I’ve been using 0 and just roll and pitch but wasn’t sure if the 0 yaw would have impact for fixed wing attitude control
Do you use the SET_ATTITUDE_TARGET control for fixed wing in offboard mode? I try to make my fixed wing enter the offboard mode, but it failed.
@zhanghouxin07 What version of the firmware are you using? Fixed wing offboard mode has been enabled pretty recently.
the firmware version used is 1.9.0dev in gazebo simulation. Could you tell me which version supports the offboard mode?
I have been done some works in rotated-wing uavs, and I implemented all the mode in rotatedwing. now, I use the almost same codes to complete my fixed wing work. I’m not sure that if the process of entering the offboard mode is same as the rotated-wing.
thx a lot
aha, I try to enter offboard again. I found that the fixed wing should take off first, then it can enter Offboard mode successfully. In previous work for fw, I implement the same process with rotated-wing, for instance, auto takeoff.
thx again for your nice help.
If you have any questions, we can further communicate via mail or others.