Skip to content

Class DroneNavAPI ​

Handles drone movements

Methods: ​

__init__ ​

python
def __init__(
	rc_api,
	debug=False
)

Initialize self. See help(type(self)) for accurate signature.

Params: ​
  • rc_api: Any
  • debug: Any = False



arm ​

python
def arm()

Arms the drone and sets it to the READY_TO_FLY mode.




disarm ​

python
def disarm()

Disarms the drone and disables offboard mode.




go_backward ​

python
def go_backward(
	meter: float,
	wait_until_done: bool = True
)

Moves the drone backward by a specified distance.

Params: ​
  • meter: float - The distance to move backward in meters.
  • wait_until_done: bool = True - Whether to wait until the setpoint is reached.



go_forward ​

python
def go_forward(
	meter: float,
	wait_until_done: bool = True
)

Moves the drone forward by a specified distance.

Params: ​
  • meter: float - The distance to move forward in meters.
  • wait_until_done: bool = True - Whether to wait until the setpoint is reached.



go_left ​

python
def go_left(
	meter: float,
	wait_until_done: bool = True
)

Moves the drone to the left by a specified distance.

Params: ​
  • meter: float - The distance to move left in meters.
  • wait_until_done: bool = True - Whether to wait until the setpoint is reached.



go_right ​

python
def go_right(
	meter: float,
	wait_until_done: bool = True
)

Moves the drone to the right by a specified distance.

Params: ​
  • meter: float - The distance to move right in meters.
  • wait_until_done: bool = True - Whether to wait until the setpoint is reached.



kill ​

python
def kill()

Sends the drone into FAILSAFE mode.




land ​

python
def land(
	wait_until_done: bool = True
)

Commands the drone to land by setting the altitude to 0.

Params: ​
  • wait_until_done: bool = True - Whether to wait until the setpoint is reached.



set_altitude ​

python
def set_altitude(
	altitude_meter: float,
	wait_until_done: bool = True
)

Sets the drone's altitude to a specific value.

Params: ​
  • altitude_meter: float - The target altitude in meters.
  • wait_until_done: bool = True - Whether to wait until the setpoint is reached.



set_mode ​

python
def set_mode()

Sets the drone to the DISABLE mode.




set_position_2d ​

python
def set_position_2d(
	x_m: float,
	y_m: float,
	wait_until_done: bool = True
)

Sets the drone's position to specific coordinates.

Params: ​
  • x_m: float - The target X coordinate in meters.
  • y_m: float - The target Y coordinate in meters.
  • wait_until_done: bool = True - Whether to wait until the setpoint is reached.



set_position_3d ​

python
def set_position_3d(
	x_m: float,
	y_m: float,
	z_m: float,
	wait_until_done: bool = True
)

Sets the drone's position to specific coordinates.

Params: ​
  • x_m: float - The target X coordinate in meters.
  • y_m: float - The target Y coordinate in meters.
  • z_m: float - The target Z coordinate in meters.
  • wait_until_done: bool = True - Whether to wait until the setpoint is reached.



set_yaw ​

python
def set_yaw(
	yaw_in_rad: float,
	wait_until_done: bool = True
)

Sets the drone's yaw to a specific angle.

Params: ​
  • yaw_in_rad: float - The target yaw angle in radians.
  • wait_until_done: bool = True - Whether to wait until the setpoint is reached.



takeoff ​

python
def takeoff(
	altitude_meter: float,
	tolerance: float = 0.1,
	wait_until_done: bool = True
)

Commands the drone to take off to a specified altitude.

Params: ​
  • altitude_meter: float - The target altitude in meters.
  • tolerance: float = 0.1 - The altitude tolerance in meters.
  • wait_until_done: bool = True - Whether to wait until the setpoint is reached.



turn_cw ​

python
def turn_cw(
	rotation_in_rad: float,
	wait_until_done: bool = True
)

Rotates the drone clockwise by a specified angle.

Params: ​
  • rotation_in_rad: float - The angle to rotate in radians.
  • wait_until_done: bool = True - Whether to wait until the setpoint is reached.



update_offboard_state ​

python
def update_offboard_state(
	**kwargs
)

Updates the offboard state and sends the corresponding command.

Params: ​
  • kwargs: Any - Key-value pairs to update the offboard state.



wait_for_latest_setpoint ​

python
def wait_for_latest_setpoint(
	pos_tolerance: float = 0.15,
	yaw_tolerance: float = 0.2617993877991494,
	ignore_axis: robeex_ai_drone_api.nav_api.IgnoreAxis = <IgnoreAxis.NONE: 0>
)

Waits for the drone to reach the setpoint within the specified tolerances.

Params: ​
  • pos_tolerance: float = 0.15 - The position tolerance in meters.
  • yaw_tolerance: float = 0.2617993877991494 - The yaw tolerance in radians.
  • ignore_axis: IgnoreAxis = 0 - Axes to ignore during setpoint checks (bit mask).