I am trying to control the trajectory of drone to track a reference unit square with rotation. The pose of the drone is coming from an external motion tracking sensor at 100 Hz. So
PCMD is the right method. However, there are few implementation issues that I am missing. I did go through the forums and found solutions to similar problems, but some of these problems still exist. I was wondering if someone can kindly clarify these for me:
- I am trying to move from point 1 to point 2. I have a thread that runs the PCMD control loop
drone(PCMD(1, UR, UP, UYr, UTh , 1)).wait()
Where the U’s are calculated based on the pose error. But when I run the code, the drone runs off and crashes into a wall. Even if I issue a land/ kill command in between, the drone is still executing PCMD commands. It looks like there is a running buffer of commands that the drone is trying to execute. Is this the correct usage of the command?
- Waiting for a drone hover expectation, i.e.,
drone(PCMD(1, UR, UP, UYr, UTh , 1)
>> FlyingStateChanged(state="hovering", _timeout=5)).wait()
works, but the motion is now very jagged, So I think this is not the right usage.
- How do we set the maximum rotation speed for ANAFI. I wrote a code that looks like:
maxYawRate = drone(setAutonomousFlightMaxRotationSpeed(22)).wait()
if maxYawRate .success():
print(“max Yaw rate set to 22 deg/sec”)
elif maxYawRate .timedout():
print(“Yaw action timed out”)
print(“Yaw rate action action is still in progress”)
This always ends in
Yaw action timed out, so clearly something is wrong here.
Any sample codes/ inputs on these issues will be really helpful. Thank you for your time,