1. ROS graph
Network of nodes in a ROS system and the connections between them by which they communicate
2. Nodes
Nodes can communicate with other nodes within the same process, in a different process, or on a different machine.
Nodes are typically the unit of computation in a ROS graph.
Each node should do one logical thing.
Nodes's usecase
# case 1. Communication
Nodes --pub--> Named topics --subs--> Nodes
# case 2. Service client/server
# case 3. Action client/server
> for long running computation
Nodes can provide configurable parameters to change behavior during run-time.
Connections between nodes are established through a distributed discovery
process
3. Discovery
Discovery of nodes happens automatically through the underlying middleware of ROS 2.
When a node is started, it advertises its presence to other nodes on the network with the same ROS domain (set with the ROS_DOMAIN_ID environment variable). Nodes respond to this advertisement with information about themselves so that the appropriate connections can be made and the nodes can communicate.
Nodes periodically advertise their presence so that connections can be made with new-found entities, even after the initial discovery period.
Nodes advertise to other nodes when they go offline.
4. Interfaces
ROS applications communicate through interfaces:
Topics
Services
Actions
IDL
(interface definition language) describe these interfaces. (e.g., protobuf)
ROS2's IDL
-
.msg
: field of a ROS msg -
.srv
: request / response -
.action
- goal
- result
- feedback
.msg
- Field names must be lowercase alphanumeric characters with underscores for separating words
fieldtype fieldname fielddefaultvalue
For example:
uint8 x 42
int16 y -2000
string full_name "John Doe"
int32[] samples [-200, -100, 0, 100, 200]
string values must be defined in single ' or double " quotes
Constant value(immutable), names have to be UPPERCASE
constanttype CONSTANTNAME=constantvalue
For example:
int32 X=123
int32 Y=-123
string FOO="foo"
string EXAMPLE='bar'
.srv
Services are a request/response communication, where the client (requester) is waiting for the server (responder) to make a short computation and return a result.
string str
---
string str
For example:
# request constants
int8 FOO=1
int8 BAR=2
# request fields
int8 foobar
another_pkg/AnotherMessage msg
---
# response constants
uint32 SECRET=123456
# response fields
another_pkg/YetAnotherMessage val
CustomMessageDefinedInThisPackage value
uint32 an_integer
.action
Actions are a long-running request/response communication, where the action client (requester) is waiting for the action server (the responder) to take some action and return a result
- provide feedback while they are happening, and can be interrupted.
<request_type> <request_fieldname>
---
<response_type> <response_fieldname>
---
<feedback_type> <feedback_fieldname>
For example:
int32 order
---
int32[] sequence
---
int32[] sequence
- request (goal): client is sending a single int32 field
- response (result): action server to produce an array of int32
- feedback: action server may also provide an intermediate array of int32 containing the steps accomplished up until a certain point.
Top comments (0)