Skip to content

Commit 9de61c3

Browse files
author
Murilo Marinho
committed
[sas_robot_driver_myrobot] Added the initial node snipped.
1 parent f9f5c0d commit 9de61c3

File tree

1 file changed

+85
-29
lines changed

1 file changed

+85
-29
lines changed

docs/source/sas/sas_robot_driver_add_new_robot.rst

Lines changed: 85 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ Package-related sources
6464
├── launch
6565
│   └── real_robot_launch.py
6666
├── package.xml
67+
├── scripts
68+
│   └── joint_interface_example.py
6769
└── src
6870
├── sas_robot_driver_myrobot.cpp
6971
└── sas_robot_driver_myrobot_node.cpp
7072
71-
7273
The files already exist, we just need to modify them as follows
7374

7475
.. tab-set::
@@ -103,7 +104,7 @@ Making your own ``sas`` robot drivers
103104
#. :file:`src/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.
104105
#. :file:`src/sas_robot_driver_myrobot_node.cpp`.
105106

106-
Create all relevant files
107+
Let's create all the files used in the remainder of this tutorial.
107108

108109
.. code-block:: console
109110
@@ -124,19 +125,21 @@ The robot driver class
124125
.. admonition:: In this step, we'll work on these.
125126

126127
.. code-block:: console
127-
:emphasize-lines: 5,10
128-
129-
└── sas_robot_driver_myrobot
130-
├── CMakeLists.txt
131-
├── include
132-
│   └── sas_robot_driver_myrobot
133-
│   └── sas_robot_driver_myrobot.hpp
134-
├── launch
135-
│   └── real_robot_launch.py
136-
├── package.xml
137-
└── src
138-
├── sas_robot_driver_myrobot.cpp
139-
└── sas_robot_driver_myrobot_node.cpp
128+
:emphasize-lines: 5,12
129+
130+
└── sas_robot_driver_myrobot
131+
├── CMakeLists.txt
132+
├── include
133+
│   └── sas_robot_driver_myrobot
134+
│   └── sas_robot_driver_myrobot.hpp
135+
├── launch
136+
│   └── real_robot_launch.py
137+
├── package.xml
138+
├── scripts
139+
│   └── joint_interface_example.py
140+
└── src
141+
├── sas_robot_driver_myrobot.cpp
142+
└── sas_robot_driver_myrobot_node.cpp
140143
141144
The example class file has two important design choices to note.
142145

@@ -161,32 +164,63 @@ don't have to worry about source files specific to the robot and that your packa
161164

162165
.. tab-item:: sas_robot_driver_myrobot.cpp
163166

164-
:download:`sas_robot_driver_myrobot.cpp <../../../sas_tutorial_workspace/src/sas_robot_driver_myrobot/src/sas_robot_driver_myrobot.cpp`
167+
:download:`sas_robot_driver_myrobot.cpp <../../../sas_tutorial_workspace/src/sas_robot_driver_myrobot/src/sas_robot_driver_myrobot.cpp>`
165168

166169
.. literalinclude:: ../../../sas_tutorial_workspace/src/sas_robot_driver_myrobot/src/sas_robot_driver_myrobot.cpp
167170
:language: cpp
168171
:linenos:
169172
:lines: 25-
170173

174+
Writing the ROS2 Node
175+
---------------------
176+
177+
.. admonition:: In this step, we'll work on this.
178+
179+
.. code-block:: console
180+
:emphasize-lines: 13
181+
182+
└── sas_robot_driver_myrobot
183+
├── CMakeLists.txt
184+
├── include
185+
│   └── sas_robot_driver_myrobot
186+
│   └── sas_robot_driver_myrobot.hpp
187+
├── launch
188+
│   └── real_robot_launch.py
189+
├── package.xml
190+
├── scripts
191+
│   └── joint_interface_example.py
192+
└── src
193+
├── sas_robot_driver_myrobot.cpp
194+
└── sas_robot_driver_myrobot_node.cpp
195+
196+
:download:`sas_robot_driver_myrobot_node.cpp <../../../sas_tutorial_workspace/src/sas_robot_driver_myrobot/src/sas_robot_driver_myrobot_node.cpp>`
197+
198+
.. literalinclude:: ../../../sas_tutorial_workspace/src/sas_robot_driver_myrobot/src/sas_robot_driver_myrobot_node.cpp
199+
:language: cpp
200+
:linenos:
201+
:lines: 1-
202+
171203
Contents of the launch file
172204
---------------------------
173205

174206
.. admonition:: In this step, we'll work on this.
175207

176208
.. code-block:: console
177-
:emphasize-lines: 7
178-
179-
└── sas_robot_driver_myrobot
180-
├── CMakeLists.txt
181-
├── include
182-
│   └── sas_robot_driver_myrobot
183-
│   └── sas_robot_driver_myrobot.hpp
184-
├── launch
185-
│   └── real_robot_launch.py
186-
├── package.xml
187-
└── src
188-
├── sas_robot_driver_myrobot.cpp
189-
└── sas_robot_driver_myrobot_node.cpp
209+
:emphasize-lines: 7
210+
211+
└── sas_robot_driver_myrobot
212+
├── CMakeLists.txt
213+
├── include
214+
│   └── sas_robot_driver_myrobot
215+
│   └── sas_robot_driver_myrobot.hpp
216+
├── launch
217+
│   └── real_robot_launch.py
218+
├── package.xml
219+
├── scripts
220+
│   └── joint_interface_example.py
221+
└── src
222+
├── sas_robot_driver_myrobot.cpp
223+
└── sas_robot_driver_myrobot_node.cpp
190224
191225
Running the launch file
192226
-----------------------
@@ -217,3 +251,25 @@ we created so far had any mention to topics or subscribers. All are created by :
217251
/myrobot_1/set/target_joint_velocities
218252
/parameter_events
219253
/rosout
254+
255+
Accessing through Python
256+
------------------------
257+
258+
.. admonition:: In this step, we'll work on this.
259+
260+
.. code-block:: console
261+
:emphasize-lines: 10
262+
263+
└── sas_robot_driver_myrobot
264+
├── CMakeLists.txt
265+
├── include
266+
│   └── sas_robot_driver_myrobot
267+
│   └── sas_robot_driver_myrobot.hpp
268+
├── launch
269+
│   └── real_robot_launch.py
270+
├── package.xml
271+
├── scripts
272+
│   └── joint_interface_example.py
273+
└── src
274+
├── sas_robot_driver_myrobot.cpp
275+
└── sas_robot_driver_myrobot_node.cpp

0 commit comments

Comments
 (0)