You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/sas/sas_robot_driver_add_new_robot.rst
+43-11Lines changed: 43 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,18 +90,28 @@ The files already exist, we just need to modify them as follows
90
90
:linenos:
91
91
:emphasize-lines: 10,16-132
92
92
93
+
In :file:`CMakeLists.txt` we have a sequence of four blocks. These are all directly related to ROS2 and although in
94
+
this tutorial I define a best practice, this is not particular to ``sas``.
95
+
96
+
97
+
93
98
94
99
Making your own ``sas`` robot drivers
95
100
-------------------------------------
96
101
97
102
.. admonition:: (Murilo's) ``sas_robot_driver`` best practices
98
103
99
-
For each new robot called ``myrobot`` we have
104
+
For each new robot called ``myrobot`` we have the three steps below as a must
100
105
101
106
#. :file:`sas_robot_driver_myrobot.hpp` with the driver's class definition that that inherits from ``sas_robot_driver``. This file must not include any internal driver or library files because it will be exported.
102
107
#. :file:`sas_robot_driver_myrobot.cpp` with the driver's class implementation. Any internal libraries or drivers must be included here so that they are not externally visible.
103
108
#. :file:`sas_robot_driver_myrobot_node.cpp` that configures the driver and calls the ROS2 loop.
104
109
110
+
The creation of the following two is trivial
111
+
112
+
#. :file:`real_robot_launch.py` a suitable launch file to properly configure :file:`sas_robot_driver_myrobot_node.cpp`.
113
+
#. :file:`joint_interface_example.py` a Python script to control the C++ node (if needed).
114
+
105
115
Let's create all the files used in the remainder of this tutorial.
106
116
107
117
.. code-block:: console
@@ -139,15 +149,7 @@ The robot driver class
139
149
├── sas_robot_driver_myrobot.cpp
140
150
└── sas_robot_driver_myrobot_node.cpp
141
151
142
-
The example class file has two important design choices to note.
143
-
144
-
First, we rely on the struct ``RobotDriverMyrobotConfiguration``
145
-
to simplify interaction with the constructor. This reduces the amount of code that needs to be changed if a parameter is
146
-
added or removed.
147
-
148
-
Second, we rely on the `PIMPL idiom <https://en.cppreference.com/w/cpp/language/pimpl>`_. This idiom is important to
149
-
prevent driver internals to pollute the exported header. This is a very important step to guarantee that your users
150
-
don't have to worry about source files specific to the robot and that your package is correctly self-contained.
152
+
The files in question are as follows.
151
153
152
154
.. tab-set::
153
155
@@ -169,6 +171,36 @@ don't have to worry about source files specific to the robot and that your packa
169
171
:linenos:
170
172
:lines: 25-
171
173
174
+
The example class file has two important design choices to note.
175
+
176
+
First, we rely on the struct ``RobotDriverMyrobotConfiguration``
177
+
to simplify interaction with the constructor. This reduces the amount of code that needs to be changed if a parameter is
0 commit comments