This is a general overview, and for the most part aims be version independent. However, this documentation was made with reference to Humble Hawksbill's wiki.
A node can be thought of a fundamental unit that is built for one specific task. Nodes communicate through a variety of methods, but they all involve something called an interface.
A node can be configured using parameters. We can dump and load parameters. Parameter files are to be stored in YAML format.
Nodes on a network with the same domain ID are able to discover other nodes. Domain IDs can range from 0 to 101 both inclusive, and are used to calculate ports for communication.
A topic can be thought of as a hub for transferring data. A node can publish data to a topic, and subscribe to a topic to receive data. This data is often called a message.
The format for a message is
<variable_type1> <variable_name1>
<variable_type2> <variable_name2>
Services are like topics but they use a request-response paradigm. There can only be one service server, which can respond to multiple service clients. Each service has types that describe the structure of a request message and a response message. Suitable for short running procedures, you call a service, and an action is performed, nothing else.
The interface format for a service is
<request_message_format>
---
<response_message_format>
Actions are like services, but they provide realtime feedback and can be cancelled midway. They are suitable as long running "services".
The interface format is
<goal>
---
<request>
---
<feedback>
A ROS2 workspace contains packages, build files, logs and more, all in one folder. The src
folder in a workspace contains packages.
rosdep
is a python package that uses package.xml
to identify dependencies and install them. It doesn't install them itself (like apt
would) but uses the system package manager. The xml tags it looks for are -
<depend>
for deps that are required at both build and run times<build_depend>
for deps that are required at build time<build_export_depend>
for deps that will be required by an exported header file. (If we export a header that imports some other header, we list the other header here)<exec_depend>
for deps that are required at run time<test_depend>
for deps that are required only during testingA package is a unit of self contained code, which can be released for others to use if wanted. A barebones Python package looks like this -
workspace/src/
package_name/
package.xml
resource/package_name
setup.cfg
setup.py
my_package/
Creating a package involved the following steps
ros2 pkg create
package.xml
. This is done automatically if the --dependencies
flag is used during the previous commandws/src/pkg_name/pkg_name
. There should be a __init__.py
file in that directorymain
function from this newly written file as an entry point in setup.py
like so script_name = pkg_name.filename_without_ext:main