Flight Modes
Jump to navigation
Jump to search
Flight modes are a framework we created to allow changes to be made to the Flight behavior of the Crazyflies during a test. They have been implemented as an enum structure so that only one flight mode can be active at a time. Each Crazyflie has its own independent flight modes, so we can customize the flight patterns of each Crazyflie in the swarm separately, or as a group.
The enum is shown below (code in CCrazyflie.h):
enum FlightMode{ LANDING_MODE = 0, TAKEOFF_MODE = 1, HOVER_MODE = 2, MIRROR_MODE = 3, HAND_MODE = 4, GROUNDED_MODE = 5, STEP_MODE = 6, KILL_MODE = 7 };
Current Flight Modes
(List as of 7/26/16)
Simple Flight Modes
- Landing Mode (0):
- Changes z-setpoint to 0 and when Crazyflie is close enough to the ground automatically switch to Grounded Mode
- TakeOff Mode (1):
- Enable PID controller for autonomous flight, hold position at default coordinates
- Grounded Mode (5):
- Crazyflies Setpoints Forced to 0, NO CONTROLLER CALCULATION DONE (used for sitting on the ground waiting for command)
- Note: Also resets Controller Error to prevent integrator wind-up
- Landing Mode (0):
Formation Flight Modes
- Mirror Mode (3):
- Swarm Forms a Triangle around Crazyflie 1
- Crazyflie 1 Moves in a Step Pattern (diagonally back and forth)
- Crazyflies 2, 3, and 4 follow Crazyflie 1 while maintaining the Triangle Formation
- Hand Mode (4):
- Crazyflies wait for Hand Gesture Commands
- Mirror Mode (3):
Unused Flight Modes
- Hover Mode (2):
- Not used yet (Could be used to reset the Crazyflie setpoints back to default)
- Step Mode (6):
- Similar to Crazyflie1's behavior when in Mirror Mode, but for all Crazyflies (used to verify Model Parameters).
- Kill Mode (7):
- Discontinued version of Grounded Mode (forces all setpoints to 0 but would continue calculating Controller)
- Hover Mode (2):
Landing Mode
Landing Mode is more complex than some of the other modes in that when a certain condition is reached, it will automatically switch to a different Flight Mode. A flow chart of the process is shown here:
And the code used to implement this is shown below (code in vrpn.cpp):
void nearGround() //During Landing Mode checks how close to ground quad is for shutdown { if((cflieCopter1->m_enumFlightMode == LANDING_MODE) && (zPosition1 < 0.05)) { cflieCopter1->m_enumFlightMode = GROUNDED_MODE; } if(cflieCopter2){ //Only sends command if Crazyflie 2 exists for this test (CLIENT WILL CRASH IF COMMANDING NON-EXISTENT CRAZYFLIE) if((cflieCopter2->m_enumFlightMode == LANDING_MODE) && (zPosition2 < 0.05)) { cflieCopter2->m_enumFlightMode = GROUNDED_MODE; } } if(cflieCopter3){ //Only sends command if Crazyflie 3 exists for this test if((cflieCopter3->m_enumFlightMode == LANDING_MODE) && (zPosition3 < 0.05)) { cflieCopter3->m_enumFlightMode = GROUNDED_MODE; } } if(cflieCopter4){ //Only sends command if Crazyflie 4 exists for this test if((cflieCopter4->m_enumFlightMode == LANDING_MODE) && (zPosition4 < 0.05)) { cflieCopter4->m_enumFlightMode = GROUNDED_MODE; } } }
- This function is scanned at each iteration of the mainloop.