Skip to content

Commit d666324

Browse files
Tomas BacaTomas Baca
authored andcommitted
updated docs
1 parent c1bb218 commit d666324

2 files changed

Lines changed: 46 additions & 3 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: ROS2 CmakeLists
3+
pagination_label: ROS2 CmakeLists
4+
description: ROS2 CmakeLists
5+
---
6+
7+
# ROS2 CmakeLists
8+
9+
## `include_directories()`
10+
11+
In ROS2 you have to explicitly list all the packages you are including from:
12+
```
13+
...
14+
include_directories(
15+
...
16+
${mrs_lib_INCLUDE_DIRS}
17+
${<some_other_package>_INCLUDE_DIRS}
18+
}
19+
```
20+
21+
## exporting nodeletes (components)
22+
23+
Components are declared in CmakeLists, instead of package.xml (like it was in ROS1):
24+
```
25+
rclcpp_components_register_nodes(MrsMultirotorSimulator_Simulator PLUGIN "mrs_multirotor_simulator::MultirotorSimulator" EXECUTABLE MrsMultirotorSimulator_Simulator)
26+
```
27+
28+
## exporting pluginlib plugins
29+
30+
You need to provide path to the `.xml` file with plugin description in CmakeLists, instaed of in `package.xml` like it was in ROS1:
31+
```
32+
# <package of the base class>, <relative path to the xml>
33+
pluginlib_export_plugin_description_file(mrs_uav_hw_api plugins.xml)
34+
```
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
---
2-
title: C++ componentts
3-
pagination_label: C++ componentes
4-
description: C++ components
2+
title: C++ components (nodelets)
3+
pagination_label: C++ componentes (nodelets)
4+
description: C++ components (nodelets)
55
---
6+
7+
# `onInit()`
8+
9+
There is no onInit() method like in ROS1.
10+
Now, you need to implement the constructor of `rclcpp::Node()`.
11+
12+
However, you cannot obtain a pointer to the node in the constructor (while it is still running).
13+
Therefore, we create our own `initialize()` method as a one-shot timer that contain most of the init routines.
14+
We can use the constructor solely for starting the timer.

0 commit comments

Comments
 (0)