Teaching robotics with jderobot
Jderobot has been used since 2006 for teaching robotics in four courses (Robótica-ITIS, Introducción a la Robótica, Robótica-Master and Visión en robótica).
Contents |
2012-2013 courses
If you want to install jderobot you have two modes of operation: with .deb packages or manually.
Installing Gazebo
First at all, yo need to check if your graphics works fine. Install
sudo apt-get install mesa-utils
Execute the glxgears program
glxgears
If the program execute without problems you can continue reading this tutorial, in other case please check and install your graphics card.
Ubuntu 12.04
Configure in your computer to accept software from packages.osrfoundation.org.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list' sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu precise main" > /etc/apt/sources.list.d/gazebo-latest.list'
Repository keys
wget http://packages.ros.org/ros.key -O - | sudo apt-key add - wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
Update the package and install Gazebo
sudo apt-get update sudo apt-get install gazebo
Configurate Gazebo
echo "source /usr/share/gazebo/setup.sh" >> ~/.bashrc source ~/.bashrc
Now you can execute Gazebo
gazebo
Debian
Install the prerequisites package
sudo apt-get install build-essential libtinyxml-dev libtbb-dev libxml2-dev libqt4-dev pkg-config libprotoc-dev libfreeimage-dev libprotobuf-dev protobuf-compiler libboost-all-dev freeglut3-dev cmake libogre-dev libtar-dev libcurl4-openssl-dev libcegui-mk2-dev libswscale-dev libavformat-dev libavcodec-dev
Download Gazebo from here.
mkdir build cd build cmake . make -j <PRE> Configurate Gazebo: <PRE> >> echo "source /usr/local/share/gazebo/setup.sh" >> ~/.bashrc
Modify the next file:
sudo gedit /usr/local/share/gazebo/setup.sh
and add the next line to the file:
export LD_LIBRARY_PATH=/usr/local/lib/gazebo-1.4/plugins:/usr/local/lib/:${LD_LIBRARY_PATH}
Reload ~/.bashrc
source ~/.bashrc
Modify /etc/hosts
sudo gedit /etc/hosts
Comment the line that contains ::1 with #
Now you can execute Gazebo
gazebo
Necessary files
First at all, install the prerequisite package:
sudo apt-get install libglademm-2.4-dev libgnomecanvas2-dev libgnomecanvasmm-2.6-dev libgtkglextmm-x11-1.2-dev libgtkmm-2.4-dev libgtkgl2.0-dev libgtk2.0-dev jderobotlib-* jderobot-opencv freeglut3-dev cmake
IMPORTANT!!!
Check you gcc and g++ version. The required version is 4.4
gcc -version g++ -vesion
If your version is different, please configure gcc and g++
sudo apt-get install gcc-4.4 g++-4.4 sudo rm -r /usr/bin/gcc sudo rm -r /usr/bin/g++ sudo ln -s /usr/bin/gcc-4.4 /usr/bin/gcc sudo ln -s /usr/bin/g++-4.4 /usr/bin/g++
Models and worlds
Unzip the models file and put the files in in ~/.gazebo/models. This file contains the necessary information to create the differents world.
World are in GazeboServer .zip package shown in the next section. You have some worlds: "jaramaSigueLineas.world" for the Jarama world, "jaramaSigueLineasLigero.world" for a ligther world of Jarama, "reconstruccion.world" for the 3D reconstruction world, and "departamental2.world" for the Departamental 2 world.
| Reconstruct in 3D | Follow the line |
|
|
|
GazeboServer
To connect JdeRobot with gazebo is necessary to compile GazeboServer. Download gazeboserver. Unzip the file and user the terminal to access the build directory
cd <YOUR UNZIP DIRECTORY>/GazeboServer/build cmake .. make
If all is correct now you have the necessary dynamic libraries to connect JdeRobot with Gazebo. Now launch a simple worl
cd <YOUR UNZIP DIRECTORY>/GazeboServer/build gzserver ../pioneer2dxJde.world
If you want to see the world execute in other terminal
gzclient
Code Introrob
introrob is the component where you are going to code the behavior of your robot. The file you have to modify is MyAlgorithms.cpp
cd <YOUR UNZIP DIRECTORY>/introrob/build cmake .. make
MyAlgorithm.cpp contains tow functions: RunNavigationAlgorithm and RunGraphicsAlgorithm. In the first function you have to access to the sensor of the robot and indicate to the actuators which linear velocity or angular velocity have to take the robot.
Installing with .deb packages (32 bits systems)
You have an installation manual right here. Please, follow that steps carefully.
Manual installation
If you don't have an Ubuntu 12.04 nor Debian Wheezy, both of them of 32 bits, you have to install it mannualy. This way, more complex than the first one, is capable of install jderobot in whatever Linux you have in your computer. The manual of jderobot is right here, but if you don't want to read it, here you have some pointers to do it quickly. First of all, you yave to download the svn repository of jderobot:
svn co http://svn.jderobot.org/jderobot/
Then, install the previous recommended libraries, as explained here.
Now, you have to install some tools needed in gazeboserver and introrob. Please, follow the steps for install ICE Middleware, GearBox, OpenCV 2.3.1, Gtkmm 2.4 and LibGlade 2.4.
For every jderobot component/tool you have to compile and build it as follows:
- Set your working directory in the component, for example: ~/jderobot/trunk/src/components/my_component
cd ~/jderobot/trunk/src/component/my_component
- Compile it
cd build cmake .
- Build it
make
- And that's it! An executable file has been generated in the component directory, so you can execute it as follows:
cd .. (in order to put your working directory on ~/jderobot/trunk/src/components/my_component) ./my_component --Ice.Config=my_conf_file.cfg
This last line doesn't apply to gazeboserver because this component is special.
Gazebo
You can install Gazebo simulator as explained in the manual. Please, note that the latest version available of Gazebo tested in jderobot is 1.4; installing later versions of it may cause problems (they are not tested yet).
gazeboserver
To install gazeboserver you have to follow the steps explained before. If you want more information about how to use it and which things you can do with it, follow this link.
introrob
To install introrob you have to follow the steps explained before. If you want more information about how to use it and which things you can do with it, follow this link.
Important notes
- If you are getting some errors trying to launch Gazebo simulator, like these:
Error [Plugin.hh:100] Failed to load plugin libmotors.so: libmotors.so: cannot open shared object file: No such file or directory Error [Plugin.hh:100] Failed to load plugin libpose3dencoders.so: libpose3dencoders.so: cannot open shared object file: No such file or directory Error [Plugin.hh:100] Failed to load plugin libencoders.so: libencoders.so: cannot open shared object file: No such file or directory Msg Connected to gazebo master @ http://localhost:11345 Error [Plugin.hh:100] Failed to load plugin liblaser.so: liblaser.so: cannot open shared object file: No such file or directory Error [Plugin.hh:100] Failed to load plugin libcamera_dump.so: libcamera_dump.so: cannot open shared object file: No such file or directory Error [Plugin.hh:100] Failed to load plugin libcamera_dump.so: libcamera_dump.so: cannot open shared object file: No such file or directory
These messages means that it is impossible for Gazebo to find that plugins. You have to modify the /usr/local/share/gazebo-1.X.X/setup.sh file. You have to add:
:/usr/local/share/gazebo-jderobot/plugins/pioneer2dxJde
to the line related with GAZEBO_PLUGIN_PATH. Then, you have to type:
source ~/.bashrc
and launch Gazebo. These errors may be fixed.
- Configuration files are tested to work fine, that is to say, if you want to execute gazebo + gazeboserver + introrob to test it, you can launch it all with its default configuration files. Take care of modifying these files, located at /usr/local/share/jdreobot/conf.
2011-2012 courses
Installing and setting up the environment
- Install jderobot 5.0 from debian packages. You may follow the directions here. It will install the Gazebo 3D simulator (release 0.9) and some useful libraries in your machine.
- Unpack this tarball with the source code of the teaching environment. It includes interfaces for access to sensors and actuators, two software components (gazeboserver and introrob) and configuration files:
$ tar -zxvf curso2012-4.5.tgz
will do the magic
- (1) Compile the interfaces that will be used by following components
- (2) Compile the gazeboserver component and generate its executable file
- (3) Compile the introrob component and generate its executable file
$ cd curso2012-4.5 $ make
- This 'make' command will do the mentioned (1)(2) and (3) steps
Launching the environment
- Launching gazebo simulator
$ cd curso2012-4.5/gazebo-0.9-config/worlds $ gazebo depar2.world
- Starting gazeboserver component
$ cd curso2012-4.5/components/gazeboserver $ ./gazeboserver --Ice.Config=./gazeboserver.cfg
- Running introrob component
$ cd curso2012-4.5/components/introrob $ ./introrob --Ice.Config=./introrob.cfg
Writing and testing your own code
- Modify the "curso2012-4.5/components/introrob/MyAlgorithms.cpp" file with your favourite editor
- Compile the introrob component and generate its executable file
- Launch the environment
Greatest hits
These are some practices done by the students:
Visual follow-line behavior
The students programmed a reactive navigation algorithm for the simulated Pioneer robot (in Gazebo simulator) that only uses images from the robot onboard camera to navigate and follows the red line. They modified the introrob Jde schema. No encoders were used.
Local navigation using Virtual Force Field (VFF) algorithm. The students programmed a simulated Pioneer robot (in Stage simulator) endowed with encoders and laser scanner. They modified the introrob Jde schema. The human user provides local destinations to the robot clicking on the shema GUI.
Robot Races in Stage
Robot races using an hybrid local-global navigation algorithm. Students programmed a simulated Pioneer robot (in Stage simulator) to complete as fast (and safe) as possible one lap to the Cheste circuit. They competed alone against the clock and in pairs, with two robots at the same time in the road, pushing the limits of their navigation algorithms. The robots use encoders and laser readings.
Bump and go
The cat and the mouse
Robot Races in Gazebo
The circuit is just the Departamental-II building, with no red help-line drawn in the floor. The only permitted sensor is the camera, no laser allowed.
Following an object with the robot neck
Gazebo worlds used in teaching robotics
Follow line with Jarama world
Departamental II world
If you want to use these worlds and more, you can find them here, with their own textures and models.
