Apart from cameras, AirGen currently supports the following sensors. Each sensor is associated with a integer enum specifying its sensor type.
All sensor APIs accept an optional robot_name. The snippets below retrieve the first entry from listVehicles() for clarity; supply your own when working with multiple robots.
Barometer
AirGen has a barometer as a default sensor for robots. The barometer primarily reports altitude and atmospheric pressure.
client = airgen.MultirotorClient()
robot_name = client.listVehicles()[0]
client.getBarometerData(robot_name=robot_name)
<BarometerData> { 'altitude': 121.27217102050781,
'pressure': 99876.0078125,
'qnh': 1013.25,
'time_stamp': 1721339963514664704}
GPS
AirGen contains support for a GPS sensor that returns the current geo location of the robot. The GPS sensor is enabled by default, but can be disabled through the Sensors tab in the custom session configuration panel
The GPS data is available through the getGpsData() method.
client = airgen.MultirotorClient()
robot_name = client.listVehicles()[0]
gps_data = client.getGpsData(robot_name=robot_name)
latitude = gps_data.gnss.geopoint.latitude
longitude = gps_data.gnss.geopoint.longitude
altitude = gps_data.gnss.geopoint.altitude
IMU
AirGen contains support for Inertial Measurement Units (IMUs). Data captured from the IMU can be used to calculate the orientation of the robot. This is done using a combination of the accelerometer, gyroscope and magnetometer data.
The IMU data can be accessed using the getImuData method. This method returns an ImuData object which contains raw angular velocities and linear accelerations, as well as the orientation of the vehicle.
client = airgen.MultirotorClient()
robot_name = client.listVehicles()[0]
imu_data = client.getImuData(robot_name=robot_name)
<ImuData>
{ 'angular_velocity': <Vector3r> { 'x_val': 0.0007983481627888978,
'y_val': 0.000933181494474411,
'z_val': -0.0007887388928793371},
'linear_acceleration': <Vector3r> { 'x_val': -0.11297493427991867,
'y_val': 0.11055465042591095,
'z_val': -9.841029167175293},
'orientation': <Quaternionr> { 'w_val': -4.371138828673793e-08,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 1.0},
'time_stamp': 1721340023239938816}
Magnetometer
AirGen has a magnetometer as a default sensor for robots. The magnetometer primarily reports magnetic field measurements on all three (X, Y, Z) axes.
client = airgen.MultirotorClient()
robot_name = client.listVehicles()[0]
client.getMagnetometerData(robot_name=robot_name)
<MagnetometerData>
{ 'magnetic_field_body': <Vector3r> { 'x_val': -0.25192224979400635,
'y_val': -0.027216637507081032,
'z_val': 0.37283220887184143},
'magnetic_field_covariance': [ ],
'time_stamp': 1721340120640016640}
LiDAR
AirGen contains support for LiDAR sensors, which capture 3D point clouds.
LiDAR Configuration
The configuration for the LiDAR sensor can be set up in the Sensors section of the configuration tab (accessible through the custom session panel). The following parameters are available:
| Parameter | Description |
| NumberOfChannels | Number of lasers arranged vertically |
| X, Y, Z | Position of the LiDAR relative to the robot |
| Roll, Pitch, Yaw | Orientation of the LiDAR relative to the robot |
| VerticalFOVUpper | Topmost orientation in degrees |
| VerticalFOVLower | Bottommost orientation in degrees |
| HorizontalFOVStart | Leftmost orientation in degrees |
| HorizontalFOVEnd | Rightmost orientation in degrees |
Accessing LiDAR Data
Assuming a LiDAR has been set up for a robot, the point cloud data can be accessed as follows, and optionally visualized through Rerun.
client = airgen.MultirotorClient()
robot_name = client.listVehicles()[0]
# Get LiDAR data
lidar_data = client.getLidarData(robot_name=robot_name)
# Extract point cloud
points = numpy.array(data.point_cloud, dtype=numpy.dtype('f4'))
points = numpy.reshape(points, (int(points.shape[0]/3), 3))
# Visualize point cloud
import rerun as rr
rr.log('lidar/points', rr.Points3D(points))
The structure of the output of client.getLidarData() can be seen at airgen.types.LidarData().
Distance Sensor
This is a simple distance sensor that emulates an ultrasonic sensor to measure the distance to an object.
Distance Sensor Configuration
The configuration for the distance sensor can be set up in the Sensors section of the configuration tab (accessible through the custom session panel). By default, the distance sensor points to the front of the robot. The following parameters are available:
| Parameter | Description |
| MinDistance | Minimum distance the sensor can capture |
| MaxDistance | Maximum distance the sensor can capture |
| X, Y, Z | Position of the sensor relative to the robot |
| Roll, Pitch, Yaw | Orientation of the sensor relative to the robot |
Accessing Distance Data
The distance sensor can be accessed through the getDistanceData method.
client = airgen.MultirotorClient()
robot_name = client.listVehicles()[0]
distance = client.getDistanceData(robot_name=robot_name)