FlightGoggles provides a Python API for model-based experiments or machine-learning applications. The Python API communicates with FlightGoggles Renderer Binary to update camera states and request rendered exteroceptive sensors (images, depth maps, segmentation) and collision data.
Before using the Python API, execute FlightGoggles binary as described in Using the FlightGoggles Renderer
flightgoggles_env
gets the paths of configuration files. The default configuration files are located under the config folder. Vehicle agents or camera models can be added by modifying FlightGogglesClient.yaml, and parameters of vehicle dynamics models can be changed in multicopterDynamicsSim.yaml and carDynamicsSim.yaml.
- flightgoggles_env( cfg_dir="../config", cfg_fgclient="FlightGogglesClient.yaml", cfg_uav="multicopterDynamicsSim.yaml", cfg_car="carDynamicsSim.yaml")
This is the example code for FlightGoggles environment:
import numpy as np from flightgoggles.env import flightgoggles_env env = flightgoggles_env() for i in range(10): env.proceed_motor_speed("uav1", np.ones(4)*1100.0, 0.01) env.plot_state("uav1") env.close()