Let's install turtlesim packages

From Lofaro Lab Wiki
Jump to: navigation, search

In this learning session we will use turtlesim to simulate an actual robot. It will teach us necessary parts of a ROS project in a better way. To install the turtlesim simulator you need to give the command

 Sudo apt-get install ros-indigo-turtlesim 

After installing the turtlesim package we will initialize rosdep which is a onetime initialization step. If the ROS works correctly we don’t need to initialize it again. The command will be

 sudo rosdep init

you can update the rosdep using the command

 rosdep update

when you run ROS commands in your terminal, it needs to know where the necessary files are. To make ROS know about your installation file locations you need to execute the setup.bash file script that ros provides, using the command

 source/opt/ros/indigo/setup.bash 

It will help you getting rid of the error “command not found”.

Let’s start with the turtlesim Open three separate terminals and execute these three commands

 roscore
 rosrun turtlesim turtlesim_node
 rosrun turtlesim turtle_teleop_key

three terminals will allow all three commands to execute simultaneously. The first command will start the ROS server, which will make communication between nodes if needed. Second command will execute a node named turtlesim_node and third will execute another node named turtle_teleop_key. Both the nodes are from turtlesim package. So it is clear that to run a node we simply need the command

 rosrun package-name node-name 

it should be said that rosrun doesn’t do anything magical here. It is a system of ros which help us to find packages and node from ROS workspace. If you know the full directory of the nodes you can run it from there directly.