Used for sending high level setpoints to the Crazyflie
Classes
HighLevelCommander
HighLevelCommander(crazyflie=None)
Used for sending high level setpoints to the Crazyflie
Initialize the object.
Class variables
ALL_GROUPS
COMMAND_DEFINE_TRAJECTORY
COMMAND_GO_TO
COMMAND_LAND_2
COMMAND_SET_GROUP_MASK
COMMAND_START_TRAJECTORY
COMMAND_STOP
COMMAND_TAKEOFF_2
TRAJECTORY_LOCATION_MEM
TRAJECTORY_TYPE_POLY4D
TRAJECTORY_TYPE_POLY4D_COMPRESSED
Methods
def define_trajectory(self, trajectory_id, offset, n_pieces, type=0)
Define a trajectory that has previously been uploaded to memory.
Parameters
Name | Description |
---|---|
trajectory_id | The id of the trajectory |
offset | Offset in uploaded memory |
n_pieces | Nr of pieces in the trajectory |
type | The type of trajectory data; TRAJECTORY_TYPE_POLY4D or TRAJECTORY_TYPE_POLY4D_COMPRESSED:return: |
def go_to(self, x, y, z, yaw, duration_s, relative=False, group_mask=0)
Go to an absolute or relative position
Parameters
Name | Description |
---|---|
x | X (m) |
y | Y (m) |
z | Z (m) |
yaw | Yaw (radians) |
duration_s | Time it should take to reach the position (s) |
relative | True if x, y, z is relative to the current position |
group_mask | Mask for which CFs this should apply to |
def land(self, absolute_height_m, duration_s, group_mask=0, yaw=0.0)
vertical land from current x-y position to given height
Parameters
Name | Description |
---|---|
absolute_height_m | Absolute (m) |
duration_s | Time it should take until target height is reached (s) |
group_mask | Mask for which CFs this should apply to |
yaw | Yaw (rad). Use current yaw if set to None. |
def set_group_mask(self, group_mask=0)
Set the group mask that the Crazyflie belongs to
Parameters
Name | Description |
---|---|
group_mask | Mask for which groups this CF belongs to |
def start_trajectory(self, trajectory_id, time_scale=1.0, relative=False, reversed=False, group_mask=0)
starts executing a specified trajectory
Parameters
Name | Description |
---|---|
trajectory_id | Id of the trajectory (previously defined by define_trajectory) |
time_scale | Time factor; 1.0 = original speed; >1.0: slower; <1.0: faster |
relative | Set to True, if trajectory should be shifted to current setpoint |
reversed | Set to True, if trajectory should be executed in reverse |
group_mask | Mask for which CFs this should apply to:return: |
def stop(self, group_mask=0)
stops the current trajectory (turns off the motors)
Parameters
Name | Description |
---|---|
group_mask | Mask for which CFs this should apply to:return: |
def takeoff(self, absolute_height_m, duration_s, group_mask=0, yaw=0.0)
vertical takeoff from current x-y position to given height
Parameters
Name | Description |
---|---|
absolute_height_m | Absolute (m) |
duration_s | Time it should take until target height is reached (s) |
group_mask | Mask for which CFs this should apply to |
yaw | Yaw (rad). Use current yaw if set to None. |