Skip to content

Commit

Permalink
feat(how-to-guides): add instructions for package customization based…
Browse files Browse the repository at this point in the history
… on Autoware (#277)

* feat: add a new lidar-camera-calibration tool

Signed-off-by: JianKang <egon.kang@autocore.ai>

* style(pre-commit): autofix

* feat: add a new lidar-camera-calibration tool

Signed-off-by: JianKang <egon.kang@autocore.ai>

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

Signed-off-by: JianKang <egon.kang@autocore.ai>

* style(pre-commit): autofix

* feat(how-to-guides): update customization package extension

Signed-off-by: JianKang <egon.kang@autocore.ai>

* style(pre-commit): autofix

* feat(how-to-guides): update customization package

Signed-off-by: JianKang <egon.kang@autocore.ai>

* style(pre-commit): autofix

Signed-off-by: JianKang <egon.kang@autocore.ai>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
JianKangEgon and pre-commit-ci[bot] authored Dec 13, 2022
1 parent 6fb7c32 commit ea9d8dc
Showing 1 changed file with 76 additions and 0 deletions.
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:

- [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!

0 comments on commit ea9d8dc

Please sign in to comment.