This is my first time setting up a micro-ROS and a ROS 2 dev environment, so I suspect there may be something obvious that I'm missing.
I'm attempting to run the Zephyr host emulator example in the micro-ROS tutorial here with ROS2 humble.
Effectively, I've installed micro_ros_setup
, created/configured/built the firmware and installed micro_ros_agent
. Then, when I run the zephyr app I see the error listed in the title, and I don't see any change in the output of the micro-ROS agent.
What I think I'm encountering is that the Zephyr app is unable to reach the micro-ROS agent, thus the "Failed status" error message.
From a third terminal I can see the port with netstat
, so I don't believe this is a firewall issue since the host emulator and micro-ros agent are both running on the same machine.
$ sudo netstat -tulpn | grep 8888
udp 0 0 0.0.0.0:8888 0.0.0.0:* 78240/micro_ros_age
Inspecting the source code at firmware/zephyr_apps/apps/ping_pong/src/main.c
, line 98, it appears as though rclc_support_init()
is failing.
// create init_options
RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));
Additionally, should I see a node running and new topics listed when I run the micro-ROS agent? I'm seeing neither and I wonder if that's the reason:
$ ros2 topic list
/parameter_events
/rosout
$ ros2 node list
Zephyr Tutorial
Below is a summary of Zephyr micro-ROS tutorial to show where I'm at and how I got here.
Start with micro_ros_setup
source /opt/ros/humble/setup.bash
# install micro_ros_setup in new workspace
git clone -b $ROS_DISTRO https://github.com/micro-ROS/micro_ros_setup.git src/micro_ros_setup
# rosdep & pip
sudo apt update && rosdep update
rosdep install --from-paths src --ignore-src -y
sudo apt-get install python3-pip
# build micro_ros_setup and source it
colcon build
source install/local_setup.bash
Then the firmware workspace
# create fw ws
ros2 run micro_ros_setup create_firmware_ws.sh zephyr host
# configure build
ros2 run micro_ros_setup configure_firmware.sh ping_pong --transport udp --ip 127.0.0.1 --port 8888
# build it
ros2 run micro_ros_setup build_firmware.sh
Next, the micro-ROS agent
# create agent ws
ros2 run micro_ros_setup create_agent_ws.sh
# build it
ros2 run micro_ros_setup build_agent.sh
source install/local_setup.bash
Then I setup 2 terminals, terminal 1 running the micro-ROS agent and terminal 2 running the Zephyr app.
Terminal 1:
$ source /opt/ros/humble/setup.bash
$ source install/local_setup.bash
$ ros2 run micro_ros_agent micro_ros_agent udp4 --port 8888 -v -m rtps
[1704166624.989047] info | UDPv4AgentLinux.cpp | init | running... | port: 8888
[1704166624.989864] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4
Terminal 2
$ source /opt/ros/humble/setup.bash
$ source install/local_setup.bash
$ ros2 run micro_ros_setup flash_firmware.sh
Flashing firmware for zephyr platform host
WARNING: Using a test - not safe - entropy source
*** Booting Zephyr OS build zephyr-v2.6.0 ***
Failed status on line 98: 1. Aborting.