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

Firmware/software/electronics/mechanics
Post Reply
Horace20
Beginner
Posts: 2
Joined: Sun Apr 25, 2021 7:12 am

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

Post 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.
wydmynd
Member
Posts: 87
Joined: Thu Dec 06, 2018 9:25 am

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

Post 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
Post Reply