RoPod/Tutorials/GAZEBO installation and interface with ROS: Difference between revisions

From Control Systems Technology Group
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
= Install Gazebo=
GAZEBO is a set of ROS packages that provide the necessary interfaces to simulate a robot in the Gazebo 3D rigid body simulator for robots. It integrates with ROS using ROS messages, services and dynamic reconfigure.  
GAZEBO is a set of ROS packages that provide the necessary interfaces to simulate a robot in the Gazebo 3D rigid body simulator for robots. It integrates with ROS using ROS messages, services and dynamic reconfigure.  


Line 13: Line 14:
sudo apt-get install ros-kinetic-openni2-camera ros-kinetic-openni2-launch</pre>
sudo apt-get install ros-kinetic-openni2-camera ros-kinetic-openni2-launch</pre>


= Faster startup of Gazebo=
As you might notice, it can take quite a while before gazebo is loaded. This is caused by loading several models from the gazebo-repository. You can prevent this as follows:
* Go to the directory where gazebo is installed
<pre>cd /usr/share/gazebo-<your gazebo version> </pre>
* Open setup.sh in an editor as a super user
<pre>vim setup.sh</pre>
* replace the line
"export GAZEBO_MODEL_DATABASE_URI="http://gazebosim.org/models"
to
export GAZEBO_MODEL_DATABASE_URI=""
Now, Gazebo should be loaded much faster by loading it from a new terminal.
'''Be careful with this: models from standard tools, such as depth-camera's, can be found in this library. By replacing this line, you can not add them by default any more, but you should download these files yourself and add them to your local library.'''
= Test that gazebo is launched from ROS =
Get familiar with ROS and with the catkin_make way of working: http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment
Get familiar with ROS and with the catkin_make way of working: http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment


Line 39: Line 56:


Get familiar with the data being published, the nodes, etc. See ROS tutorials
Get familiar with the data being published, the nodes, etc. See ROS tutorials
= Faster startup of Gazebo=
As you might notice, it can take quite a while before gazebo is loaded. This is caused by loading several models from the gazebo-repository. You can prevent this as follows:
* Go to the directory where gazebo is installed
<pre>cd /usr/share/gazebo-<your gazebo version> </pre>
* Open setup.sh in an editor as a super user
<pre>vim setup.sh</pre>
* replace the line
"export GAZEBO_MODEL_DATABASE_URI="http://gazebosim.org/models"
to
export GAZEBO_MODEL_DATABASE_URI=""
Now, Gazebo should be loaded much faster by loading it from a new terminal.
'''Be careful with this: models from standard tools, such as depth-camera's, can be found in this library. By replacing this line, you can not add them by default any more, but you should download these files yourself and add them to your local library.'''
=Matlab and GAZEBO interface via ROS=
Open the file ropod_controller.slx. Before executing the simulink model, launch the ropod_gazebo model.
Now you are ready to start simulating your own controller.

Revision as of 10:32, 13 April 2018

Install Gazebo

GAZEBO is a set of ROS packages that provide the necessary interfaces to simulate a robot in the Gazebo 3D rigid body simulator for robots. It integrates with ROS using ROS messages, services and dynamic reconfigure.

Make sure you do not get errors in any of the steps. Otherwise ask for help to your coaches.

Install gazebo version 7.x using the step-by-step installation, only those versions are compatible with ROS kinetic: http://gazebosim.org/tutorials?cat=install&tut=install_ubuntu&ver=7.0

Install gazebo_ros_pkgs and some extra packages needed to run the basis ropod model

sudo apt-get install ros-kinetic-gazebo-ros-pkgs ros-kinetic-gazebo-dev ros-kinetic-gazebo-plugins ros-kinetic-gazebo-ros libgazebo7-dev libgazebo7 libignition-math2 libsdformat4
sudo apt-get install ros-kinetic-gazebo-ros-control
sudo apt install ros-kinetic-joint-state-controller
sudo apt install ros-kinetic-effort-controllers
sudo apt-get install ros-kinetic-openni2-camera ros-kinetic-openni2-launch

Faster startup of Gazebo

As you might notice, it can take quite a while before gazebo is loaded. This is caused by loading several models from the gazebo-repository. You can prevent this as follows:

  • Go to the directory where gazebo is installed
cd /usr/share/gazebo-<your gazebo version> 
  • Open setup.sh in an editor as a super user
vim setup.sh
  • replace the line

"export GAZEBO_MODEL_DATABASE_URI="http://gazebosim.org/models" to export GAZEBO_MODEL_DATABASE_URI=""

Now, Gazebo should be loaded much faster by loading it from a new terminal.

Be careful with this: models from standard tools, such as depth-camera's, can be found in this library. By replacing this line, you can not add them by default any more, but you should download these files yourself and add them to your local library.

Test that gazebo is launched from ROS

Get familiar with ROS and with the catkin_make way of working: http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment

Now we will install existing ROS and gazebo files that will allow to perform simulations of the ropod

Ensure you configured GitHub and you have downloaded the repository: See tutorial

Now you are ready to start the ropod_gazebo model plus the ROS packages to interact with it.

The first time you install the files in your computer be sure that the folders ‘build’ and ‘devel’ are removed, as well as the file src/Cmakelists.txt

Then, on the main directory level, run a cmake command to generate the executable files

catkin_make

You can run the alias

 clean_build

to do all these actions at once. If you just downloaded the repository, ensure you do this from a new terminal! You can safe time the next time you do this by running the command

buildit

In this case, the folders /build, /devel and the /src/CMakeLists.txt-file are not removed.

Then, we can launch the ropod gazebo model, which is already connected with ROS

pstart 

pstart is an alias which is used to get the communication with all the sensors up-and-running. As we have no robot on the dev-pc, gazebo is used for this purpose. At the same time, r-viz starts up in order to visualize all the data.

Get familiar with the data being published, the nodes, etc. See ROS tutorials