IEEE Very Small Size Soccer simulation project with ROS and Gazebo
Para a versΓ£o em PT-BR π§π· desse documento, veja aqui
- π· Screenshots
- π Intro
- π Worlds
- π£ ROS topics
- π Used models
- π§ Parameters
- π· Virtual camera
- π Folder structure
- β Dependencies
- π¨ Gazebo colors
- π Contributing
- β¨ Contributors
It is necessary to clone the project inside a catkin workspace. To create a workspace, refer to this link
To run the simulation with one controllable robot
roslaunch travesim simulation_robot.launch
To run the simulation with the entire team
roslaunch travesim simulation_team.launch
To run the simulation of a match
roslaunch travesim simulation_match.launch
TraveSim can handle simulating games with 3 or 5 robots per team. The number of robots per team will be inferred from the chosen simulation world. The worlds currently supported are as follows:
vss_field.world
- Base world for 3x3 matchesvss_field_camera.world
- World for 3x3 matches with camera and spotlightsvss_field_5.world
- Base world for 5x5 matches
So, for example, to run the simulation with a single team of 5 robots, run:
roslaunch travesim simulation_team.launch world_name:=vss_field_5.world
For more information about roslaunch parameters, see the π Roslaunch section.
The simulation can work using 2 input interfaces, differential drive control (default) or direct motor control. It is important to notice that is not possible to use both interfaces to control different robots at the same time.
By default, the simulation receives commands of type geometry_msgs/Twist, representing the desired velocity of the robot in two components: linear and angular.
# This expresses velocity in free space broken into its linear and angular parts.
Vector3 linear
Vector3 angular
The ROS topics follow the naming convention:
- /yellow_team/robot_[0..2|0..4]/diff_drive_controller/cmd_vel
- /blue_team/robot_[0..2|0..4]/diff_drive_controller/cmd_vel
The control of the robot is performed by the diff_driver_controller from the library ros_control. The controller represents the behavior of the embedded system of the robot and will send torque commands to the motors in order to follow the received set point.
The parameters of this controller are specified in the file ./config/motor_diff_drive.yml.
The simulation also accepts control directly over angular velocity commands (in rad/s) for both robot's motors (through the interface velocity_controller from ros_control). This interface mimics a controller interface more coupled to the robots characteristics than differential drive control.
The commands are read from topics of type std_msgs/Float64, representing each motor's speed in rad/s
- /yellow_team/robot_[0..2|0..4]/left_controller/command
- /yellow_team/robot_[0..2|0..4]/right_controller/command
- /blue_team/robot_[0..2|0..4]/left_controller/command
- /blue_team/robot_[0..2|0..4]/right_controller/command
In order to enable this control interface, one should send the parameter twist_interface
as false in roslaunch parameters
The parameters of this controller are specified in the file ./config/motor_direct_drive.yml.
By default, Gazebo publishes in the topic /gazebo/model_states of type gazebo_msgs/ModelStates, with an array of informations about each model in the simulation.
# broadcast all model states in world frame
string[] name # model names
geometry_msgs/Pose[] pose # desired pose in world frame
geometry_msgs/Twist[] twist # desired twist in world frame
For convenience, this package have a script (vision_proxy.py) that subscribes this topic and republishes the information at different topics of type gazebo_msgs/ModelState for each entity (3 yellow team robots, 3 blue team robots and 1 ball, 7 in total).
# Set Gazebo Model pose and twist
string model_name # model to set state (pose and twist)
geometry_msgs/Pose pose # desired pose in reference frame
geometry_msgs/Twist twist # desired twist in reference frame
string reference_frame # set pose/twist relative to the frame of this entity (Body/Model)
# leave empty or "world" or "map" defaults to world-frame
The republished topics are
- /vision/yellow_team/robot_[0..2|0..4] - Yellow team robots's topics
- /vision/blue_team/robot_[0..2|0..4] - Blue team robots's topics
- /vision/ball - Ball's topic
All units are SI, distances are measured in meters, angles in radians, linear velocity in m/s and angular velocity in rad/s.
The simulation is build upon a generic vss robot (more details here), inspired by VSS SDK model.
As support, models were created for the VSS field and ball, both build from Robocore's rules for IEEE VSS.
To create a model for your project, refer to:
- Phobos - Generate urdf files from Blender
- SW2URDF - Generate urdf files from SolidWorks
- fusion2urdf - Generate urdf files from Fusion 360
- ROS wiki - How build a urdf model from scratch
To use your custom model, change the value of the model
parameter when launching the simulation.
world_name
- Name of world file inside./worlds
folder, default "vss_field.world"model
- Path of simulated robot model, default "./urdf/vss_robot.xacro"controller_config_file
- Path of simulated robot controllers config file, default "./config/motor_diff_drive.yml" iftwist_interface
is true, "./config/motor_direct_drive.yml" otherwiseros_control_config_file
- Path ofgazebo_ros_control
config file, default "./config/ros_control_config.yml"debug
- Enable debug messages in terminal, default "false"gui
- Enable Gazebo's GUI window, default "true"paused
- Init simulation paused, default "true"use_sim_time
- Use simulated time as reference in messages, default "true"recording
- Enable Gazebo's state log, default "false"keyboard
- Enable joystick/keyboard control node, default "false"twist_interface
- Enable geometry_msgs/Twist interface if true, 2 std_msgs/Float64 control interface otherwise. Default "true". See the docs for more info.
To pass a parameter to the simulation, just write the parameter name and its new value with :=
For example, to change the parameter keyboard
to true
:
roslaunch travesim simulation_team.launch keyboard:=true
The simulation has a virtual camera that record images from the top of the field, in the same way as a real VSS match. To enable it, one should use the world file vss_field_camera.world
roslaunch travesim simulation_team.launch world_name:=vss_field_camera.world
The images are published in the topic /camera/image_raw
It is possible to watch the footage with the package image_view
rosrun image_view image_view image:=/camera/image_raw
-
bagfiles/ - Folder to store recorded bagfiles
-
docs/ - Documentation files
-
launch/ - Roslaunch files written in ROS XML syntax
-
meshes/ - .stl files for vss_generic_robot, created with SolidWorks SW2URDF extension
-
models/ - Custom Gazebo models used inside the simulation, as the field and the VSS ball
-
scripts/ - Python scripts used in the project
- keyboard_node.py - Pygame script to capture keyboard or joystick input to control the simulation
- vision_proxy.py - Script to split gazebo_msgs/ModelStates array in several gazebo_msgs/ModelState topics
-
urdf/ - Robot description files in .urdf and .xacro format. The .urdf files were generated with SolidWorks SW2URDF extension
-
worlds/ - World files in SDL format
The simulation is develop for ROS and Gazebo, it is recommend to install both with:
sudo apt install ros-noetic-desktop-full
The project depends on the package velocity_controllers and effort_controllers in the library ros_controllers and the python library pygame. It is possible to install both with apt-get
sudo apt install ros-noetic-velocity-controllers ros-noetic-effort-controllers python3-pygame
Or using rosdep
rosdep install travesim
One may want to run the project inside a python virtualenv, after all this is a good practice in the python development book
You can create a python environment with the command
python3 -m venv venv
Then you should run source
in the virtual environment
source ./venv/bin/activate
To install the dependencies, run the command
pip install -r requirements.txt
Some external libraries may be missing to build pygame
package. You can install then with
sudo apt-get install
subversion \
ffmpeg \
libsdl1.2-dev \
libsdl-image1.2-dev \
libsdl-mixer1.2-dev \
libsdl-ttf2.0-dev \
libavcodec-dev \
libavformat-dev \
libportmidi-dev \
libsmpeg-dev \
libswscale-dev \
For a list of default available color in Gazebo, refer to the config file in the oficial repo. We have also 2 OGRE scripts team blue and team yellow for custom colors definition (Gazebo ref and OGRE ref)
Any help in the development of robotics is welcome, we encourage you to contribute to the project! To learn how, see the contribution guidelines here.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!