FlightGoggles : Car dynamics simulation

Before using the Python API, execute FlightGoggles binary as described in Using the FlightGoggles Renderer

Users can command the speed and the steering angle to simulate car dynamics.

 - proceed(vehicle_id, speed_command, steering_angle_command, duration)

The vehicle’s states are composed of timestamp, position, velocity, heading, speed, steering_angle. Same as the UAV simulation, the vehicle’s state can be updated by set_state_vehicle() function, and obtained by get_stat_vehicle() function.

 - set_state_vehicle(vehicle_id, **kwargs)
 - get_state(vehicle_id)

The camera’s position and attitude can be manually changed by set_state_camera and the latest camera image can be obtained by get_camera_image.

 - set_state_camera(camera_id, position, attitude)
 - get_camera_image(camera_id)

This is the example code to run car simulation:

import numpy as np
from IPython.display import HTML, display
from flightgoggles.env import flightgoggles_env

if __name__ == "__main__":
    env = flightgoggles_env()
    for j in range(400):
        env.proceed("car1", 1.0, 1.0, 0.01)

    ani_set = env.plot_state_video(flag_save=False, filename="car")
    display(HTML(ani_set["cam2"].to_html5_video()))
    env.close()

Attachments:

python_api_car.mp4 (video/mp4)