Skip to content
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

Adding a message type for Log messages that will be sent out over the… #53

Merged
merged 6 commits into from Nov 28, 2018

Conversation

nburek
Copy link
Contributor

@nburek nburek commented Nov 15, 2018

Adding a message type for Log messages that will be sent out over the rosout topic.

Issue for this request: #50

@tfoote tfoote added the in review Waiting for review (Kanban column) label Nov 15, 2018
@tfoote
Copy link
Contributor

tfoote commented Nov 15, 2018

For reference this is a migration of the rosgraph_msgs/Log in ROS1: http://docs.ros.org/melodic/api/rosgraph_msgs/html/msg/Log.html

##
## Severity level constants
##
byte DEBUG=1 #debug level
byte INFO=2  #general level
byte WARN=4  #warning level
byte ERROR=8 #error level
byte FATAL=16 #fatal/critical level
##
## Fields
##
Header header
byte level
string name # name of the node
string msg # message 
string file # file the message came from
string function # function the message came from
uint32 line # line the message came from
string[] topics # topic names that the node publishes

The primary changes are changing the constant values and dropping the topics.
I agree that dropping the topics makes sense.

The enum values have changed from a bitmask like approach to a sequential approach with padding. This is matching the values in rcutils: https://github.com/ros2/rcutils/blob/master/include/rcutils/logging.h#L156-L165
They were set in ros2/rcutils#57 to follow python's conventions: ros2/rcutils#57 (review)

Since we're using an enum and I don't believe that we're planning to support custom logging levels I'd suggest that we restore the old enum values for consistency adding 0 for UNSET.

@dirk-thomas
Copy link
Member

name of the node

This comment is only partially true. The name might be a node name but it can also be any other user defined string.

Since we're using an enum and I don't believe that we're planning to support custom logging levels I'd suggest that we restore the old enum values.

The logging system already does support arbitrary numbers in between. So the constants should match the implementation exactly. The type should be changed from byte to uint8 though since the data is actually numeric with its implicit order and not an opaque octet.

for consistency adding 0 for UNSET.

Since there is no semantic associated to 0 atm I think there shouldn't be a constant defined in the message for it.

@nburek
Copy link
Contributor Author

nburek commented Nov 15, 2018

name of the node

This comment is only partially true. The name might be a node name but it can also be any other user defined string.

I'll update the comment to mention that the field is meant to represent the name of the logger used to log this message. The logger name won't exactly match the node name anyways

Since we're using an enum and I don't believe that we're planning to support custom logging levels I'd suggest that we restore the old enum values.

The logging system already does support arbitrary numbers in between. So the constants should match the implementation exactly. The type should be changed from byte to uint8 though since the data is actually numeric with its implicit order and not an opaque octet.

I'll change the type from byte to uint8.

@mlautman
Copy link

Don't forget to add msg/Log.msg to the rosidl_generate_interfaces call

@mlautman
Copy link

Header -> std_msgs/Header

@nburek
Copy link
Contributor Author

nburek commented Nov 19, 2018

Thanks for the feedback @mlautman. I've added the Log.msg to the rosidl_generate_interface call in CMake. I've also removed the header from the Log message for now since it would add a dependency on std_msgs from common_interfaces. In the conversation on issue #50, there was a desire to not have any new dependencies added in front of rcl.

@mlautman
Copy link

Seems strange to not be able to depend on a core library like std_msgs. The header field is really useful

@dirk-thomas
Copy link
Member

Seems strange to not be able to depend on a core library like std_msgs.

That statement is taken out of context. It is undesired to add a dependency to the common_interfaces package into the rcl packages. Since the log message should continue to use a header field the std_msgs package (or maybe just that specific message) could be moved into the rcl_interfaces repo...

@nburek
Copy link
Contributor Author

nburek commented Nov 26, 2018

It may make sense for the Header message definition to be moved into rcl_interfaces. If that's the case then the Log message could add it back in as a field. However, should that be done for this pull request or should we move forward with the Log message as defined in this request and then create a new issue for the follow up work of moving either std_msgs or Header so they are part of the core dependencies?

@dirk-thomas
Copy link
Member

The Header also contains a frame id which isn't needed / used here. Therefore I would suggest to add a timestamp field instead.

@nburek
Copy link
Contributor Author

nburek commented Nov 26, 2018

The Header also contains a frame id which isn't needed / used here. Therefore I would suggest to add a timestamp field instead.

That may beg the question of if frame id belongs inside of Header or not. Judging by the comment in the .msg file, the frame id pertains to transformation data. Does it make sense to remove the frame id to make Header apply more generally or should header potentially be moved/renamed so that it's more apparent the Header is meant to be used with Transform messages.

@wjwwood
Copy link
Member

wjwwood commented Nov 26, 2018

That may beg the question of if frame id belongs inside of Header or not. Judging by the comment in the .msg file, the frame id pertains to transformation data. Does it make sense to remove the frame id to make Header apply more generally or should header potentially be moved/renamed so that it's more apparent the Header is meant to be used with Transform messages.

I would say no... The header is used mostly in the sensor messages where data both has a creation time and a physical origin location, in which case the frame id makes sense.

I think it's just convenient for people to grab the header when they needed a timestamp and/or a sequence number (sequence number is no longer in ROS 2's header message). Personally, I think this is a case of "Header abuse".

@tfoote
Copy link
Contributor

tfoote commented Nov 26, 2018

The std_msgs/Header has significant meaning for physically connected data which is almost all data at the robotic developer level or robot application level. What we're doing here is much more internal to the middleware. We could define a new datatype but we've already deprecated the sequence number in the header and if you remove the frame_id it's just a timestamp. So just using a raw timestamp is actually really all that there is to a std_msgs/Header if we don't want the frame_id.

There's probably a slightly better name for std_msgs/Header but since it's used throughout the ROS ecosystem in it's current name, changing it is much more of a hassle than it's worth.

@nburek
Copy link
Contributor Author

nburek commented Nov 26, 2018

Alright, good to know. I'll go ahead and add timestamp as a Time type field

@mlautman
Copy link

Add find_package(builtin_interfaces REQUIRED) after find_package(ament_cmake REQUIRED) and DEPENDENCIES builtin_interfaces at the end of rosidl_generate_interfaces

@nburek
Copy link
Contributor Author

nburek commented Nov 27, 2018

Add find_package(builtin_interfaces REQUIRED) after find_package(ament_cmake REQUIRED) and DEPENDENCIES builtin_interfaces at the end of rosidl_generate_interfaces

Thanks Mike. I'm actually in the middle of doing that now and verifying it builds locally. Will update pull request in a minute.

@tfoote
Copy link
Contributor

tfoote commented Nov 27, 2018

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Contributor

@tfoote tfoote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lgtm and it's passing CI.

@tfoote tfoote merged commit c12706a into ros2:master Nov 28, 2018
@tfoote tfoote removed the in review Waiting for review (Kanban column) label Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants