micro-ROS / micro-ROS/micro_ros_arduino

How to get an error message when rcl_ret_t is 1?

Open
#1,880 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
576
Forks
146
PR merge metrics
No merged PRs in 30d

Description

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

- Hardware: Arduino Portenta
- Version: humble

_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](https://github.com/user-attachments/assets/18d9cfc3-ee0d-445c-9c19-35094f16b3b0)

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_

Contributor guide

Open the contributing guide

Research direction

Start with the RCCHECK macro and ros_error function shown in the issue, then inspect how rcl_get_error_string() and rcutils_reset_error() are used in the Arduino examples. Reproduce rcl_ret_t value 1 on an Arduino Portenta and determine what output should be emitted; done means obtaining a specific, readable error message.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, c
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.