-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Logging like ros2 node.get_logger() #55
Comments
Meanwhile I tried to publish to rosout topic by myself but I had no luck.
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? |
rclc/rclc/include/rclc/types.h Line 56 in 1b8d45a
both arguments are arbitrary literals. This will output the error message set by the rclc_publisher_init_default() and reset it again.
Or print out the error message yourself using Do you have a link to your application code? As I don't see the entire setup code, just two thoughts:
|
Does it works with any other topic name that is not |
It doesn't make any difference if I change it to something else. |
Could you share the whole demo code to replicate it? |
I tried to get a more detailled error message like you mentioned but it doesn't enlight anything to me.
I'm using two tasks but all ROS related things are runnig inside the same task. Currently, I use one task to monitor all incoming uart traffic and place this into a queue. ROS task observes this queue and publishes all messages as string message. I use a timer to publish messages to rosout just for testing.
|
Are you using the micro_ros_espidf_component? Make sure that you are building the library with enough static memory allocations: If you are using micro_ros_setup check your app-colcon.meta |
Thank you for your support. You're right, I'm using esp-idf components. I wasn't aware that there is a limitation of publishers set to 1. It was working with two publishers anyway. Why was this possible? What is the overall limit of publishers and subscribers? My robot sends lot of information about different sensors at different intervalls (50ms and up to 5 sec). Also it raises events like bumper hit, cliff sensors and others, which I need to publish to ROS2. I wanted to use different messages and publishers for this. Does it mean it is not feasable with micro-ros? |
I tried to increase the max_publishers to 10 but it doesn't make any difference |
Please detail which build system are you using and detail the process of rebuilding because in some cases you need to clean some files to have a complete rebuild. |
We are getting closer I'm using idf.py at ESP-IDF v4.3-dev-2586-g526f68239 Now I'm able to create a publisher, yeah. But now it fails as soon as I try to publish a message. I'm doing it this way:
and get this errors which causes ESP32 to reboot
|
Ok, I have not replicated the issue but I have seen that the typedef struct rcl_interfaces__msg__Log
{
builtin_interfaces__msg__Time stamp;
uint8_t level;
rosidl_runtime_c__String name;
rosidl_runtime_c__String msg;
rosidl_runtime_c__String file;
rosidl_runtime_c__String function;
uint32_t line;
} rcl_interfaces__msg__Log; In micro-ROS by now you need to init all the members (at least string and sequences) in order to serialize correctly. So try to init also Let me know if this solves the issue. |
Hello pablogs9, thank you for all your support. This did the trick. For anyone who asks this, here all neccessary steps: Include Log message Create publisher
Publish message
Output of ros2 topic echo /rosout
As are limited in count of Publishers, it might doesn't make sense to include this functionality as part of rclc by default. |
I think that we should think about integrating this along the rclc/rcl in order to get a logging interface like ROS 2. Which user API will you expect to have @PaddyCube? |
Hello, I also don't understand what you mean with tracing info of inner layer. In my opinion, it should send these information:
|
Now that some time has passed: @pablogs9: would #55 (comment) still be the best/most straightforward way for a micro-ROS application to log to Or would it be possible to rely on |
That's it |
None of the functionality in Edit: what about implementing a package which provides an implementation of rcl_logging and setting |
I should recheck this, but if I remember well, most of the logging functionality is removed in micro-ROS's rcutils due to the abuse of dynamic memory in string handling. Check here: https://github.com/micro-ROS/rcutils/commits/humble
This should be possible. |
IIUC, you're mostly referring to these changes to |
yes |
Ok, so I'm struggling a bit trying to understand how With Should I be able to call There don't appear to be any Edit: @pablogs9: I'm obviously missing something, as it doesn't look like the Edit 2: calling It doesn't appear to be publishing anything though. Edit 3: afaict, Eidt 4: I've verified rcutils_log(..) gets called. Somehow only the console sink gets the message. I'm not sure why yet. |
Ok, for platforms where rcl_node_options_t node_options = rcl_node_get_default_options();
// it's not absolutely necessary to call rcl_parse_arguments(..) here, as
// logging to 'rosout' is enabled by default in 'rcl_node_options_t'
rcl_logging_configure_with_output_handler(..., rcl_logging_multiple_output_handler);
rclc_node_init_with_options(..., &node_options); at this point, calls to I believe this is essentially the (minimum) sequence of functions client libraries also call to enable logging. I've probably missed some documentation which explains this. Note: probably because I've not initialised something, calls to And you might need to set |
A ROS2 node provides a handy interface for log messages. Something like node.get_logger().info(). You all know we can view these messages in rqt and other tools.
It seems that such a function is not availabe in micro-ros
BR Patrick
see previous ticket: micro-ROS#77
see also: micro-ROS#75
@PaddyCube We are transferring all tickets/PR to ros2/rclc repository. The micro-ros organization shall only be used for feature branches based on ros2/rclc. That's why I created this ticket on ros2/rclc and closed your ticket on micro-ros/rclc.
The text was updated successfully, but these errors were encountered: