# How to use ROS2 with the Control Allocation Module

**URL:** <https://discuss.px4.io/t/how-to-use-ros2-with-the-control-allocation-module/23187>\
**Category:** ROS 1 / ROS 2\
**Created:** [July 7, 2021, 7:09pm UTC](https://discuss.px4.io/t/how-to-use-ros2-with-the-control-allocation-module/23187 "2021-07-07T19:09:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mason\_Peterson](https://discuss.px4.io/user_avatar/discuss.px4.io/mason_peterson/32/8926_2.png) [@Mason\_Peterson](https://discuss.px4.io/u/Mason_Peterson)\
**Post date:** [July 7, 2021, 7:09pm UTC](https://discuss.px4.io/t/how-to-use-ros2-with-the-control-allocation-module/23187/1 "2021-07-07T19:09:37Z")

</div>

Hi! I am working on a project that uses ROS2 talking with PX4 code via the microRTPS bridge. I am hoping to be able to use my ROS2 nodes in conjunction with the Control Allocation module. However, I am not sure how to get PX4 to use both the microRTPS bridge and control allocation.

When I run `make list_config_targets | grep ctrlalloc`, I only see:

```auto
px4_fmu-v5_ctrlalloc
px4_sitl_ctrlalloc

```

So, it looks like there isn’t a target to use both control allocation and RTPS protocol. If this is correct, could someone help me with knowing how to started in adding this capability?

---

<div class="post-metadata">

**Author:** ![TSC21](https://discuss.px4.io/user_avatar/discuss.px4.io/tsc21/32/4866_2.png) [@TSC21](https://discuss.px4.io/u/TSC21)\
**Post date:** [July 7, 2021, 7:23pm UTC](https://discuss.px4.io/t/how-to-use-ros2-with-the-control-allocation-module/23187/2 "2021-07-07T19:23:51Z")

</div>

You can easily extend one of those targets so to build also the micrortps\_bridge (and the protocol\_splitter if required), which is what the \_rtps target adds. Example: [PX4-Autopilot/rtps.cmake at master · PX4/PX4-Autopilot · GitHub](https://github.com/PX4/PX4-Autopilot/blob/master/boards/px4/fmu-v5/rtps.cmake#L79).

---

<div class="post-metadata">

**Author:** ![Mason\_Peterson](https://discuss.px4.io/user_avatar/discuss.px4.io/mason_peterson/32/8926_2.png) [@Mason\_Peterson](https://discuss.px4.io/u/Mason_Peterson)\
**Post date:** [July 7, 2021, 8:50pm UTC](https://discuss.px4.io/t/how-to-use-ros2-with-the-control-allocation-module/23187/3 "2021-07-07T20:50:40Z")

</div>

I see now, thank you! I just uncommented the [micrortps\_bridge in ctrlalloc.cmake](https://github.com/PX4/PX4-Autopilot/blob/master/boards/px4/sitl/ctrlalloc.cmake#:~:text=mc_rate_control-,%23micrortps_bridge,-navigator) and it works great.
