micro-ROS / micro_ros_arduino

micro-ROS library for Arduino
Apache License 2.0
452 stars 117 forks source link

How to get an error message when rcl_ret_t is 1? #1880

Open JamesTann opened 1 day ago

JamesTann commented 1 day ago

How to get an error message when rcl_ret_t is 1?

Note: This is not an issue, just a question, so my apologies if this is not the right place to ask it.

I modeled this macro after the RCCHECK one used throughout the examples:

#define RCCHECK(fn)              \
  {                              \
    rcl_ret_t temp_rc = fn;      \
    if ((temp_rc != RCL_RET_OK)) \
    {                            \
      ros_error(temp_rc);        \
    }                            \
  }

Which calls this function:

void ros_error(const int temp_rc)
{
  Serial.println("Error code encountered from ROS: " + String(temp_rc));
  Serial.println(rcl_get_error_string().str);
  rcutils_reset_error();
  NVIC_SystemReset();
}

However, when I encounter an error, I see this garbled output:

Output: image

What is the proper way of getting a more specific error message?

Note: I am communicating to the Micro ROS Agent using ethernet, so my understanding is that I can safely using serial for debugging

pablogs9 commented 14 hours ago

Hello @JamesTann, I should check, but the RCL reporting mechanism for reporting errors is probably disabled in micro-ROS for saving memory.

metanav commented 13 hours ago

Hi @pablogs9,

I am having similar issue so I am not creating a new issue. How can we enable the debug/error messages reporting?

PS: I am already using the docker to generate precompiled library.