Ask Your Question
1

Micro-ros something like node get_logger?

asked 2021-02-17 13:28:55 -0500

PaddyCube gravatar image

Hello,

As we all know, we can use the get_logger() method of a ros2 node to send certain messages for debug purposes ans others. And we can display all log messages in rqt and other tools.

I was unable to find something similar on micro-ros and wondering if it exists. Or do I need to publish String message to a topic and transform it to a log message in a dedicated node on my pc (like a bridge)?

The reason I'm asking is I run micro-ros on an esp32 device which is connected to the real robot firmware and Hardware using serial connection. Meaning esp32 acts as the bridging point between proprietary robot firmware and ros2 ecosystem. Esp32 read serial data and publishes messages. Also ot subscribes to some topics and translate them to serial commands.

The proprietary firmware can raise error messages, if a sensor fails for example, and I want to propagonate this error message to ros2.

Patrick

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-02-18 00:32:50 -0500

Pablogs gravatar image

Hello @PaadyCube, by now micro-ROS does not have by now anything similar to get_logger() but we are interested in having this feature.

Is possible for you to open an issue in some of our Github repos so we can discuss this matter and evaluate the feasibility of implementing this feature?

edit flag offensive delete link more

Comments

I have been checking and publishing to the common logger ROS2 system is just publishing in /rosout [rcl_interfaces/msg/Log]. For sure we can prepare some solution for using this feature in micro-ROS.

Please open the issue and let's talk.

Pablogs gravatar image Pablogs  ( 2021-02-18 00:53:12 -0500 )edit

Hello, so it seems there is already a solution by publishing to topic /rosout? Good to know. However I created an issue at micro-ros diagnostic as it seems to me that it fits best here

BR Patrick

PaddyCube gravatar image PaddyCube  ( 2021-02-19 12:40:27 -0500 )edit

Meanwhile I tried to publish to rosout topic by myself but I had no luck.

#include <rcl_interfaces/msg/log.h>

rcl_publisher_t publisher_log;
rcl_interfaces__msg__Log msgLog;

// create publisher
RCCHECK(rclc_publisher_init_default(
    &publisher_log,
    &node,
    ROSIDL_GET_MSG_TYPE_SUPPORT(rcl_interfaces, msg, Log),
    "rosout"));


    msgLog.level = rcl_interfaces__msg__Log__INFO;
    msgLog.name.data = (char *)"ESP32 ";
    msgLog.name.size = strlen(msgLog.name.data);
    msgLog.msg.data = (char *)"Hello World";
    msgLog.msg.size = strlen(msgLog.msg.data);
    RCSOFTCHECK(rcl_publish(&publisher_log, &msgLog, NULL));

Everything compiles without any warning and I'm able to flash. During execution, it fails when creating the publisher with this error message

Any ideas of what's going wrong?

PaddyCube gravatar image PaddyCube  ( 2021-03-02 13:03:14 -0500 )edit
PaddyCube gravatar image PaddyCube  ( 2021-03-02 13:03:42 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-02-17 13:28:55 -0500

Seen: 279 times

Last updated: Feb 18 '21