-
Notifications
You must be signed in to change notification settings - Fork 31
Software Tutorial 05: Config Files and the Simulator
The Simulator
The simulator is what we use to test our AI routines without actually running a dive. It has a full 3D environment, and can simulate almost all of the robot's systems (including vision). It is imperative that you test your code to the fullest in the simulator before testing it in the water.
To boot up the simulator, run these commands:
. scripts/setenv
cd tools/simulator/src
python main.py --gui
You should see 2 windows pop up. One will show a 3D view of Tortuga in a simulated pool, and the other will have several tabs containing information from the robot, as well as a python console. You can use the numpad keys (if you have them) to rotate the view in the 3D window, to get a better look at the robot. There are also 2 other viewports in the 3D window, that show what the robot sees from its forward and downward facing cameras.
In the other window, called the OCI, you can see the position/depth of the robot, all the events being fired, and all the measurements from the sensors. You can also run scripts from the python console. Try running the Gate script. In the python console, enter:
start(course.Gate)
The robot should dive a little bit, then start moving forward. This task is simply designed to travel through a target, or "gate".
Config Files
We use config files extensively for the robot. They declare everything from the vision settings, to the order of the AI tasks, to the specific constants for each of the individual states. Our config files are usually organized with one main config file, which uses several other config files for the individual subsystems. The main ones we'll be using are the main config file, the AI config file, and the states config file.
Let's take a look at some of the config files for the simulator. Do this:
cd tools/simulator/data/config
emacs default.yml (Or whatever text editor you use)
If you scroll through the file, you'll find it references several other config files. Two of these files are "default_ai.yml" and "default_state.yml". Both of these can be found in the tools/simulator/data/config/ai folder. The AI file contains a list of the tasks the robot will perform, and the state file contains a number of declarations for constants in AI states.