Basic Drone Control

Navigate and control the aerial robots in AirGen's environment using a comprehensive set of commands. This section provides insights into position, velocity, path, and angle-based maneuvers, facilitating drone control of varying degrees of fidelity.

Takeoff and landing

  • takeoffAsync: Takeoff from the ground.

    airgen_drone_0.client.takeoffAsync().join()
    
  • landAsync: Land (descend to the ground).

    airgen_drone_0.client.landAsync().join()
    

Position Control

Command precise drone movements to specific coordinates in the simulation environment.

  • moveToPositionAsync: Directs the drone to a specific position at a defined velocity.

    airgen_drone_0.client.moveToPositionAsync(x, y, z, velocity)
    
  • hoverAsync: Commands the drone to hover at its current position.

    airgen_drone_0.client.hoverAsync()
    

Velocity Control

Dictate the drone's speed of travel in any direction.

  • moveByVelocityAsync: Moves the drone at the specified velocity in the 3D world frame for a given duration.

    airgen_drone_0.client.moveByVelocityAsync(vx, vy, vz, duration)
    
  • moveByVelocityBodyFrameAsync: Moves the drone at the specified velocity in the body frame for a given duration.

    airgen_drone_0.client.moveByVelocityBodyFrameAsync(vx, vy, vz, duration)
    

Path Control

Enable pre-defined routes and waypoints for streamlined drone navigation.

  • moveOnPathAsync: Directs the drone along a pre-defined set of waypoints at a specified velocity.

    airgen_drone_0.client.moveOnPathAsync(waypoints, velocity)
    

Angle Control

Fine-tune the drone's orientation with detailed adjustments. The angles are given in degrees and rates in degrees/second.

  • rotateToYawAsync: Adjusts the drone's yaw orientation.

    airgen_drone_0.client.rotateToYawAsync(yaw)
    
  • rotateByYawRateAsync: Rotates the drone at a specified yaw rate for a given duration.

    airgen_drone_0.client.rotateByYawRateAsync(yaw_rate, duration)
    
  • moveByRollPitchYawThrottleAsync: Commands the drone based on roll, pitch, yaw, and throttle inputs.

    airgen_drone_0.client.moveByRollPitchYawThrottleAsync(roll, pitch, yaw, throttle, duration)
    

Trajectory Generation

AirGen also contains a minimum snap trajectory generation for creating smooth trajectories to navigate the drone through. The module uses a minimum snap trajectory generation algorithm, which minimizes the fourth derivative of the position (snap) to ensure smoothness. This results in a trajectory that is not only smooth but also dynamically feasible, making it ideal for high-speed navigation and complex maneuvers.

To use the Minimum Snap Trajectory Fitting module, you need to provide a set of waypoints. These waypoints represent the coarse path that the drone should follow. The module will then generate a smooth trajectory that passes through these waypoints.

Here is a basic example of how to use the module:

from airgen.utils.trajectory import fit_min_snap_trajectory

# Define the waypoints
waypoints = [airgen.Vector3r(0, 0, 5), airgen.Vector3r(10, 10, 5), airgen.Vector3r(20, 20, 5)]

# Generate the smooth trajectory
smooth_path = fit_min_snap_trajectory(waypoints)

# Optionally, fly the drone through this smooth path
client.moveOnPathAsync(smooth_path)

Tips

  • Always command the drone to hover or stabilize post-maneuver for safety.

  • The simplest ways to control a drone would be position or velocity control.

  • For complex operations, consider blending position, velocity, and angle control commands.

  • Handle exceptions for smoother code execution and to mitigate potential errors.