====== Setting up our Simulation Environment ====== The gazebo simulator included in ROS is very powerful but also computionally demanding. To improve the performance on our systems we will use a lightweight setup for our tutorial. ===== A new package ===== In our manipulation-repo, create a new ROS package called iai_seminar_manipulation_environment. If you forgot how to create a pkg, [[http://www.ros.org/wiki/ROS/Tutorials/CreatingPackage|peek here]]. Remove the mainpage.dox as we won't use it. Instead you will document your packages on your wikipage. So, add a link to your wiki page in the manifest-file of the package. Make a first local commit to your git-repo. In general, we recommend you to commit locally very often. A good rule of thumb is to have one commit per feature. From now on, you have to decide yourself, when to make a commit. Also, please do not commit files that have been generated or built, i.e. anything from the directories bin or build or msg_gen etc, because these will be regenerated with every new compilation. ===== Setting up an empty world ===== We will copy parts of the standard (but extensive) gazebo setup to start our empty world. * In our environment package, create a sub-dir launch. * In launch, create an empty launch-file called gazebo_empty_world.launch (you can find the basic syntax of launch-files [[http://www.ros.org/wiki/ROS/Tutorials/UsingRqtconsoleRoslaunch|here]]) * Go to the package pr2_gazebo using the roscd command line tool. If you have not yet installed pr2_gazebo on your computer, do so using aptitude. * Open the file pr2_empty_world.launch from the sub-dir launch. * Copy everything about starting up the empty world from this file to our launch-file in our environment package. Do not copy the part about starting up the PR2! * Go back to our environment package, and add a dependency on the package gazebo_worlds to the manifest-file. We need to add this dependency because our launch-file depends on another launch-file from the gazebo_worlds package. Like this the buildsystem knows that it needs to compile gazebo_worlds (and all of its dependencies) when we compile our environment package. * Compile our environment package using rosmake, and try launching the launch-file. Eventually, you should see an empty gazebo world. ===== And in the third step, he created a robot ===== We will now cherry-pick various launch-files to create simluations of all necessary processes of the PR2: * In our environment package, create an empty launch-file called pr2_lightweight.launch * From pr2_gazebo/launch/pr2_no_controllers: Copy the parts to send the pr2-urdf to the parameter server, and also the node to spawn the robot in gazebo. * From pr2_gazebo/launch/pr2_bringup: Copy the launch to start the controller manager, and the node which publishes the fake calibration, and Fake Calibration. * From pr2_gazebo/launch/pr2.launch: Copy the launch to to load and start the default controllers. * Hint: Do not forget to add the package dependencies that we now added to the manifest of our package. * For testing, re-compile our environment package. Then launch the empty_world, and in another terminal launch pr2-lightweight. After some time (and lot's of printouts on both consoles) you should see the simulated pr2. ===== Putting it all together ===== Where we combine our launch-files into one for easier access. * In our environment package, create a third launch-file called pr2_lightweight_world.launch * Launch the other two previously created launch-files from it. Hint: Now might be a good time push all our commits to github.