Notebook for this example can be found: Here
Getting Started
First, let’s import the necessary libraries and initialize a connection to the AirGen simulation environment:VehicleClient
class provides an interface to the underlying simulation, allowing us to modify the environment even without directly controlling a specific vehicle.
Spawning Objects in the Simulation
Let’s start by placing a cube in the simulation world. We’ll position it 20 meters in front of the current vehicle:
Manipulating Object Position
Once an object is spawned, we can modify its position at any time:
simGetObjectPose
method retrieves the current position and orientation of any object in the simulation, while simSetObjectPose
allows us to update it.
Scaling Objects
We can also modify the size of objects in the simulation:- Creating objects of custom sizes
- Implementing growth or shrinking effects
- Adjusting obstacle difficulty in robotic navigation scenarios

Removing Objects from the Simulation
When an object is no longer needed, we can remove it from the simulation:simDestroyObject
method completely removes an object from the simulation environment. This can be used to:
- Clean up temporary objects
- Remove obstacles after they’ve served their purpose

Controlling Environmental Conditions
Beyond manipulating individual objects, AirGen allows control over environmental conditions. Let’s change the time of day:simSetTimeOfDay
method takes two parameters:
is_enabled
: Whether to enable custom time of day (True) or use the system time (False)datetime_str
: A string representing the desired date and time in “YYYY-MM-DD HH:MM:SS” format
- Test robotic systems under different lighting conditions
- Simulate day/night transitions
- Create specific time-based scenarios
