Page 1 of 1

creating a new autopilot mode and switching between autopilot mode and manual control

Posted: Sat May 01, 2021 2:07 am
by Horace20
Hi Sir/ Madam,

I am a beginner in programming crazyflie. I have a few questions as follows:
1. May I know where and how could I create a new autopilot mode and write my own algorithm/code on it?
2. since the algorithm needs to be tested, I also would like to know whether I could switch between the new mode and existing manual control (using a joypad) for safety reasons.
3. can I use the crazyflie PC client to display some real-time sensor data/ plots, while executing the autopilot mode?

It would be greatly appreciated if you could provide an example code or show me some existing codes that I could refer.

Thank you very much.

Re: creating a new autopilot mode and switching between autopilot mode and manual control

Posted: Sun May 02, 2021 10:08 am
by wydmynd
I am not an expert, but regarding section 1 , this question has been answered few times already, search for "push demo" in the search box

regarding section 2, I can say in the function SetHoverSetpoint there is a priority parameter.
I think the remote control commands are sent in priority 3 out of 6
if your autopilot sends commands with a lower/higher priority (2 or 4 for example), this will allow the commander module to prioritize the setpoint correctly.
I ended up using a parameter to update the autopilot priority when I want to take over, so it can also return to back autopilot smoothly