flight – Flight Controller Interface
Interface to CodeAIR’s Flight Control Computer
See also Crazyflie Client Library
fly =
MotionCommanderfly_high =
HighLevelCommandercf_commander =
Commander
High-level flying and sensors:
Basic Hover:
>>> fly.take_off() # Ascend to default altitude at default speed
>>> fly.steady(4) # Hold for 4 seconds
>>> fly.land() # Descend at default speed
Low-level control and flight parameter access:
Watch Flight Controller console output on bootup:
>>> crtp.console_stdout(True)
>>> reset_controller()
Get sensor data:
>>> get_data(RANGERS)
Set and Get parameters (e.g., m1 speed parameter):
>>> set_param('motorPowerSet.m1', 5000)
>>> get_param('motorPowerSet.m1')
- codeair.flight.ACCEL = ('acc.x', 'acc.y', 'acc.z')
- codeair.flight.BAROMETER = ('baro.asl', 'baro.temp', 'baro.pressure')
- codeair.flight.FLOW = ('motion.deltaX', 'motion.deltaY')
- codeair.flight.GYRO = ('gyro.xRaw', 'gyro.yRaw', 'gyro.zRaw')
- codeair.flight.MAG = ('mag.x', 'mag.y', 'mag.z')
- codeair.flight.RANGERS = ('range.front', 'range.up', 'range.zrange')
- codeair.flight.STATE_EST_POS = ('stateEstimate.x', 'stateEstimate.y', 'stateEstimate.z', 'stateEstimate.yaw')
- codeair.flight.STATE_EST_VEL = ('stateEstimate.vx', 'stateEstimate.vy', 'stateEstimate.vz')
- codeair.flight.get_data(log_items, rate=0.1, wait=True)[source]
Get a sensor value tuple from the Flight Controller data log. This will register for periodic logging of the given log items. Pass ‘None’ to stop data logging packets from Flight Controller.
- Parameters:
log_items (tuple) – Tuple of str names Log Values. Provided reference tuples:
GYRO,RANGERS,FLOW,ACCEL,MAG,BAROMETERrate (float) – Periodic rate in seconds for flight controller to report data.
wait (bool) – Wait for data to be available. Default is True. Note: if log_items has changed, this function will still block to register the new log items.
- Returns:
A tuple of the requested log items. None: If no data is available and wait is False.
- Return type:
- codeair.flight.get_param(name)[source]
Get a single parameter value from Flight Controller. Note: these differ from log data.
- Parameters:
name (str) – See Param Names
- codeair.flight.is_version_current()[source]
Return True if flight controller is running current default firmware version