0% found this document useful (0 votes)
2 views8 pages

Workshop 02 Introduction to ROS

The document is a workshop manual for an Introduction to ROS, focusing on the basics of the Robot Operating System and the simulation of a Husky robot. It covers the structure of ROS packages, commands for managing them, and the computation graph level, including nodes, topics, and services. The manual also includes exercises for practical application, such as setting up a Husky simulation and controlling it via keyboard commands.

Uploaded by

8kb6sctvj7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

Workshop 02 Introduction to ROS

The document is a workshop manual for an Introduction to ROS, focusing on the basics of the Robot Operating System and the simulation of a Husky robot. It covers the structure of ROS packages, commands for managing them, and the computation graph level, including nodes, topics, and services. The manual also includes exercises for practical application, such as setting up a Husky simulation and controlling it via keyboard commands.

Uploaded by

8kb6sctvj7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Robotics EEE_7_ROB Workshop manuel

Workshop 2 Introduction to ROS

Aims and Objectives


Understand the ROS basics and get to know ROS by inspecting the simulation of a
Husky robot.

Background Theory

What is ROS ?

ROS is a distributed system on which many programs can be run on multiple


computers and communicate over the network. Individual programs communicate
over defined API (ROS messages, services, etc.)

There are mainly three levels in ROS: the filesystem level, computation graph level,
and community level. We will briefly have a look at each level

Understanding the ROS filesystem level


Robotics EEE_7_ROB Workshop manuel

ROS packages
A typical structure of an ROS package is shown here:

We can discuss the use of each folder as follows:


 config: All configuration files that are used in this ROS package are kept in
this folder. This folder is created by the user and it is a common practice to
name the folder config to keep the configuration files in it.
 include/package_name: This folder consists of headers and libraries that we
need to use inside the package.
 script: This folder keeps executable Python scripts. In the block diagram, we
can see two example scripts.
 src: This folder stores the C++ source codes.
 launch: This folder keeps the launch files that are used to launch one or more
ROS nodes.
 msg: This folder contains custom message definitions.
 srv: This folder contains the services definitions.
 action: This folder contains the action files. We will see more about these
kind of files in the next chapter.
 [Link]: This is the package manifest file of this package.
 [Link]: This files contains the directives to compile the package.

Here are some of the commands used to work with ROS packages:
 catkin_create_pkg: This command is used to create a new package
 rospack: This command is used to get information about the package in the
filesystem
 catkin_make: This command is used to build the packages in the workspace
 rosdep: This command will install the system dependencies required for this
package
Robotics EEE_7_ROB Workshop manuel

ROS metapackages

Metapackages are specialized packages in ROS that only contain one file, that is, a [Link] file

ROS messages
The ROS nodes can write or read data that has a different type. The types of data are described using
a simplified message description language, also called ROS messages. The data type description of
ROS messages is stored in .msg files in the msg subdirectory of a ROS package

The ROS services


The ROS services are a type request/response communication between ROS nodes. One node will
send a request and wait until it gets a response from the other. The request/response
communication is also using the ROS message description.

Understanding the ROS computation graph level


The computation in ROS is done using a network of a process called ROS nodes. This computation
network can be called the computation graph. The main concepts in the computation graph are ROS
Nodes, Master, Parameter server, Messages, Topics, Services, and Bags.

The ROS communication-related packages including core client libraries, such as roscpp and
rospython , and the implementation of concepts, such as topics, nodes, parameters, and services are
included in a stack called ros_comm

The ros_comm stack contains the ROS communication middleware packages and these packages are
collectively called the ROS Graph layer:
Robotics EEE_7_ROB Workshop manuel

ROS master, nodes, and topics

ROS has a master program which manages the communication between nodes and it
starts with the command >roscore at the beginning. Every node registers at startup
with the master.
ROS node is a single-purpose, executable program. It can be individually compiled,
executed, and managed. It is organized in packages. A node can be run using the
command
> rosrun package_name node_name
You can see active nodes with
> rosnode list
And retrieve information about a node with
> rosnode info node_name
Robotics EEE_7_ROB Workshop manuel

1. Console commands

Right click your mouse on the Ubuntu desktop and then click on the Open Terminal
selection, you will be able to open a console window look like

You can run all the programs through this type of console window. For example, the
upper screen shot shows how to run roscore program.
2. Launch-files
Robotics EEE_7_ROB Workshop manuel

Exercise
1. Open 4 terminal tabs (Using Ctrl+Shift+T to open new tab)
a. In the console Tab No.1 – starting a roscore with $roscore visit
[Link] to get further information about the role of the roscore
b. In the console Tab No.2 – starting a talker node with $ rosrun roscpp_tutorials talker
. Record your observation to your logbook
c. In the console Tab No. 3 - observe the list of active nodes with $ rosnode list
command; show information about the talker node with $ rosnode info /talker. See
more information about rosnode command here: [Link]
d. In the console Tab No. 4 – starting a listener node with $ rosrun roscpp_tutorials
listener. Record your observations
e. Get back to step c to check change of node lists.
Close the talker node in console No.2 with Ctrl+c and publish your own message with >
rostopic pub /chatter std_msgs/String "data: 'EEE_7_Rob Robotics Module'" and observe
the output of the listener in console No.4 For more information of rostopic take a look at
[Link]

2. Setup the Husky simulation:

[Link]

Remember, our pre-installed ROS distro version (<distro>) is kenetic.

3. Follow the tutorials and launch the simulation (roslaunch husky_gazebo


husky_empty_world.launch) and inspect the created nodes and their topics using following
ros command (like exercise 1):
rosnode list
rostopic list
rostopic echo [TOPIC]
rostopic type [Topic]
rostopic hz [TOPIC]
Robotics EEE_7_ROB Workshop manuel

rosmsg show [Type]


rqt_graph

4. Command a desired velocity to the robot from the terminal (rostopic pub [TOPIC]) ( example
command:

rostopic pub /cmd-vel geometry_msgs/Twist "linear:


x: 0.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.3" -r 3

or

rostopic pub /cmd_vel geometry_msgs/Twist -r 3 -- '[0.0,0.0,0.0]'


'[0.0, 0.0, 0.3]'

You can use rostopic echo /cmd_vel to monitor the message sent around the system.

5. Use teleop_twist_keyboard to control your robot using the keyboard. Find it online and
compile it from source! Use git clone to clone the repository to the folder ~/git.
$ cd ~
$ mkdir git
$ cd git
$ git clone [Link]
Symlink the new package to your catkin workspace with
$ ln -s ~/git/teleop_twist_keyboard/ ~/catkin_ws/src/
Go to your catkin workspace
$ cd ~/catkin_ws
Build the package with
$ catkin_make teleop_twist_keyboard
$ source devel/[Link]
$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py

6. Write a launch file with the following content: - husky simulation with a different world:
Include husky_empty_world.launch file and change the world_name Argument, e.g.
worlds/robocup14_spl_field.world a world from the directory /usr/share/gazebo-7/worlds.
Note: the world_name is with respect to /usr/share/gazebo-7/ - teleop_twist_keyboard
node

Evaluation
Robotics EEE_7_ROB Workshop manuel

1. Check if teleop_twist_keyboard is compiled from source (roscd teleop_twist_keyboard


should show the catkin_ws folder) [20%]
2. Start the launch file. This should bring everything up that’s needed to drive Husky with the
keyboard as shown in the above image. [20%]
3. Write a launch file for exercise 1 to start talker and listener nodes in one go. [20%]
4. Logbook [40%]

You might also like