Gazebo simulation

From youBot wiki
Jump to: navigation, search

The youBot Gazebo packages contain geometry, kinematics, dynamics and visual models of the KUKA youBot in URDF format as well as launch files and tools needed to operate the robot in Gazebo.

This installation guide assumes that ROS is already installed.

To install the model issue the following commands:

ROS Indigo

Since no pre-compiled debian packages are available so far, you have to check out manually. To do that, first create a Catkin workspace, and enter in a terminal

sudo apt-get install ros-indigo-ros-control ros-indigo-ros-controllers ros-indigo-gazebo-ros-control
cd <your-catkin-folder>/src
git clone -b indigo-devel
git clone

The last command should run through without errors. In order to launch it, enter

roslaunch youbot_gazebo_robot youbot.launch 

Note: the simulated motion of the robot can be very slow, as the mobile base uses a non-optimized controller.

ROS Hydro

In order to work with the simulated youBot in Gazebo you have to install ros-hydro-simulators and ros-hydro-youbot-simulation.

sudo apt-get install ros-hydro-simulators
sudo apt-get install ros-hydro-youbot-simulation 

To test if the installation was successful type in the terminal:

roslaunch youbot_gazebo_robot youbot.launch 

ROS Electric

sudo apt-get install ros-electric-pr2-controllers
sudo apt-get install ros-electric-pr2-simulator  # required for trajectory_msgs and Gazebosimulator
mkdir ~/ros_stacks  # (if not done already)
git clone
git clone # brics_actuator messages 

In case the folder ~/ros_stacks(the folder you have chosen to place the youbot-ros-pkg) has not yet been added to the $ROS_PACKAGE_PATH, you need to add this directory, by appending it in the /opt/ros/electric/ and either restarting the terminal window or typing:

 source /opt/ros/electric/setup.bash

You can check if it works by typing the following command:

roscd youbot_description

If the console switches to the youbot_description folder, then everything is fine. Otherwise there is probably something not correct with the $ROS PACKAGE PATH environment variable.

To compile the model use rosmake:

rosmake brics_actuator youbot_description


To run the simulation open a new console window and execute the following command:

roslaunch youbot_description youbot_arm_publisher.launch

This will bring up roscore, load youBot model, bring up and connect the Gazebo simulator.

Note: If you experience technical problems with Gazebo, rviz may be a good alternative for simulation process visualization:

oslaunch youbot_description youbot_arm_publisher_no_x.launch
 rosrun rviz rviz

In rviz click Add button and subscribe for Robot Model topic. In the field Target Frame specify base link for robot model: /base_link

Now you are ready to make your fist simulation. As a first step run the arm_joint_position_control_test example:

rosrun youbot_description arm_joint_position_control_test

This example shows how to control a youBot arm in joint position mode. Try out arm_joint_velocity_control_test and arm_joint_torque_control_test for joint velocity and torque control modes.

Note: examples above together with youbot_oodl ROS package could be used to control a real youBot. Installation instructions on youbot_oodl ROS package can be found under Frameworks section.

Go back to Software