Skip to content

Latest commit

 

History

History
91 lines (53 loc) · 8.81 KB

File metadata and controls

91 lines (53 loc) · 8.81 KB

Robot Operating System (ROS)

ROS, or the Robot Operating System, is a free and open-source software framework for robotics. ROS was originally developed by Willow Garage, a robotics research lab in California. ROS focuses on making it easy to develop robot software, by providing a set of tools and libraries that can be used to build robot applications. It also provides a set of standard interfaces that can be used to communicate between different robot components. ROS is a powerful platform for developing robot software, and it is used by many roboticists all over the world. It is also a great way to learn about robotics.

Some benefits of using ROS are:

  1. Free and open-source software
  2. Well-established platform with a large community of users
  3. Supports a wide range of robotic platforms applications
  4. Modular design, making it easy to add new features and functionality
  5. Supports a wide range of programming languages, including C++, Python, Java, and more

ROS Concepts

ROS Nodes

ROS is a distributed computing system, which means that it allows multiple parallel scipts or even multiple computers to work together to control a robot. The basic unit of computation in ROS is a node. A node is a process that performs some computation, such as reading sensor data or controlling a motor. Nodes communicate with each other by sending messages over a network. Nodes can be written in any supported language and you can even mix and match nodes written with different languages.

ROS Publishers and Subscribers

ROS pub-sub is a publish-subscribe messaging model that is used to communicate between ROS nodes. A node that sends a message in such a network design is called a publisher and a node that receives a message is called a subscriber. It is a decoupled messaging system, which means that the publishers and subscribers do not need to know about each other. This makes it a very flexible and scalable messaging system.

A publisher is a node that publishes messages to a topic. A subscriber is a node that subscribes to a topic, and receives messages that are published to that topic.

When a publisher publishes a message, the message is sent to the ROS master node. The ROS 'master node' keeps track of all of the topics and the nodes that are subscribed to those topics. When a subscriber subscribes to a topic, the ROS master node adds the subscriber to the list of nodes that are subscribed to that topic.

When a publisher publishes a message to a topic, the ROS master node sends the message to all of the nodes that are subscribed to that topic. The subscribers then receive the message and can process it as needed.

ROS pub-sub is a very powerful messaging system that can be used to communicate between ROS nodes in a decoupled way. It is a very flexible and scalable messaging system that can be used to build a wide variety of robot applications.

ROS Topics

A ROS topic is a named channel that nodes can publish messages to and subscribe to. Topics are a way for nodes to communicate with each other. When a node publishes a message to a topic, the message is sent to all of the nodes that are subscribed to that topic. The subscribers then receive the message and can process it as needed.

Topics are a powerful way for nodes to communicate with each other. They are easy to use and they are very flexible. Topics can be used to communicate any type of data, including sensor data, motor commands, and even user input.

Here are some commonly found examples of ROS topics:

  • /camera/image_raw: This topic publishes the raw image data from a camera.
  • /cmd_vel: This topic publishes the velocity commands for a robot.
  • /odom: This topic publishes the odometry data for a robot.
  • /tf: This topic publishes the transformation data between different coordinate frames.

ROS Messages

A ROS message is a data structure that is used to send data between ROS nodes. Messages are defined in a .msg file, which is a text file that contains the message definition. The message definition contains the name of the message, the type of each field in the message, and the name of each field in the message.

Here is an example of a message definition:

# This is a comment
string marker_name
int32 center_x_coordinate
int32 center_y_coordinate

The first line of the message definition is a comment. Comments are used to explain what the message is for and what each field in the message is for. Comments are not required, but they are a good idea to include in your message definitions.

The second line of the message definition is the name of the message. The name of the message is used to identify the message in the ROS system. The name of the message should be unique, so that it does not conflict with other messages in the ROS system.

The remaining lines of the message definition is the type and 'name' of each field in the message. The type of each field in the message is used to determine how the data in the field should be interpreted. There are many different types of pre-defined fields that can be used in a message, including strings, integers, floats, and more.

ROS Services

A ROS service is a named channel that nodes can use to send requests and receive responses. Services are a way for nodes to communicate with each other. When a node sends a request to a service, the request is sent to the ROS master node. The ROS master node then sends the request to the node that provides the service. The node that provides the service then processes the request and sends a response back to the ROS master node. The ROS master node then sends the response back to the node that requested the service.

Services are a powerful way for nodes to communicate with each other. They are easy to use and they are very flexible. Services can be used to perform any type of computation, including sensor data processing, motor control, and even user input.

Here is an example. Let's say the following list of ROS services are exposed by a robot driver as part of its standard ROS driver:

  • /set_led: This service turns an LED on or off.
  • /get_temperature: This service returns the current temperature.

To consume the services, you would first need to create a node that requests the service. The node that requests the service would send a request to the ROS master node. The ROS master node would then send the request to the node that provides the service. The node that provides the service would then process the request message and send a response back to the ROS master node. The ROS master node would then send the response back to the node that requested the service.

ROS Actions

A ROS action is a named channel that nodes can use to send requests and receive responses. Actions are a way for nodes to communicate with each other. When a node sends a request to an action, the request is sent to the ROS master node. The ROS master node then sends the request to the node that provides the action. The node that provides the action then processes the request and sends a response back to the ROS master node. The ROS master node then sends the response back to the node that requested the action. During the action, there is also a provision to send periodic feedback messages for the requested action which is a main distinguishing feature from ROS services. Actions can also be cancelled by the client node.

Actions are a powerful way for nodes to communicate with each other and await long-running actions while receiving feedback on progress. Actions can be used to perform motor control or locomotion, or any other task that benefits from being awaited and has definite progress feedback to provide.

Here is an example. Let's say the following ROS action is exposed by a robot driver as part of its standard ROS driver:

  • /move_arm: This action moves the robotic arm to a desired position.

To consume the action, you would first need to create a node that requests the action. The node that requests the action would send a request to the ROS master node. The ROS master node would then send the request to the node that provides the action. The node that provides the action would then start performing the action while giving periodic feedback messages to the ROS master node. The ROS master node would then send the feedback messages back to the node that requested the action. Once the action is completed, the node that provides the action would send a response back to the ROS master node. The ROS master node would then send the response back to the node that requested the action. At any point during the action, the node that requested the action can cancel the action. The node that provides the action would then stop performing the action and send a response back to the ROS master node. The ROS master node would then send the response back to the node that requested the action.

References