Getting Started With ROS ( Robotic Operating System ).
by ZRob314 in Circuits > Robots
180803 Views, 116 Favorites, 0 Comments
Getting Started With ROS ( Robotic Operating System ).
What Is ROS ?
The Build ...
1. 2 dual-core computers. 1.6ghz or higher with at least 2gb of ram is recommended.
2. A Turtlebot or Turtlebot compatible robot ( http://www.zagrosrobotics.com/shop/custom.aspx?recid=60 )
3. Gyro power/board - optional - ( http://store.iheartengineering.com/robots/turtlebot/accessories/ihe-0200-0000-fa00.html )
3. Wifi router
4. And a 4gb usb flashdrive
Downloading Ubuntu and Universal USB Installer
*Warning* Understand if you are installing this on a computer with a operating system on it already, this is going to delete everything on your computer. So with that said lets begin by downloading the Ubuntu 10.10 iso. After you determine what type of bit system you have 32 or 64 bit computer. I suggest downloading these versions [ PC (Intel x86) desktop CD] , [ 64-bit PC (AMD64) desktop CD ].
32Bit -- http://releases.ubuntu.com/10.10/ubuntu-10.10-desktop-i386.iso
64Bit -- http://releases.ubuntu.com/10.10/ubuntu-10.10-desktop-amd64.iso
Once you have the Ubuntu iso you will need to burn the image onto a usb flashdrive so that we can boot it from the computer. I suggest using Universal USB Installer for Windows.
The download file link is located near the bottom of their page.
http://www.pendrivelinux.com/downloads/Universal-USB-Installer/Universal-USB-Installer-1.9.0.1.exe
Burning the Iso to USB
You can follow this Youtube tutorial if you are having trouble burinig the ISO. Click -->> HERE
Configure the Bios to Boot From USB
Installing Ubuntu on Both Computers
**Note**
I keep my user name and password short as typing in the password happens a lot for various tasks. I ended up using the same password on both computers, but this is totally up to you. Also its a good idea to name each computer separately such as Robot/Workspace, Turtlebot/Desktop, or Computer1/Computer2 etc ... so you can distinguish between the two, and make things easier later when networking.
Getting Familiar With Ubuntu
http://www.youtube.com/watch?v=FciL32AyZAw
You are also going to need to have a good understanding of the terminal and its common commands in order to better utilize Ubuntu and ROS.
https://help.ubuntu.com/community/UsingTheTerminal
https://help.ubuntu.com/community/FilePermissions
Installing ROS Diamondback
This portion of the tutorial is taken from the ROS wiki. So you can reference that page or continue following this tutorial, which will try to walk you through the installation step by step and setup a ROS network.
ROS WIKI - http://www.ros.org/wiki/diamondback/Installation/Ubuntu
ROS Network Setup - http://www.ros.org/wiki/ROS/NetworkSetup
Configure Your Ubuntu Repositories
Open Ubuntu software center and in the upper portion of the window you click edit, then click Software Sources. Now make sure the boxes labeled universe, restricted and multiverse are checked then close out the window.
Installation Via Terminal
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu maverick main" > /etc/apt/sources.list.d/ros-latest.list'
Then copy and paste into terminal
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
Then copy and paste into terminal
sudo apt-get update
Now we are going to install the full version of diamondback which is the most robust
Copy and paste into terminal
sudo apt-get install ros-diamondback-desktop-full
This portion of the install may take some time so don't worry let it finish. After its complete
copy and paste into terminal
echo "source /opt/ros/diamondback/setup.bash" >> ~/.bashrc
. ~/.bashrc
And lastly copy and paste into terminal
sudo apt-get install ros-diamondback-turtlebot-robot
Now you should have Ros installed on your system along with the turtlebot stacks. To verify you can browse the stacks folder at:
/opt/ros/diamondback/stacks
Configuring the ROS Network
Now copy and paste in the terminal
sudo apt-get install chrony
And copy and paste into terminal
sudo ntpdate ntp.ubuntu.com
We are also going to setup openssh. Helpful if in the future you want to utilize the terminal of one computer from another.
Copy and paste into terminal
sudo apt-get install openssh-server
These next steps are from the ROS wiki as well and have been simplified. So if you have any issues please refer to that page for help and a complete guide. Also this is a nice tutorial I found on the subject.
ROS/Network wiki - http://www.ros.org/wiki/ROS/NetworkSetup
Tutorial - http://nootrix.com/2012/06/ros-networking/
Now lets get started. First thing we need to to is connect both computers to the wifi router and then find out their IP addresses. Left click your wifi icon on your status bar located near the top of the screen. Then right click Connection Information , you should see window labeled Connection Information
The number you are looking for is IP Address. Write these numbers down for both machines.
Next is to edit a file that recognizes computers connected to a network. Copy and paste this into terminal of the first computer
sudo gedit /etc/hosts
You should be prompted to input your password. After passing the security check. The text editor window will show and you need to copy and paste the IP and computer name of computer2 ( example-- 192.168.1.3 computer2 ) into the file and save it. And do the same thing to computer2 by imputing computer1's IP and name ( example-- 192.168.1.4 computer1 ).
You can verify that things were successful by pinging both computer form each other. Copy and paste into computer1
ping (input computer2's name here)
And the same for computer2. Copy and paste
ping (input computer1's name here)
If things are going well you should see something like
PING computer1 (192.168.1.4): 56 data bytes
64 bytes from 192.168.1.4: icmp_seq=0 ttl=63 time=1.868 ms
64 bytes from 192.168.1.4: icmp_seq=1 ttl=63 time=2.677 ms
64 bytes from 192.168.1.4: icmp_seq=2 ttl=63 time=1.659 ms
If something is wrong I suggest checking you IP addresses again and make sure you are still connected to your wifi network.
The next step is going to be exporting the Host names into bash files of both machines so that ROS masters can recognize each other.
** NOTE that in my configuration my computer1-Turtlebot (ROBOT) - is the Master and computer2-Workstation(desktop) - is the Host.**
So in terminal of the computer1 copy and paste
gedit ~/.bashrc
Once again the text editor will appear and you will copy and paste this near the bottom of the file. But input the IP of your Robot in place of the one I have listed below for both MASTER and HOSTNAME.
ROS_MASTER_URI=http://192.168.1.4:11311
ROS_HOSTNAME=http://192.168.1.
Now on computer2 the steps are similar but in place of the HOSTNAME's IP you are going to use the IP of computer2 and MASTER IP is going to be the Robots IP. Copy and paste
ROS_MASTER_URI=http://192.168.1.4:11311
ROS_HOSTNAME=http://192.168.1.3
So basically on the MASTER computer's bash file use its own IP for both lines. And on the Host machine you also input the MASTERS IP on the first line but on the second line input the Host machine's IP.
ROBOT = MASTER
DESKTOP = HOST
Testing Our ROS Network
#####################################################################################################
**NOTE**
Make sure that your turtlebot serial cable is plugged in to your create and computer, and the create is charged and powered on. Also if you are having trouble with the connection. Verify that your create is plugged into the corresponding port that is set in the turtlebot_node.py located at [ /opt/ros/diamondback/stacks/turtlebot/turtlebot_node/nodes/turtlebot_node.py ] . You can check the port by going into the file location [ /dev] and looking for the port to disappear when you unplug the cable from the computer. And if the port set to the create is different than that in the turtlebot_node.py file go ahead and edit it by using CHMOD
Copy and paste
Sudo chmod 777 /opt/ros/diamondback/stacks/turtlebot/turtlebot_node/nodes/turtlebot_node.py
Then right click the turtlebot_node.py file and click open then click the option "display". Now go ahead and change the file on line 78 so that it matches your corresponding port.
#####################################################################################################
Lets launch ROS and turtlebot nodes on the turtlebot (computer1)
Copy and paste in terminal
roscore
Then copy and paste in terminal
roslaunch turtlebot_bringup minimal.launch
Now we launch ROS on the desktop (computer2)
Copy and paste in terminal
roscore
Then we launch the teleop node
Copy and paste in terminal
roslaunch turtlebot_teleop keyboard_teleop.launch
Now you should be able to use the arrow keys to control your robot from the second computer.
Conclusion
Useful links
Zagros -- http://www.zagrosrobotics.com
ROS site -- http://www.ros.org
ROS Users -- http://ros-users.122217.n3.nabble.com/
ROS Answers -- http://answers.ros.org/