Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(how-to-guides): add instructions for package customization based on Autoware #277

Merged
merged 13 commits into from
Dec 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions docs/how-to-guides/integrating-autoware-with-your-vehicle.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,80 @@ Now the vehicle should drive along the calculated path!

You may need to tune your parameters depending on the domain in which you will operate your vehicle.

## 8. Customize your own package based on Autoware-msgs / Autoware-package

In many practical applications, apart from the available nodes / modules of Autoware, you may have the need to create your own packages which communicate with Autoware nodes or utilize some Autoware implementations (such like math methods including A-star, interpolation, mpc algorithm and so on). In this case, you can follow the instructions below to customize your specific package.

### Package using Autoware-msgs

Since Autoware is built on ROS (Autoware Universe / Autoware Core on ROS 2), if you have the urge to communicate with other Autoware nodes, then you are supposed to obey the rule of node subscribing / publishing messages via topic in specified message type. For details, refer to the [ROS Tutorial](https://docs.ros.org/en/humble/Tutorials.html).

If you are already experienced at ROS, then it's simple to do such an extension just like the following example. Here, as mentioned in section 5.1 above, how could vehicle interface package (such as driving-by-wire module) receives the control command? You can do:

- Put the "autoware_auto_control_msgs" in your project with your own packages together
- Add the "depend" tag in "package.xml" of your package which receives the control command

```xml
<depend>autoware_auto_control_msgs</depend>
```

- Add message path in "CMakeLists.txt"

```cmake
find_package(autoware_auto_control_msgs)
```

- Include the header file of the message type and start coding

```cpp
#include <autoware_auto_control_msgs/msg/ackermann_control_command.hpp>
```

### Package using Autoware-package

For the current Autoware Universe (or Autoware Core later) based on ROS 2, the DDS (data distribution service) is applied as the middleware for real-time communication. Thus, it is not necessary for you to use ROS 2 for customization, as long as your platform has the ability to utilize the same DDS middleware to communicate with Autoware nodes. More in details, the extension could be divided into 2 aspects:

kenji-miyake marked this conversation as resolved.
Show resolved Hide resolved
- [Customization in ROS 2](#customization-in-ros-2)

- [Customization in other platforms](#customization-in-other-platforms)

#### Customization in ROS 2

In this case, the extension is just as simple as above. Here, the package "interpolation" is used as an example:

- Put the "interpolation" in your project with your own packages together
- Add the "depend" tag in "package.xml" of your package which receives the control command

```xml
<depend>interpolation</depend>
```

- Add message path in "CMakeLists.txt"

```cmake
find_package(interpolation)
```

- Include the header file of the message type and start coding

```cpp
#include "interpolation/linear_interpolation.hpp"
```

#### Customization in other platforms

In this case, the compiled package shall be considered as a dynamic link library and could be linked with any project. You can configure the compile options, for example in "CMakeLists.txt":

```cmake
target_include_directories(${node_name} PRIVATE /autoware/install/interpolation/include)
target_link_directories(${node_name} PRIVATE /autoware/install/interpolation/lib)
target_link_libraries(${node_name} PUBLIC interpolation)
```

Remember to replace the "${node_name}" with the correct name. And then you can include the header file and start coding

```cpp
#include "interpolation/linear_interpolation.hpp"
```

If you have any issues or questions, feel free to create an [Autoware Foundation GitHub Discussion](https://github.com/orgs/autowarefoundation/discussions) in the Q&A category!