flight
– Flight Controller Interface¶
Interface to CodeAIR’s Flight Control Computer
See also Crazyflie Client Library
fly =
MotionCommander
fly_high =
HighLevelCommander
cf_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)[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.
-
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