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

Bridge appears incapable of bridging ROS1 /clock to ROS2 #104

Closed
matt-attack opened this issue Feb 14, 2018 · 9 comments
Closed

Bridge appears incapable of bridging ROS1 /clock to ROS2 #104

matt-attack opened this issue Feb 14, 2018 · 9 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@matt-attack
Copy link

In ROS1 the rosgraph_msgs/Clock message consists of a time type internally, but in ROS2 the /clock topic is a builtin_interfaces/Time. It does not appear that the bridge can handle bridging this topic from ROS1 to ROS2.

Is there a way to force the bridge to handle this kind of conversion or should a special case be added to the bridge to allow for sim time and bag file playback?

@gavanderhoorn
Copy link

Could this perhaps be solved by specifying a custom mapping rule?

@matt-attack
Copy link
Author

matt-attack commented Feb 14, 2018

Where could I put the remapping aside from having to modify a core ros package? It appears it would need to be added to the builtin_interfaces package for the bridge to accept it otherwise I get an error similar to this one:
Ignoring rule which affects a different ROS 2 package (builtin_interfaces) then the one it is defined in (my_msgs)

EDIT:
I tried adding the remapping to a source build of builtin_interfaces and it didn't appear to work, likely because there isn't a one to one mapping of the fields of each message.

@mikaelarguedas
Copy link
Member

As there is no equivalent type for ROS1 time in ROS 2 (and won't be, by design). Adding mapping rules will not be enough to solve this issue.
Though being able to bridge these messages is valuable. The path forward would be to add a special handling in the bridge itself to match the fields to their equivalent in builtin_interfaces/Time (and perfomr the necessary conversions):
int32 sec -> int32 sec
int32 nsec -> uint32 nsec

@mikaelarguedas mikaelarguedas added the enhancement New feature or request label Feb 15, 2018
@dhood dhood added the help wanted Extra attention is needed label Feb 22, 2018
@dirk-thomas dirk-thomas added this to the bouncy milestone Mar 21, 2018
@dirk-thomas dirk-thomas self-assigned this Mar 26, 2018
@dirk-thomas dirk-thomas added the in progress Actively being worked on (Kanban column) label Mar 26, 2018
@dirk-thomas
Copy link
Member

The problem is not related to the differences in the duration or time types. Those are already being handled in the ros_bridge`: see https://github.com/ros2/ros1_bridge/blob/03f95fea565c2eb28057df8f7b1595bdeac995bc/include/ros1_bridge/convert_builtin_interfaces.hpp

The bridge simply can't bridge a message definition which is not available on both side. And Clock doesn't exist in ROS 2 atm. Please see ros2/common_interfaces#50 which add the Clock message for ROS 2. With that being present bridging the message will work.

@dirk-thomas dirk-thomas added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Mar 26, 2018
@dirk-thomas dirk-thomas removed the help wanted Extra attention is needed label Mar 26, 2018
@dirk-thomas dirk-thomas removed the in review Waiting for review (Kanban column) label Mar 27, 2018
@ernestmc
Copy link
Member

I believe this issue still persists. I'm getting the same error than @matt-attack:

failed to create 1to2 bridge for topic '/clock' with ROS 1 type 'rosgraph_msgs/Clock' and ROS 2 type 'builtin_interfaces/Time': No template specialization for the pair
check the list of supported pairs with the `--print-pairs` option

I've also tried the manual mapping but it seems to be ignored. Printing the mapping shows no instance of the required mapping. Also the mapping needs to be done in the 'builtin_interfaces' package.
I suspect that creating the rosgraph_msgs/Clock message for ros2 is not enough because the ros2 nodes are already subscribing to the /clock topic using the ros2 builtin_interfaces/Time message.

@ernestmc ernestmc reopened this May 14, 2018
@dirk-thomas
Copy link
Member

This is not a bug on the ros1_bridge anymore. In ROS 1 the clock topic is documented to have the type rosgraph_msgs/Clock (see http://wiki.ros.org/Clock#Clock_Message).

@tfoote Can you please follow up on this since you added the clock topic to rclcpp.

@dirk-thomas
Copy link
Member

I created ros2/rclcpp#473 to track this.

@ernestmc
Copy link
Member

Thank you @dirk-thomas . While this is being worked, is there a temporary solution maybe creating a mapping for this topic?

@dirk-thomas
Copy link
Member

Yes, you can temporarily work around it by defining a remapping rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants