ROS Beta Challenge

Submission Link: Form

Complete The following tutorials in order before starting the challenge

Knowing the following concepts is important to move forward:

Master:

Roscore is a service that provides connection information to nodes so that they can transmit messages to one another. Every node connects to roscore at startup to register details of the message streams it publishes and the streams to which it wishes to subscribe. When a new node appears, roscore provides it with the information that it needs to form a direct peer-to-peer connection with other nodes publishing and subscribing to the same message topics. Every ROS system needs a running roscore, since without it, nodes cannot find other nodes.

Nodes:

A ROS node is nothing but an executable program that contains a part of the code of the robot. A robotic application can have more than one node, for example, we can have a node to compute inverse kinematics, a node to send commands to the actuators, a node to get the joint angle values from sensors, etc. All these nodes communicate with each other through messages. There is a Master node running which will have all the addresses of the nodes running in the system. It is the Master node's responsibility to connect the Nodes with each other to start communication. There are three modes in which the nodes can communicate. They are topics, services, and Actions.

Messages:

ROS message provides the data structure for Topics, Services, and Actions to transfer information between nodes. For topics, ROS messages are present in .msg files. These messages have only one part. The message format for topic messages is as below fieldtype1 fieldname1 fieldtype2 fieldname2 fieldtype3 filedname3

Topics:

Topics are named buses over which nodes exchange messages. This is the most commonly used mode of communication for nodes in ROS.

In this mode, a node broadcasts a message with a topic name. This broadcasting node is known as the publisher node.

A node that wants to receive the message will subscribe to this topic name. This node is known as the subscriber node.

This mode of communication is unidirectional. The nodes are unaware of who they are communicating with i.e., A publisher will keep on publishing the data even if there is no/multiple subscribers. Similarly, subscribers will keep listening to the topic if there are no/ multiple publishers. It is the responsibility of the ROS master to establish the connection between the publisher and subscriber when they are on the same topic.

Analogy for better understanding,

To make things much clearer I will use the FM radio System as an analogy.

The transmitter (publisher) at the radio station (node) will transmit your favourite channel (message) at some fixed frequency (topic). Suppose you are sitting in your car, wishing to listen to your favourite channel(message). You will tune the radio receiver (subscriber) to that frequency(topic).

Neither you are aware of where exactly the radio station is nor the radio station wants to know where you are. But still, you can enjoy the music on your favourite channel.

Hope you are clear with how nodes communicate using "Topics" in ROS.

How to make a Launch File :

Pseudo Code:

<launch>
	<node pkg= “packagename” type =“filename in the package (for eg. move.py)” name=”nodename”/>
</launch>

Turtlebot3 Installation Steps:

  1. cd ~/catkin_ws/src
  1. git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
  1. git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
  1. git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
  1. cd .. (this moves you to the previous directory i.e ~/cakin_ws)
  1. catkin_make

Opening Turtlebot3 on Gazebo:

  1. export TURTLEBOT3_MODEL=burger (to be typed every time after opening new terminal) (also try waffle and waffle_pi instead of burger)
  1. roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch

The following window should appear:

Try playing around with the turtle bot with the following command:

  1. export TURTLEBOT3_MODEL=burger
  1. roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

Now comes the fun part! Instead of moving the bot manually like an RC Car, why not make it move autonomously (in circles for starters)?

Challenge:

For this purpose we use packages:

  1. Create a package.
  1. Create a launch file in a launch folder inside the package.
  1. Create a scripts folder in the package (if it’s not there already) and create a move.py file inside it and make it executable.

Note: Refer to the previous Challenge for doubts in the file systems.

Challenge 1:

Move the bot in a circle of radius 2 units (in the empty world itself).

Challenge 2:

Move the bot in a unit square (in the empty world).