Difference between revisions of "Gazebo simulation"
(12 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | 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. | + | This installation guide assumes that ROS is already installed. |
To install the model issue the following commands: | 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 | |
− | + | ||
− | + | <pre>sudo apt-get install ros-indigo-ros-control ros-indigo-ros-controllers ros-indigo-gazebo-ros-control | |
+ | cd <your-catkin-folder>/src | ||
+ | git clone http://github.com/youbot/youbot_description.git -b indigo-devel | ||
+ | git clone http://github.com/youbot/youbot_simulation.git | ||
+ | catkin_make | ||
+ | </pre> | ||
+ | |||
+ | The last command should run through without errors. In order to launch it, enter | ||
+ | |||
+ | <pre>roslaunch youbot_gazebo_robot youbot.launch </pre> | ||
+ | |||
+ | 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. | ||
+ | |||
+ | <pre>sudo apt-get install ros-hydro-simulators | ||
+ | sudo apt-get install ros-hydro-youbot-simulation </pre> | ||
+ | |||
+ | To test if the installation was successful type in the terminal: | ||
+ | |||
+ | <pre>roslaunch youbot_gazebo_robot youbot.launch </pre> | ||
+ | |||
+ | ===ROS Electric === | ||
+ | <pre>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 https://github.com/youbot/youbot-ros-pkg.git | ||
+ | git clone https://github.com/ipa320/cob_common.git # brics_actuator messages </pre> | ||
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/setup.sh and either restarting the terminal window or typing: | 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/setup.sh and either restarting the terminal window or typing: | ||
− | + | <pre> source /opt/ros/electric/setup.bash</pre> | |
You can check if it works by typing the following command: | You can check if it works by typing the following command: | ||
− | + | <pre>roscd youbot_description</pre> | |
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. | 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. | ||
Line 26: | Line 53: | ||
To compile the model use rosmake: | To compile the model use rosmake: | ||
− | + | <pre>rosmake brics_actuator youbot_description</pre> | |
Usage | Usage | ||
To run the simulation open a new console window and execute the following command: | To run the simulation open a new console window and execute the following command: | ||
− | + | <pre>roslaunch youbot_description youbot_arm_publisher.launch</pre> | |
This will bring up roscore, load youBot model, bring up and connect the Gazebo simulator. | This will bring up roscore, load youBot model, bring up and connect the Gazebo simulator. | ||
Line 37: | Line 64: | ||
Note: If you experience technical problems with Gazebo, rviz may be a good alternative for simulation process visualization: | Note: If you experience technical problems with Gazebo, rviz may be a good alternative for simulation process visualization: | ||
− | + | <pre>oslaunch youbot_description youbot_arm_publisher_no_x.launch | |
− | + | rosrun rviz rviz</pre> | |
In rviz click Add button and subscribe for Robot Model topic. In the field Target Frame specify base link for robot model: /base_link | In rviz click Add button and subscribe for Robot Model topic. In the field Target Frame specify base link for robot model: /base_link | ||
Line 44: | Line 71: | ||
Now you are ready to make your fist simulation. As a first step run the arm_joint_position_control_test example: | Now you are ready to make your fist simulation. As a first step run the arm_joint_position_control_test example: | ||
− | + | <pre>rosrun youbot_description arm_joint_position_control_test</pre> | |
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 | 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 | ||
Line 50: | Line 77: | ||
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. | 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 | Software]] |
Latest revision as of 10:53, 1 June 2015
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 http://github.com/youbot/youbot_description.git -b indigo-devel git clone http://github.com/youbot/youbot_simulation.git catkin_make
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 https://github.com/youbot/youbot-ros-pkg.git git clone https://github.com/ipa320/cob_common.git # 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/setup.sh 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
Usage
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