I’ve been trying to use MAVLINK_MSG_ID_SET_ATTITUDE_TARGET to get my drone to change its angle with limited success. The manoeuvre I am initially looking at is to yaw the drone, although eventually I will need pitch and pitch rate control, all using GUIDED mode.
I am aware that a quaternion must be set up and the thrust must be passed to the drone for it to respond to the SET_ATTITUDE_TARGET message however here is a video of what happens when I tell my drone to yaw by pi/2 rads = 90 degrees.
It seems to yaw by the right amount but why does the drone fly off in a direction? Surely it should just yaw on the spot? I supply a log here with password set as my username. The 90 degree yaw attempt happens at about 13:18:55.
When I tell the drone to yaw by pi rads = 180 degrees, this video shows the result. Why does it not yaw by 180 degrees as expected?
Must I run SET_ATTITUDE_TARGET repeatedly in order that the drone continues to that target and if so, how often? Is a single message (as I am currently sending) sufficient?
I am using the Ardupilot “Quaternion::from_euler” function to convert radians to quaternions and using the correct type_mask to ensure that all 3 of roll rate, pitch rate and yaw rate are ignored (is this correct?).
Many thanks and sorry for all the questions.