# Building PX4-ROS2 bridge on hardware? (Pixhawk 4)

**URL:** <https://discuss.px4.io/t/building-px4-ros2-bridge-on-hardware-pixhawk-4/24266>\
**Category:** ROS 1 / ROS 2\
**Created:** [September 20, 2021, 8:51pm UTC](https://discuss.px4.io/t/building-px4-ros2-bridge-on-hardware-pixhawk-4/24266 "2021-09-20T20:51:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nsimon](https://discuss.px4.io/user_avatar/discuss.px4.io/nsimon/32/8784_2.png) [@nsimon](https://discuss.px4.io/u/nsimon)\
**Post date:** [September 20, 2021, 8:51pm UTC](https://discuss.px4.io/t/building-px4-ros2-bridge-on-hardware-pixhawk-4/24266/1 "2021-09-20T20:51:50Z")

</div>

Hello all,

I’ve had some success with SITL: creating ROS2 bridge listeners and advertisers through `px4_sitl_rtps jmavsim`. Thanks for your help there!

Next, I’d like to have the ROS2 bridge code running on Pixhawk 4 hardware. I understand that I should upload a custom .px4 firmware file, but I’m not sure how to generate the correct one. I can `make px4_fmu-v5_rtps` and upload the resulting .px4 file; however, it doesn’t seem to capture the most up-to-date settings on the ROS2 bridge (e.g., the .yaml send and recieve labels, or `micrortps_client` starting automatically). Messages are not being transmitted or received via the ROS2 bridge using `px4_fmu-v5_rtps.px4`.

Is there any guidance on the right way to configure the ROS2 bridge in hardware? The tutorials seem to focus on SITL.

---

<div class="post-metadata">

**Author:** ![nsimon](https://discuss.px4.io/user_avatar/discuss.px4.io/nsimon/32/8784_2.png) [@nsimon](https://discuss.px4.io/u/nsimon)\
**Post date:** [September 22, 2021, 3:51am UTC](https://discuss.px4.io/t/building-px4-ros2-bridge-on-hardware-pixhawk-4/24266/2 "2021-09-22T03:51:57Z")

</div>

(SOLVED) with reference to [Micrortps\_client does not receive uorb message](https://discuss.px4.io/t/micrortps-client-does-not-receive-uorb-message/17854) and [Unable to establish FastRTPS connection with pixhawk. #38](https://github.com/PX4/px4_ros_com/issues/38).

Plug Pixhawk 4 into companion computer via USB, make and upload the firmware from the PX4-Autopilot directory:

```auto
make px4_fmu-v5_rtps
make px4_fmu-v5_rtps upload

```

Enter the `nsh>` from `~/PX4-Autopilot/Tools$`:

```auto
python3 mavlink_shell.py 

```

Start the micrortps\_client over UART instead of UDP (which works for SITL):

```auto
nsh> micrortps_client start -t UART

```

In a new terminal, source ROS2 and start the micrortps\_agent over UART:

```auto
micrortps_agent start -t UART

```

In a new terminal, source ROS2 and echo the desired topic (or run the desired listener):

```auto
ros2 topic echo /fmu/vehicle_odometry/out

```

And the vehicle\_odometry topic is printed for the Pixhawk 4 as desired. Hope this helps someone else stuck in the future!
