My setup:
- I am using Ardupilot SITL to simulate a plane.
- I will have no GPS in my plane.
Setting | Value | Purpose |
---|---|---|
EK3_ENABLE |
1.0 |
Fly by inertia |
EK2_ENABLE |
0.0 |
Fly by inertia |
AHRS_EKF_TYPE |
3.0 |
Fly by inertia |
AHRS_GPS_USE |
0.0 |
Fly by inertia |
EK3_SRC1_POSXY |
0.0 |
Fly by inertia |
EK3_SRC1_VELXY |
0.0 |
Fly by inertia |
EK3_SRC1_POSZ |
1.0 |
Fly by inertia |
EK3_SRC1_VELZ |
0.0 |
Fly by inertia |
EK3_SRC1_YAW |
1.0 |
Fly by inertia |
INITIAL_MODE |
5.0 |
FBWA mode |
FLTMODE1 |
5.0 |
FBWA mode |
FLTMODE2 |
5.0 |
FBWA mode |
FLTMODE3 |
5.0 |
FBWA mode |
FLTMODE4 |
5.0 |
FBWA mode |
FLTMODE5 |
5.0 |
FBWA mode |
FLTMODE6 |
5.0 |
FBWA mode |
(I wasn’t sure which flight mode needs to be in FBWA mode, so I set them all)
Assume that I fly the plane up to some 1000 meters above ground manually before I start sending this message 5 times per second:
SET_ATTITUDE_TARGET {
time_boot_ms: now_millis(),
target_system: 1,
target_component: 1,
roll_rate: 0.785, // (ca 45 degrees in radians to the right)
pitch_rate: 0.0,
yaw_rate: 0.0,
thrust: 0.5,
type_mask: 128, // I *believe* this ignores the quaternion I'm not setting.
}
https://mavlink.io/en/messages/common.html#SET_ATTITUDE_TARGET
My assumption is that this should make the plane cork screw very hard to the right, but this doesn’t happen.
-
When the plane is in GUIDED mode, this makes it go forward and slightly up, so it slowly gains altitude. It doesn’t roll.
-
When the plane is in MANUAL mode, it pitches up very strongly and starts looping that way instead. It doesn’t roll.
-
In both modes, if I stop sending the messages, the plane falls out of the sky.
-
What am I doing wrong?
-
How do I know how often a message needs to be resent?
-
Do I need to be in GUIDED or MANUAL mode for this to work?
Edit:
As it turns out, I misunderstood something. The documentation isn’t super detailed, so I ended up interpreting a lot into it that wasn’t there. I discovered this when I was studying some existing code: https://github.com/dronekit/dronekit-python/blob/master/examples/set_attitude_target/set_attitude_target.py#L87-L114
I noticed that they hard code their rates to zero and provide a quaternion, so I now compute the quaternion, set the roll, pitch, and yaw rates to 0.0, and type_mask to 0, and I’m able to make the plane fly in a circle by rolling it 10 degrees.
My plane is in GUIDED mode.
It’s a step closer to what I wanted to do, but some questions still remain unanswered:
- What am I doing wrong? I feel like there’s ample opportunity to mess something up or misunderstand something.
- How do I know how often a message needs to be resent?
- What are the yaw, pitch, and roll rates?