# Custom Ros 2 messages

**URL:** <https://forums.developer.nvidia.com/t/custom-ros-2-messages/247035>\
**Category:** Isaac Sim\
**Tags:** kb\
**Created:** [March 22, 2023, 3:11pm UTC](https://forums.developer.nvidia.com/t/custom-ros-2-messages/247035 "2023-03-22T15:11:55Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![dgarcialopez](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/dgarcialopez/32/239202_2.png) [@dgarcialopez](https://forums.developer.nvidia.com/u/dgarcialopez)\
**Post date:** [March 30, 2023, 10:19pm UTC](https://forums.developer.nvidia.com/t/custom-ros-2-messages/247035/13 "2023-03-30T22:19:57Z")

</div>

@christianbarcelo I’m using Humble (python 3.10) in Ubuntu 22.04.

I recommend you to compile it using a docker image to avoid messing up your local python installation. I’m gonna use [ackermann\_msgs](https://github.com/ros-drivers/ackermann_msgs.git) package as a reference:

```auto
# Run docker container with ROS2 Humble
docker pull osrf/ros:humble-desktop
docker run -it osrf/ros:humble-desktop

# Install Python 3.7
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7

# Link Python 3.7 as default
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
sudo update-alternatives --set python3 /usr/bin/python3.7

# Verify that the default python version is now 3.7
python3 --version

# Create a ros workspace
mkdir -p /ros2_ws/src
cd /ros2_ws/src

# Clone the pkg you want to compile, using ackermann_msgs repo as reference
git clone -b ros2 https://github.com/ros-drivers/ackermann_msgs.git

# Install distutils as is needed for colcon
sudo apt install python3.7-distutils

# Build the workspace
cd /ros2_ws
colcon build

```

This should build correctly for simple msg packages. However, I tried with `moveit_msgs` and because it has other dependencies I couldn’t resolve the issues.

You can move the build files to your local machine as follows:

```auto
# Get the DOCKER ID of the current image running
docker ps -alq

# Copy the build folder in the folder ~/python3.7_build of your local machine
docker cp DOCKERID:/ros2_ws/build/ackermann_msgs ~/python3.7_build

```

Then move the binary files (.so) into `~/.local/share/ov/pkg/isaac_sim-2022.2.1/exts/omni.isaac.ros2_bridge-humble/bin ` .

Finally, you should modify `omni.add_on.ros2_bridge-humble/config/extension.toml` as explained [here](https://forums.developer.nvidia.com/t/publishing-ros2-custom-message-from-omniverse/212959/2). Although I’m stuck in this step.

@toni.sm mentioned the file `... __python.so` which doens’t appear in my build. I only have `...__ rosidl_generator_py.so` under `rosidl_generato_py/ackermann_msgs` folder. I tried moving it also to `/bin` and to `extension.toml` but the package is not detected in python anyways.

I hope that helps. I finally opted to simplify the message sent to one recognized by ros isaac, but if you make it work, let me know!

---

_[View the full topic](https://forums.developer.nvidia.com/t/custom-ros-2-messages/247035)._
