First steps: Dynamic simulation

From UWSim
Jump to: navigation, search

Kinematic simulations may be suitable for many cases, such as image processing algorithms, but when vehicle movement is involved dynamic simulation is much more interesting. What we understand by dynamic simulation is any kind of simulation where vehicles are moved using forces (mainly caused by thrusters), instead of velocities or positions. This is a much more realistic scenario where vehicles are harder to control. At this moment UWSim offers dynamic simulation capabilities through underwater vehicle dynamics package inside underwater simulation.

Overview

Underwater vehicle dynamics package simulates rigid body physics for AUV's. Unfortunately, this means our vehicles will move as a single body, mobile parts will not affect vehicle movements (We are working on it!). The package estimates the different forces that push the vehicle, for instance floating, damping, thrusters, ... to calculate the final acceleration and, as a consequence, velocity and position of the vehicle. The package publishes vehicle pose, so we can visualize it in the simulated world using UWSim.

Furthermore, external forces may be added using a topic to include any force that affects the vehicle besides navigation and thruster forces. We can use this force to add collision forces to the vehicle and create correct interaction with scene objects (Remember underwater vehicle dynamics package does not have any information about the scene). To do it, you just need to create a Force sensor in the UWSim vehicle and set it's ROS interface output as input in the underwater vehicle dynamics package.

How to

Creating dynamic simulations is extremely easy in UWSim. You just need to execute the following command:

roslaunch underwater_vehicle_dynamics UWSim_g500_dynamics.launch

This will launch the underwater simulator, underwater vehicle dynamics and a naive vehicle controller. Besides this it will link the ROS topics to use collision forces as external forces in the vehicle. Once everything has started we should be able to move the vehicles using the following keyboard configuration. ws for forward backward, ad for lateral movements, and arrow keys for up and down and rotation movements (Be sure to press the keys while focusing the console).

This example launches a girona500 vehicle configured through its yaml configuration file. In this file you can set the main configuration parameters of the vehicle, actuators and interfaces. The controller is a simple python code that publishes thruster effort depending on the pressed key. If you want to create your own controller you just need to comment this one from the launch file and create a node that publishes the thruster effort as it does the python example.