You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In GUIDED mode, using angle control with the SET_ATTITUDE_TARGET messages, the drone keeps rotating on its yaw axis.
It will first quickly go to a yaw angle (presumably the one set in the command's quaternion), and then will keep turning at a more or less constant rotation speed.
During another flight we even had a crash right when we passed the vehicle from LOITER to GUIDED, using the included code example with the yaw_rate at 2 in the parameters of send_attitude_target: the drone leaned very hard (maybe 45°) on both its pitch and roll axes, quickly losing altitude.
The WP_YAW_BEHAVIOR was set to 0 (WP_YAW_BEHAVIOR_NONE) for all those tests.
I took a couple videos using the example code below to illustrate the problem, I will include them if requested. Same with the logs, will try to find them if requested 😄
Version
3.4.6
Platform
All
AntennaTracker
Copter
Plane
Rover
Airframe type
quad
Hardware type
Erle Brain 3
Code
importmathimporttimeimportdronekitcopter=dronekit.connect('udp:10.0.0.42:5762', wait_ready=True)
defsend_attitude_target(self, roll_angle=0.0, pitch_angle=0.0,
yaw_angle=0.0, yaw_rate=10, thrust=0.5):
msg=copter.message_factory.set_attitude_target_encode(
0,
0, # target system0, # target component0b00000000, # type mask: bit 1 is LSBto_quaternion(roll_angle, pitch_angle, yaw_angle), # q0, # body roll rate in radian0, # body pitch rate in radianyaw_rate, # body yaw rate in radianthrust) # thrustcopter.send_mavlink(msg)
defto_quaternion(self, roll=0.0, pitch=0.0, yaw=0.0):
"""Convert degrees to quaternions."""t0=math.cos(yaw*0.5)
t1=math.sin(yaw*0.5)
t2=math.cos(roll*0.5)
t3=math.sin(roll*0.5)
t4=math.cos(pitch*0.5)
t5=math.sin(pitch*0.5)
w=t0*t2*t4+t1*t3*t5x=t0*t3*t4-t1*t2*t5y=t0*t2*t5+t1*t3*t4z=t1*t2*t4-t0*t3*t5return [w, x, y, z]
whileTrue:
if(copterandcopter.mode==dronekit.VehicleMode("GUIDED")):
send_attitude_target(0, # roll0, # pitch0, # yaw_angle0, # yaw_rate0.5) # thrustprint("attitude command sent")
time.sleep(0.1)
With this sample code constantly running, we took off in LOITER mode and then passed to GUIDED during the flight.
The text was updated successfully, but these errors were encountered:
Nevermind, this is not a bug but just us misusing the SET_ATTITUDE_TARGET command.
We did not know back then that depending on the type mask you can control the yaw with EITHER a rate OR an absolute angle, and wrongly assumed that we could request a specific angle to be reached at a specified rate.
Issue details
In GUIDED mode, using angle control with the
SET_ATTITUDE_TARGET
messages, the drone keeps rotating on its yaw axis.It will first quickly go to a yaw angle (presumably the one set in the command's quaternion), and then will keep turning at a more or less constant rotation speed.
During another flight we even had a crash right when we passed the vehicle from LOITER to GUIDED, using the included code example with the
yaw_rate
at2
in the parameters ofsend_attitude_target
: the drone leaned very hard (maybe 45°) on both its pitch and roll axes, quickly losing altitude.The
WP_YAW_BEHAVIOR
was set to0
(WP_YAW_BEHAVIOR_NONE
) for all those tests.I took a couple videos using the example code below to illustrate the problem, I will include them if requested. Same with the logs, will try to find them if requested 😄
Version
3.4.6
Platform
Airframe type
quad
Hardware type
Erle Brain 3
Code
With this sample code constantly running, we took off in LOITER mode and then passed to GUIDED during the flight.
The text was updated successfully, but these errors were encountered: