Building micro_ros_agent inside docker container

I’ve alredy read this thred but it doesn’t helpd me.

I’m using JetPack Version: 4.4.1-b50 (is there instructions to update to 4.6?) and dustynv/ros:humble-ros-base-l4t-r32.7.1 base image.
the part of my Dockerfile that faild is:

RUN git clone -b humble https://github.com/micro-ROS/micro_ros_setup.git src/micro_ros_setup && \
    # sudo rosdep fix-permissions && \
    rosdep update && \
    rosdep install --from-paths src --ignore-src -y && \
    colcon build

I get:

ERROR: the following packages/stacks could not have their rosdep keys resolved to system dependencies:
micro_ros_setup: No definition of [ament_cmake] for OS version [bionic]

Thank!

Hi,

ros:humble-ros-base requrires L4T >=32.6 so please upgrade your environment into JetPack >= 4.6.

Thanks.

Hello, I’ve updated my system following this steps, the ones under “To update to a new minor release”
Now I have:

Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 4.9.337-tegra aarch64)

elgarbe@jetson:~$ head -1 /etc/nv_tegra_release
# R32 (release), REVISION: 7.4, GCID: 33514132, BOARD: t210ref, EABI: aarch64, DATE:Fri Jun  9 04:25:08 UTC 2023
elgarbe@jetson:~$ sudo apt-cache show nvidia-jetpack
Package: nvidia-jetpack
Version: 4.6.4-b39

Is my system updated correctly?

Now, I use the following:

elgarbe@jetson:~$ docker run --privileged --runtime nvidia -it --rm --network=bridge dustynv/ros:humble-ros-base-l4t-r32.7.1
sourcing   /opt/ros/humble/install/setup.bash
ROS_DISTRO humble
ROS_ROOT   /opt/ros/humble
root@a3b2e6157c59:/# apt-mark hold '*opencv*' && apt-get update && apt dist-upgrade -y
.......
root@a3b2e6157c59:/#

I have to use bridge network in this case in order to have internet connection inside the container, I’m not sure why.
Then follow the steps to build micro_ros agent from here:

root@a3b2e6157c59:/# mkdir uros_ws && cd uros_ws
root@a3b2e6157c59:/uros_ws# git clone -b humble https://github.com/micro-ROS/micro_ros_setup.git src/micro_ros_setup
Cloning into 'src/micro_ros_setup'...
remote: Enumerating objects: 3657, done.
remote: Counting objects: 100% (234/234), done.
remote: Compressing objects: 100% (139/139), done.
remote: Total 3657 (delta 145), reused 160 (delta 95), pack-reused 3423
Receiving objects: 100% (3657/3657), 856.77 KiB | 3.66 MiB/s, done.
Resolving deltas: 100% (2531/2531), done.
root@a3b2e6157c59:/uros_ws# rosdep update && rosdep install --from-paths src --ignore-src -y
reading in sources list data from /etc/ros/rosdep/sources.list.d
.....
#All required rosdeps installed successfully
root@a3b2e6157c59:/uros_ws# colcon build
Starting >>> micro_ros_setup
Finished <<< micro_ros_setup [7.66s]
Summary: 1 package finished [8.29s]
root@a3b2e6157c59:/uros_ws# source install/local_setup.bash
root@a3b2e6157c59:/uros_ws#

then continue with this steps:

root@a3b2e6157c59:/uros_ws# ros2 run micro_ros_setup create_agent_ws.sh
..
=== ./uros/micro-ROS-Agent (git) ===
Cloning into '.'...
=== ./uros/micro_ros_msgs (git) ===
Cloning into '.'...
#All required rosdeps installed successfully
root@a3b2e6157c59:/uros_ws#

I take this issue

root@a3b2e6157c59:/uros_ws# ros2 run micro_ros_setup build_agent.sh
Building micro-ROS Agent
Starting >>> micro_ros_msgs
Finished <<< micro_ros_msgs [3.30s]
Starting >>> micro_ros_agent
--- stderr: micro_ros_agent
/uros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.4.1: undefined reference to `typeinfo for fmt::v7::format_error'
/uros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.4.1: undefined reference to `spdlog::details::log_msg::log_msg(spdlog::source_loc, fmt::v7::basic_string_view<char>, spdlog::level::level_enum, fmt::v7::basic_string_view<char>)'
/uros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.4.1: undefined reference to `void fmt::v7::detail::vformat_to<char>(fmt::v7::detail::buffer<char>&, fmt::v7::basic_string_view<char>, fmt::v7::basic_format_args<fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<fmt::v7::type_identity<char>::type>, fmt::v7::type_identity<char>::type> >, fmt::v7::detail::locale_ref)'
/uros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.4.1: undefined reference to `fmt::v7::detail::error_handler::on_error(char const*)'
/uros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.4.1: undefined reference to `fmt::v7::detail::basic_data<void>::left_padding_shifts'
/uros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.4.1: undefined reference to `std::locale fmt::v7::detail::locale_ref::get<std::locale>() const'
/uros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.4.1: undefined reference to `vtable for fmt::v7::format_error'
/uros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.4.1: undefined reference to `fmt::v7::format_error::~format_error()'
collect2: error: ld returned 1 exit status
make[2]: *** [micro_ros_agent] Error 1
make[1]: *** [CMakeFiles/micro_ros_agent.dir/all] Error 2
make: *** [all] Error 2
---                                                                                                                                                                                                              Failed   <<< micro_ros_agent [2.17s, exited with code 2]
Summary: 1 package finished [6.02s]
1 package failed: micro_ros_agent
1 package had stderr output: micro_ros_agent
Traceback (most recent call last):
File "/opt/ros/humble/install/bin/ros2", line 33, in <module>
sys.exit(load_entry_point('ros2cli==0.18.7', 'console_scripts', 'ros2')())
File "/opt/ros/humble/install/lib/python3.6/site-packages/ros2cli/cli.py", line 89, in main
rc = extension.main(parser=parser, args=args)
File "/opt/ros/humble/install/lib/python3.6/site-packages/ros2run/command/run.py", line 70, in main
return run_executable(path=path, argv=args.argv, prefix=prefix)
File "/opt/ros/humble/install/lib/python3.6/site-packages/ros2run/api/__init__.py", line 73, in run_executable
if -process.returncode in signal.valid_signals() and os.name == 'posix':
AttributeError: module 'signal' has no attribute 'valid_signals'
root@a3b2e6157c59:/uros_ws#

but the problem continue after adding the flag to colcon build.

Any advice?

Thank

Ok, I’ve managed to make it work.
I left the files here for future references:

Dockerfile:

FROM dustynv/ros:humble-ros-base-l4t-r32.7.1

RUN mkdir -p /home/microros_ws
WORKDIR /home/microros_ws

RUN mkdir src \
    && git -C src clone -b $ROS_DISTRO https://github.com/micro-ROS/micro-ROS-Agent.git \
    && git -C src clone -b $ROS_DISTRO https://github.com/micro-ROS/micro_ros_msgs.git  \
    && . /opt/ros/$ROS_DISTRO/install/setup.sh \
    &&  apt update \
    &&  apt install -y python3-pip \
    libspdlog-dev \
    libfmt-dev \
    &&  apt autoremove -y \
    &&  sudo rosdep fix-permissions \
    &&  rosdep update \
    &&  rosdep install --from-paths src --ignore-src -y \
    &&  colcon build --cmake-args -DUAGENT_BUILD_EXECUTABLE=OFF -DUAGENT_P2P_PROFILE=OFF -DUAGENT_USE_SYSTEM_LOGGER=ON --no-warn-unused-cli \
    &&  rm -rf log/ build/ src/* \
    &&  rm -rf /var/lib/apt/lists/*

ENV RMW_IMPLEMENTATION=rmw_fastrtps_cpp

COPY ros_entrypoint.sh /

ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]

docker-compose.yaml

version: '3.4'
services:
  robot:
    network_mode: "host"
    privileged: true
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    command: ros2 run micro_ros_agent micro_ros_agent serial -v --dev /dev/ttyACM0

ros_entrypoint.sh

#!/bin/bash
set -e
source /opt/ros/humble/install/setup.bash
source /home/microros_ws/install/setup.bash
exec "$@"

Then run this command on jetson nano:

docker-compose up --build

and after building the image it will start micro-ros-agent.
The use of docker-compose will allow us to run other packages.

Thank and best regards

Good to know it works now.
Thanks for the feedback.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.