-
Notifications
You must be signed in to change notification settings - Fork 1
Design Document
This page will contain all design decisions that went into the creation of our robot soccer system
- Ubuntu 12.04+: This operating system was chosen given the simple install interface (if anything goes wrong, it's easy to completely reinstall the system) and availability of programming tools.
- ROS Hydro Full: Chosen as the robot framework that will provide communication, simulation, logging and other features.
- OpenCV 2.4.8: Default the computer vision library due to its performance.
- Gazebo 1.9.3: Default simulator for validating strategy code.
- Libfreenect: Kinect camera and depth sensor driver. Although OpenNI provides more functionality, since Apple bought its developer, PrimeSense, the software should go down by April 2014. Therefore, libfreenect was chosen thinking in the future development.
- vision_opencv: Integration with OpenCV
- gazebo_ros_pkgs: Integration with Gazebo
- freenect_stack: Integration with Libfreenect
The project is composed by several modules, each containing one ROS node that executes one specific task. The nodes communicate to each other by publishing ROS topics and subscribing to them.
If a node or module is performing several tasks, the developers are allowed to break it into two or more pieces as long as it does not require to restructure other nodes.
- camera: Connects to the camera drivers and publishes an image of the current view of the game.
- dummy_camera: Sends images for testing purposes.
- vision: Processes images and extract information about the current state of the game.
- strategy: Generates actions based on the state of the game.
- control: Sends commands to the robots using the communication drivers.
- simulation: Uses Gazebo to simulate a game for strategy validation. It communicates directly with the strategy node.
Each module should have one subdirectory in the src/unball directory, containing the node and all necessary sources and header files. For instance, the vision module is in src/unball/vision and may have the files vision_node.cpp, vision.cpp, and vision.hpp.
Each module should have a clear and well defined structure consisting of:
-
A node with an infinite loop:
Each node should be a source file with
{module name}_nodein its name and.cppextension, for example:strategy_node.cpp. This file must implement an infinite loop where it will call therun()method of the main class, and publish and receive messages, if any. Example for the infinite loop:
while (ros::ok())
{
strategy.run();
publishRobotsVelocities(publisher);
ros::spinOnce();
loop_rate.sleep();
}
-
Main class:
The main class should have a
run()method, preferably with no arguments, to be called by the node file. This method should run the whole algorithm of the module, which can be divided in other methods and classes, if necessary.
While in online operation, i.e., when working with the robots, the message flow is camera -> vision -> strategy -> control.
In offline mode, messages flow in the pipe strategy <-> simulation.
In order to facilitate improvements and readability, each node should have its own message type instead of building workarounds with standard messages. For instance, a strategy message containing robots linear and angular velocities should be
float32[6] lin_vel
float32[6] rot_vel
In contrast, one should not try appending these velocities to a string, separating by comma.
All message description files must have .msg extension and be placed in the src/msg directory.
It may be useful to have launch files, which can start multiple nodes at the same time. Then, for example, instead of running dummy camera, vision, and strategy one by one in different terminals, one can launch roslaunch unball dummy_vision_strategy.launch.
All launch files must have .launch extension and be placed in the src/launch directory.