On this page I will distill my insights from taking robot lab, so that you might be able to much more quickly make your way to where I am now in terms of understanding robotics simulation. While taking robot lab I focused entirely on the simulation side of the subject.Robotics Simulators can be sepereted into two groups based on their software licence. Currently the most developed and widely used open source simulator is player/stage/gazebo.indeed in general the player/stage/gazebo software package is considered by many to be the most widely used robotics simulation software on the market. While there are other simulators available few compare.
Summary of work
In robot lab I learned to install player, stage, and gazebo. I learned how to create robots for simulation in ros gazebo and stage and lastly how to program them. I also spent a small amount of time looking at the merits of simulators other than player/stage/gazebo
How i spent my time in this class
I spent the first three or four weeks trying to install player, stage, and gazebo as well as looking at some of the other options available to students for simulation of robotics. Once I installed and learned to use ROS i found that it was not necessary to install player, stage, and gazebo if your going to use ros because ros will do the work for you. After I had gazebo working with ros i spent two weeks working on learning urdf to make a simulated robot and then learning xacro to make it easier to alter and add to that simulated robot. After that I spent a week trying to learn how to control a robot in gazebo through ros but my efforts did not find any results so i began learning how to do so through player. As a result of that I learned how to define a world in stage. My last task was to learn to use player to control robots.
Before you can even consider installing player/stage/gazebo, you need to install ubuntu. whether it be with or without ros, at this point it is very unlikely that you will be able to get it to work on any other operating system other than ubuntu. Luckly for you even if you have a computer running windows or mac os x, you can have a virtulization of ubuntu which will be good enough provided you are not using gazebo.
Follow the following directions to install ubuntu on a virtual machine.
- download and install the most recent version of virtual box
- Now you need to download ubuntu
- Next you need to launch virtual box and choose new to make a new virtual machine. follow the wizard as it has you set up the virtual machine. I suggest that when it is time to choose a hard drive make it dynamically allocated, as it will only gain size as it grows larger and you should give it at least 8 gb but I would suggest 20 as a perfect amount.
- After hitting create you will see a new vertual machine with the name you gave it under the new/settings/start buttons. Before you can start the machine and install ubuntu you need to have a disk available with ubuntu on it. If you are able to mount the disk without burning it then do so now. Otherwise you will need to burn it to a dvd or flash drive. After this is done and you have booted the disk, click on your virtual machine and either press the start button. Now you will see the first run wizard. You will need to choose the disk with the version of ubuntu you downloaded and press continue.
- Next you will be given the option to try ubuntu or install it to your hard drive. Choose install. Overright the harddrive as there will not be anything on it. As ubuntu installs it lets you go through the basic user setup.
- You have now installed ubuntu. Congratulations. The last thing i suggest doing right after finishing installation is to stop the virtual machine and clone your vm. There is an option to take snapshots of what you have been doing but I would rather have a full copy. This may take some time depending on the size of your vm, but it should not be more than 20 minutes at most.
Ubuntu Linux Basics
For those who have not spent much time using command line, using linux can be confusing as many functions can only be done through the command line interface. To bring up a command line prompt either press the keyboard shortcut ctrl +alt+ t. to go to a directory type cd(change directory) and the address of the folder you wish to go to. to create a new directory type mkdir directoryName to change permissions for a file type chmod u(for user. other options are g for group and o for others) + (+ adds permissions - removes) r w x(read write execute)
Player, stage, gazebo Section
Installing Player/stage/gazebo standalone
If you are going to use stage or gazebo you must first install player. Player is essentially software which allows your computer to communicate with your robot, interoperate its sensor output, and give it commands to move. there are a number of different attempts to explain how to install player, such as the one found on the player installation page. The latest version of player can be downloaded from here
Installing Player/Stage/gazebo with ros
Part 1: installing ros on ubuntu 12.04
Installation of ros is comparatively simple. Making sure you know the version of ubuntu you are running and if there is any specific package you wish to use from ros, make sure you are using a distribution of ros which is supported. As with any linux software it is quite possible that the newest version is not yet compatible with the software you wish to use.
if the version that you are installing is still feurte and you are running ubuntu 12.04(Precise) then follow the steps bellow. These instructions are an enhancement to the standard install instructions for those whom are not as familiar with using ubuntu. If you are installing ros on a different system [part2 here] and use the ros tutorial as by this writing my steps may be out of date.
The first thing you need to do before installing ros is to configure your ubuntu repositories to allow restricted, universal, and multiverse. To do this you need to open the ubuntu settings by going to the top right menu bar and choosing the symbol in the rightmost place. In that menu there should be a settings option. If not they may have moved it since I last did this and so your best bet is to look up where to go in google.
Next you need to setup your sources.list. Open a terminal by pressing ctrl+alt+t. Copy this line into the terminal by pressing shift+ctrl+v:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list'
Now press enter to run the command.
Now set up your key by pasting the following command:
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
Now you need to run apt-get update to re-index the ros.org server. to do this paste and enter this into a terminal window:
sudo apt-get update
Note: sudo will require your administrative password. if you set your password in the ubuntu setup they should be the same.
Now we will do a full installation of ros. Before you start this step you should know that installing ros can take a while. Be prepared for a long wait. Paste the following command into the terminal window and then press enter:
sudo apt-get install ros-fuerte-desktop-full
Now that ros has been installed you need to set up its environment variables so that they will be added to each terminal automaticly. To do so enter the following into a terminal window:
echo "source /opt/ros/fuerte/setup.bash" >> ~/.bashrc
The last step you need to take is to install some stand alone tools which are needed to use ros.
sudo apt-get install python-setuptools python-pip
after that has finished try running the following command line to install vcstolls and rosdep
sudo pip install -U rosinstall vcstools rosdep
If you ge the error "sudo: pip: command not found" try this instead:
sudo easy_install -U rosinstall vcstools rosdep
Part 2: Installing a different version of ros or installing fuerte on a different version of ubuntu
To install ros for a version of ubuntu other than 12.04 or if you need to install a newer version of ros, It is best that you follow the ros tutorial for installation as i will not be updating this tutorial.
Note: choose a supported operating system. The experimental operating systems are both difficult to install ros on or not worth doing so because many features may not work outside of ubuntu. Also while you follow the installation instructions make sure to only do the actions which are specific for the version of ubuntu you are running. For example if it says Ubuntu 11.10 (Oneiric) that is only for ubuntu 11.10 and should otherwise be disregarded.
After installing ros<h4>
now that you have installed ros you should work through the ros tutorials. These tutorials will help you set up your ros installation and will also teach you all the basic information about how ros itself works and how to use it. after completing the basic ros tutorials you are ready to go ahead and install player, stage and or/gazebo<h4> part 3: Installing player in ros
part 4: Installing stage in ros
part 5: Installing gazebo in ros
Installing gazebo using ros is easy compared to installing gazebo by itself. Note though that in the case of a virtualization gazebo requires that 3d acceleration is turned on. In addition it may not work very well.
to install gazebo simply enter the following in a terminal window after navigating to your ros_workspace
rosdep install gazebo_worlds
and like magic gazebo builds itself
Now type the following to make gazebo:
now that gazebo is built you can launch it by typing the following into a terminal window:
roslaunch gazebo_worlds empty_world.launch
An empty gazebo world should show up now. If your running ubuntu ina virtual machine you will notice that nothing in the virtual machine can move over the image of the gazebo scene. In addition if you continue to make use of gazebo. This unfortunately makes gazebo particularly difficult to use in terms of changeing your view as the view options are a popup window placed just above the world window which is invariable covered when trying to change views. Unfortunately the only remedy for this is to install ubuntu onto a external harddrive if you have access to a windows pc rather than run it as virtual machine.
A gezebo world isnt much good if its empty. Lets add a table. enter the following line into a new terminal window:
roslaunch gazebo_worlds table.launch
Ros comes with a few models to use but what you probably really want to know is how do spawn a robot into the world?
Before we can spawn a robot we need to define one. Create a new document and name it object.urdf
Now enter the following into the document:
<robot name="simple_box"> <link name="my_box"> <inertial> <origin xyz="2 0 0" /> <mass value="1.0" /> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="100.0" iyz="0.0" izz="1.0" /> </inertial> <visual> <origin xyz="2 0 0"/> <geometry> <box size="1 1 2" /> </geometry> </visual> <collision> <origin xyz="2 0 0"/> <geometry> <box size="1 1 2" /> </geometry> </collision> </link> <gazebo reference="my_box"> <material>Gazebo/Blue</material> </gazebo> </robot>
Now enter the following in the terminal:
rosrun gazebo spawn_model -file `pwd`/object.urdf -urdf -z 1 -model my_object
You should now see a blue rectangle in your world.
for a more detailed example about how to install gazebo with ros and use gazebo work through the [http://www.ros.org/wiki/simulator_gazebo/Tutorials/StartingGazebo ros gazebo tutorial ]
Defining a robot
Stage Robot Definition
Ros rviz/gazebo Robot Definition
building robots with URDF
Urdf is a format for defining a robot using xml tags. It is assumed that the reader already has a passing knowedge of the rules for xml, but if you do not you can read this xml tutorial to learn the basics.
The majority of information i found on this subject was found on the ros tutorial page for urdf here <p> A robot in its most basic definition is a collection of links and joints. A link is the body part of the robot. a joint is a connector between two links which allows for the possibility of motion. In urdf the robot is defined starting from a base link and all components are then either attached with a joint to the base or to a child of the base.
the first thing to define when creating a simple robot in urdf is the robot tag.
<robot name = "robTheRobot">
The name attribute defines what we will call the robot when loading it into rviz or a gazebo world
The next step is to define a base link
<robot name = "robTheRobot">
<link name ="base_link">
The next part we need to add is the part of the urdf which defines what the robot will look like, the visual tag. Within the visual tag we define the robots geometry with the geometry tag and within that tag you can define a shape such as a rectangle, sphere, or box.
<robot name = "robTheRobot">
<link name ="base_link">
<cylinder length="0.6" radius="0.2"/>
for additional information on the subject of how urdf defines a robot I suggest reading through the urdf tutorials
Improving your robot with XACRO
for additional information on how to improve your urdf robot with xacro, i would suggest going through the ros xacro tutorial
Programing a Robot for use with Player
Other simulators to look at
In this section I will talk briefly about three other simulators I was able to look at.
Microsoft Robotics Developer Studio
The most recent version of microsoft robotics developer studio is available from their website here.
Microsoft developers studio is not the most intuitive piece of software to install but it is possible for someone with little programming experience to use it by mastering Microsoft's visual programming language. An editor for this is provided with the software, and this allows you to program a robot in simulation or with select hardware by working through the tutorials which are here. I spent most of my time playing with the example simulations provided with the suite, which shows the potential application for the kinect fairly well. The simulation itself looks very nice but It would not be particularly useful since it did not seem to have a point cloud library or support for the pioneer robot we were using.
V-Rep is a new robotics simulation that is currently still in developement. Students and anyone interested in the software can download a demo version which only disables the save function here
V-rep is a Virtual Robot Experimentation platform which provides a wide variety of features which I thought was most impressive. The features are described here. I thought of the most interesting to a student is that you can build the robot in the editor out of primitive shapes and then program the robot in the main editor through the lua scripting language.
In addition to being able to create your own robot in the simulator cad models can be loaded of robots, which clearly provides a level of accuracy that is missing in other simulators. V-rep includes a verity of robot models as well as other objects. All objects in v-rep are added the simulation by dragging and dropping from a list of objects.
The simulation comes with both mobile and fixed robots, so it can be used for a wider range of simulations, particularly since it has a wide range of physics interactions supported. Your robots actions can be programmed entirely within the simulator using a scripting language called lua and the built in api provides a large verity of functions including provides path planning. It has a wide verity of supported sensors and importantly has built in recording and monitoring of sensor data. Lastly v-rep application itself can be customized by either writing a custom main client application or by writing plugins.
Overall I would say the level of user friendly interaction combined with a fairly fully featured robotics simulation environment makes V-rep a very compelling choice of simulation particularly as a student who can easily be bogged down by dealing with getting the simulator installed and working.
Webots can be found here
Webots is the third simulation software I looked at and the one i spent the least amount of time looking at. With only a few mintues use I discovered that it does have some interesting advantages over player/stage/gazebo and microsoft developer studio in that the entire simulation and coding environment are integrated into a single piece of software. While for research purposes this might not be as signficiant as a student learning to program robots has been much harder to begin as one has to master the installation of the software and creating worlds before you can even consider learning to get a robot to do something. Webots allows the user to skip the more time intensive steps and get to learning to program a robot. I did not orginally look at the demo of webots until a week ago as it limits the user to two environments and does not allow the user to save. More importantly the price for the educational edition is $320 which would be fine for a class using it but not as such for a individual student to purchase.