Skip to content

Publisher basic example does not work in Teensy 4.1 after receiving a new docker image micro_ros_static_library_builder Pull #1503

@ChoiYouJung

Description

@ChoiYouJung

Issue template

  • Hardware description: Teensy4.1
  • RTOS: No
  • Installation type: Arduino IDE (Version : 2.1.0)
  • Version or commit hash: humble

Steps to reproduce the issue

(1) code behavior

  • Create 1 Publisher and 1 Timer on 1 node to publish ros message
  • Using examples from micro_ros_arduino/examples/micro-ros_publisher
#include <micro_ros_arduino.h>

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

#include <std_msgs/msg/int32.h>

rcl_publisher_t publisher;
std_msgs__msg__Int32 msg;
rclc_executor_t executor;
rclc_support_t support;
rcl_allocator_t allocator;
rcl_node_t node;
rcl_timer_t timer;

#define LED_PIN 13

#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop();}}
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}


void error_loop(){
  while(1){
    digitalWrite(LED_PIN, !digitalRead(LED_PIN));
    delay(100);
  }
}

void timer_callback(rcl_timer_t * timer, int64_t last_call_time)
{  
  RCLC_UNUSED(last_call_time);
  if (timer != NULL) {
    RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));
    msg.data++;
  }
}

void setup() {
  set_microros_transports();
  
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, HIGH);  
  
  delay(2000);

  allocator = rcl_get_default_allocator();

  //create init_options
  RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));

  // create node
  RCCHECK(rclc_node_init_default(&node, "micro_ros_arduino_node", "", &support));

  // create publisher
  RCCHECK(rclc_publisher_init_default(
    &publisher,
    &node,
    ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32),
    "micro_ros_arduino_node_publisher"));

  // create timer,
  const unsigned int timer_timeout = 1000;
  RCCHECK(rclc_timer_init_default(
    &timer,
    &support,
    RCL_MS_TO_NS(timer_timeout),
    timer_callback));

  // create executor
  RCCHECK(rclc_executor_init(&executor, &support.context, 1, &allocator));
  RCCHECK(rclc_executor_add_timer(&executor, &timer));

  msg.data = 0;
}

void loop() {
  delay(100);
  RCSOFTCHECK(rclc_executor_spin_so

Expected behavior

  • 1 timer publishes a ROS message every second.

Actual behavior

  • Confirm that 1 publisher is created.
  • The message is not published.

Additional information

  • The operating system of the Arduino IDE is Windows 10.

  • In WSL, the precompiled library was built by referring to the following address.
    - Reference address 1 : https://github.com/micro-ROS/micro_ros_arduino
    - Reference address 2 : https://hub.docker.com/r/microros/micro_ros_static_library_builder

  • After updating the microros/micro_ros_static_library_builder Docker image using the Docker Pull command around 23.08.17, the code does not work.

  • The existing image was used around 23.06.29 using the Docker Pull command.

  • Question: Are there any changes to microros/micro_ros_static_library_builder Docker between 23.06.29 and 23.08.17? Also, is there any cause of the problem that you know about this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions