Skip to main content

AirGenDrone

Inherits from: AerialDrone AirGen simulation multirotor drone implementation. This class provides an interface to control simulated multirotor drones in AirGen using the MultirotorClient from the pyairgen library.

Inherited methods

init

AirGenDrone.__init__(ip: str = '127.0.0.1', port: int = 41461, timeout_value: int = 3600, vehicle_name: str = '')
Initialize a simulated AirGen multirotor client.
Arguments
ip (str)
str
IP address of the AirGen server. (default: “127.0.0.1”)
port (int)
int
Port number for the AirGen server. (default: 41461)
timeout_value (int)
int
Timeout value for the connection in seconds. (default: 3600)
vehicle_name (str)
str
Name of the vehicle in the simulation. (default: "")

takeoff

AirGenDrone.takeoff() -> None
Command the drone to take off and hover.
Returns
returns
None

land

AirGenDrone.land() -> None
Command the drone to land at its current position.
Returns
returns
None

getState

AirGenDrone.getState() -> dict
Get the current state of the drone.
Returns
dict
dict
Current state including position, orientation, and velocity.

getImage

AirGenDrone.getImage(camera_name: str = 'front_center', image_type: str = 'rgb') -> Image
Get an image from the specified camera.
Arguments
camera_name (str)
str
Name of the camera in the AirGen scene. (default: “front_center”)
image_type (str)
str
Image type, one of (“rgb”|“depth”). (default: “rgb”)
Returns
Image
Image
Captured image wrapped in the project’s Image type.

getPosition

AirGenDrone.getPosition() -> Optional[Position]
Get the position of the drone in the world frame.
Returns
Optional[Position]
Optional[Position]
Current position of the drone in world coordinates.

getOrientation

AirGenDrone.getOrientation() -> Optional[Orientation]
Get the orientation of the drone in the world frame.
Returns
Optional[Orientation]
Optional[Orientation]
Current orientation as a quaternion (x, y, z, w).

moveToPosition

AirGenDrone.moveToPosition(position: Position, velocity: float, timeout_sec: float = 60) -> None
Move the drone to a specified position in the world frame.
Arguments
position (Position)
Position
required
Target position in meters (x, y, z).
velocity (float)
float
required
Velocity in m/s.
timeout_sec (float)
float
Timeout for the operation in seconds. (default: 60)
Returns
returns
None

moveByVelocity

AirGenDrone.moveByVelocity(linear_velocity: Velocity, angular_velocity: Velocity, duration: float = 1.0, frame: str = 'body') -> None
Move the drone with a velocity command in m/s. The command applies for the given duration. For the body frame, velocity is relative to the drone’s orientation. For the world frame, velocity is in the global coordinate system.
Arguments
linear_velocity (Velocity)
Velocity
required
Linear velocity in m/s (x, y, z).
angular_velocity (Velocity)
Velocity
required
Angular velocity in rad/s (z_vel/yaw rate is used).
duration (float)
float
Duration in seconds for the command to apply. (default: 1.0)
frame (str)
str
Reference frame for velocity (“body” or “world”). (default: “body”)
Returns
returns
None

cleanup

AirGenDrone.cleanup() -> None
Clean up resources and disarm the drone.
Returns
returns
None

stop

AirGenDrone.stop() -> None
Stop the drone by commanding zero velocity.
Returns
returns
None