micro_ros_arduino icon indicating copy to clipboard operation
micro_ros_arduino copied to clipboard

docker was connected to the ESP32 by serial port, but no client created and no node was found

Open hellolixc opened this issue 1 year ago • 0 comments

  • Linux systerm:Ubuntu with ros2 humble
  • esp32 with micro-ros
  • esp32 was programmed on:platformio
  • agent:docker(after this I installed micro_ros_setup package it didn't work as well)

Steps to reproduce the issue

Destination: Esp32 publishs node, and the host computer installed with ros2 through docker can find it by serial port communication. esp32 code:

#include <Arduino.h>
#include <micro_ros_platformio.h>

#include <rcl/rcl.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>

rclc_executor_t executor;
rclc_support_t support;
rcl_allocator_t allocator;
rcl_node_t node;

void setup()
{
  Serial.begin(115200);
  // 设置通过串口进行MicroROS通信
  set_microros_serial_transports(Serial);
  // 延时时一段时间,等待设置完成
  delay(2000);
  // 初始化内存分配器
  allocator = rcl_get_default_allocator();
  // 创建初始化选项
  rclc_support_init(&support, 0, NULL, &allocator);
  // 创建节点 hello_microros
  rclc_node_init_default(&node, "hello_microros", "", &support);
  // 创建执行器
  rclc_executor_init(&executor, &support.context, 1, &allocator);
}

void loop()
{
  delay(100);
  // 循环处理数据
  rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100));
}

Terminal:

sudo docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:$ROS_DISTRO serial --dev /dev/ttyUSB0 -v6

Expected behavior

image image

Actual behavior

image

Additional information

Although docker recognized the micro-ros device, it was stuck in the logger set-up did not create client,and it is useless to press the RST key,not to mention node information is missing.

hellolixc avatar Mar 19 '24 06:03 hellolixc