Installation type:
ros1_bridge from source, everything else ros foxy/melodic from binaries
Version or commit hash:
git rev-parse HEAD: 3209bc77c77b072013b05bcc6690a24a6bd16aeb
DDS implementation:
Fast-RTPS
Client library (if applicable):
Steps to reproduce issue
When creating a custom msg type with a template mapping rule, the parameter bridge (as opposed to the dynamic bridge) only works if the package name in ROS2 is the same as in ROS1. This behaviour doesn't occur for the dynamic bridge.
The specific steps to reproduce the issue below map a move base topic that already exists in ROS1 but not in ROS2. It uses the husky sim, (Melodic, install instructions here), and ROS 2 Foxy. For the CMakeLists.txt and package.xml below, only the lines that are changed are shown.
The custom topic fails, but the IMU topic works, giving the following error (note that the error shows the ROS 2 type as 'move_base_msgs/msg/MoveBaseActionResult' - when it should be robot_msgs/msg/MoveBaseActionResult):
Trying to create bidirectional bridge for topic '/move_base/result' with ROS 2 type 'move_base_msgs/msg/MoveBaseActionResult'
[INFO] [1630381343.254272251] [ros_bridge]: create bidirectional bridge for topic /move_base/result
failed to create bidirectional bridge for topic '/move_base/result' with ROS 2 type 'move_base_msgs/msg/MoveBaseActionResult': No template specialization for the pair
Trying to create bidirectional bridge for topic '/imu/data' with ROS 2 type 'sensor_msgs/msg/Imu'
[INFO] [1630381343.254968007] [ros_bridge]: create bidirectional bridge for topic /imu/data
However, running the dynamic bridge succeeds at bridging the custom topic (using the correct ROS 2 type 'robot_msgs/msg/MoveBaseActionResult' shown below):
ros2 run ros1_bridge dynamic_bridge --bridge-all-topics
...
created 1to2 bridge for topic '/move_base/local_costmap/footprint' with ROS 1 type 'geometry_msgs/PolygonStamped' and ROS 2 type 'geometry_msgs/msg/PolygonStamped'
created 1to2 bridge for topic '/move_base/result' with ROS 1 type 'move_base_msgs/MoveBaseActionResult' and ROS 2 type 'robot_msgs/msg/MoveBaseActionResult'
created 1to2 bridge for topic '/move_base/status' with ROS 1 type 'actionlib_msgs/GoalStatusArray' and ROS 2 type 'actionlib_msgs/msg/GoalStatusArray'
...
As a further test, the parameter bridge also works if you completely change the message package so it has the same name as the ROS1 package (aka, rename everything robot_msgs to move_base_msgs)
Expected behavior
I think you should be able to name ros 1 and 2 packages differently for the parameter bridge.
Actual behavior
parameter bridge only maps custom topics if their packages are named the same thing.
Additional information
Let me know if anything's missing or there'd have been a better way to present the bug above!
Bug report
Required Info:
Steps to reproduce issue
When creating a custom msg type with a template mapping rule, the parameter bridge (as opposed to the dynamic bridge) only works if the package name in ROS2 is the same as in ROS1. This behaviour doesn't occur for the dynamic bridge.
The specific steps to reproduce the issue below map a move base topic that already exists in ROS1 but not in ROS2. It uses the husky sim, (Melodic, install instructions here), and ROS 2 Foxy. For the CMakeLists.txt and package.xml below, only the lines that are changed are shown.
Folder structure for custom message
MoveBaseActionResult.msg
mapping_rules.yaml
CMakeLists.txt
package.xml
Build the robot_msgs package and ros1_bridge as per https://github.com/ros2/ros1_bridge/blob/master/doc/index.rst.
Then in 2 separate terminals launch the husky sim with move_base:
In another terminal set the parameters for the parameter server:
Launch the parameter bridge in ros2
The custom topic fails, but the IMU topic works, giving the following error (note that the error shows the ROS 2 type as 'move_base_msgs/msg/MoveBaseActionResult' - when it should be robot_msgs/msg/MoveBaseActionResult):
However, running the dynamic bridge succeeds at bridging the custom topic (using the correct ROS 2 type 'robot_msgs/msg/MoveBaseActionResult' shown below):
As a further test, the parameter bridge also works if you completely change the message package so it has the same name as the ROS1 package (aka, rename everything robot_msgs to move_base_msgs)
Expected behavior
I think you should be able to name ros 1 and 2 packages differently for the parameter bridge.
Actual behavior
parameter bridge only maps custom topics if their packages are named the same thing.
Additional information
Let me know if anything's missing or there'd have been a better way to present the bug above!