{"action":"created","issue":{"url":"https://api.github.com/repos/ros2/ros1_bridge/issues/135","repository_url":"https://api.github.com/repos/ros2/ros1_bridge","labels_url":"https://api.github.com/repos/ros2/ros1_bridge/issues/135/labels{/name}","comments_url":"https://api.github.com/repos/ros2/ros1_bridge/issues/135/comments","events_url":"https://api.github.com/repos/ros2/ros1_bridge/issues/135/events","html_url":"https://github.com/ros2/ros1_bridge/pull/135","id":349614923,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3Njg5MzEz","number":135,"title":"[WIP] rule can be a message mapping and a field_mapping","user":{"login":"mikaelarguedas","id":6644208,"node_id":"MDQ6VXNlcjY2NDQyMDg=","avatar_url":"https://avatars1.githubusercontent.com/u/6644208?v=4","gravatar_id":"","url":"https://api.github.com/users/mikaelarguedas","html_url":"https://github.com/mikaelarguedas","followers_url":"https://api.github.com/users/mikaelarguedas/followers","following_url":"https://api.github.com/users/mikaelarguedas/following{/other_user}","gists_url":"https://api.github.com/users/mikaelarguedas/gists{/gist_id}","starred_url":"https://api.github.com/users/mikaelarguedas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikaelarguedas/subscriptions","organizations_url":"https://api.github.com/users/mikaelarguedas/orgs","repos_url":"https://api.github.com/users/mikaelarguedas/repos","events_url":"https://api.github.com/users/mikaelarguedas/events{/privacy}","received_events_url":"https://api.github.com/users/mikaelarguedas/received_events","type":"User","site_admin":false},"labels":[{"id":225825347,"node_id":"MDU6TGFiZWwyMjU4MjUzNDc=","url":"https://api.github.com/repos/ros2/ros1_bridge/labels/in%20progress","name":"in progress","color":"fad8c7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-10T18:29:49Z","updated_at":"2018-08-10T20:35:15Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/ros2/ros1_bridge/pulls/135","html_url":"https://github.com/ros2/ros1_bridge/pull/135","diff_url":"https://github.com/ros2/ros1_bridge/pull/135.diff","patch_url":"https://github.com/ros2/ros1_bridge/pull/135.patch"},"body":"This is WIP, opening for visibility only\r\n\r\nConnects to #134 "},"comment":{"url":"https://api.github.com/repos/ros2/ros1_bridge/issues/comments/412198626","html_url":"https://github.com/ros2/ros1_bridge/pull/135#issuecomment-412198626","issue_url":"https://api.github.com/repos/ros2/ros1_bridge/issues/135","id":412198626,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjE5ODYyNg==","user":{"login":"mikaelarguedas","id":6644208,"node_id":"MDQ6VXNlcjY2NDQyMDg=","avatar_url":"https://avatars1.githubusercontent.com/u/6644208?v=4","gravatar_id":"","url":"https://api.github.com/users/mikaelarguedas","html_url":"https://github.com/mikaelarguedas","followers_url":"https://api.github.com/users/mikaelarguedas/followers","following_url":"https://api.github.com/users/mikaelarguedas/following{/other_user}","gists_url":"https://api.github.com/users/mikaelarguedas/gists{/gist_id}","starred_url":"https://api.github.com/users/mikaelarguedas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikaelarguedas/subscriptions","organizations_url":"https://api.github.com/users/mikaelarguedas/orgs","repos_url":"https://api.github.com/users/mikaelarguedas/repos","events_url":"https://api.github.com/users/mikaelarguedas/events{/privacy}","received_events_url":"https://api.github.com/users/mikaelarguedas/received_events","type":"User","site_admin":false},"created_at":"2018-08-10T20:35:15Z","updated_at":"2018-08-10T20:35:15Z","author_association":"CONTRIBUTOR","body":"How to reproduce the issue and test the fix:\r\n=================================\r\n\r\n# Build environment:\r\n\r\n### Shell 1 (setup a container)\r\n```\r\ndocker pull osrf/ros2:bouncy-ros1-bridge && docker run -it --rm osrf/ros2:bouncy-ros1-bridge\r\n# apt update && apt install -y git python3-colcon-common-extensions build-essential\r\n# cd && git clone https://github.com/mikaelarguedas/ros1_bridge_bug.git\r\n```\r\n\r\n### Shell 2: (log in container and build ros1 workspace)\r\n```\r\ndocker exec -it <CONTAINER_ID> bash\r\n```\r\n```\r\ncd ~/ros1_bridge_bug/ros1_msgs_overlay/\r\nsource /opt/ros/melodic/setup.bash \r\ncatkin_make_isolated --install\r\n```\r\n\r\n### Shell 3: log in container and build ros2 ws\r\n```\r\ndocker exec -it <CONTAINER_ID> bash\r\n```\r\n```\r\nsource /opt/ros/bouncy/setup.bash\r\ncd ~/ros1_bridge_bug/ros2_msgs_overlay/\r\ncolcon build\r\n```\r\n\r\n### Shell 4: log in container and build custom bridge\r\n```\r\ndocker exec -it <CONTAINER_ID> bash\r\n```\r\n\r\n```\r\nmkdir -p ~/ros1_bridge_bug/ros1_bridge_ws/src && cd ~/ros1_bridge_bug/ros1_bridge_ws/src\r\ngit clone https://github.com/ros2/ros1_bridge.git\r\ncd ~/ros1_bridge_bug/ros1_bridge_ws\r\nsource /opt/ros/melodic/setup.bash \r\nsource /opt/ros/bouncy/setup.bash \r\nsource ~/ros1_bridge_bug/ros1_msgs_overlay/install_isolated/setup.bash \r\nsource ~/ros1_bridge_bug/ros2_msgs_overlay/install/setup.bash\r\ncolcon build --event-handlers console_direct+\r\n```\r\n# Confirm the absence of mapping:\r\n```\r\ncat build/ros1_bridge/generated/ros2_msgs_factories.hpp\r\n```\r\n<details><summary>File content without mapping</summary>\r\n\r\n```\r\n// generated from ros1_bridge/resource/pkg_factories.hpp.em\r\n\r\n#include <ros1_bridge/factory.hpp>\r\n\r\n// include ROS 1 messages\r\n\r\n// include ROS 2 messages\r\n\r\nnamespace ros1_bridge\r\n{\r\n\r\nstd::shared_ptr<FactoryInterface>\r\nget_factory_ros2_msgs(const std::string & ros1_type_name, const std::string & ros2_type_name);\r\n\r\nstd::unique_ptr<ServiceFactoryInterface>\r\nget_service_factory_ros2_msgs(const std::string & ros_id, const std::string & package_name, const std::string & service_name);\r\n\r\n// conversion functions for available interfaces\r\n}  // namespace ros1_bridge\r\n```\r\n</details>\r\n\r\n# Rebuild the bridge with this fix:\r\n```\r\ncd ~/ros1_bridge_bug/ros1_bridge_ws && rm -rf build install\r\ncd ~/ros1_bridge_bug/ros1_bridge_ws/src/ros1_bridge && git checkout -t origin/fix_message_and_field_mapping && cd ~/ros1_bridge_bug/ros1_bridge_ws\r\ncolcon build --event-handlers console_direct+\r\n```\r\n\r\n## Confirm the presence of mapping:\r\n```\r\ncat build/ros1_bridge/generated/ros2_msgs_factories.hpp\r\n```\r\n<details><summary>File content with mapping</summary>\r\n\r\n```\r\n// generated from ros1_bridge/resource/pkg_factories.hpp.em\r\n\r\n#include <ros1_bridge/factory.hpp>\r\n\r\n// include ROS 1 messages\r\n#include <ros1_msgs/EgoData.h>\r\n\r\n// include ROS 2 messages\r\n#include <ros2_msgs/msg/size.hpp>\r\n\r\nnamespace ros1_bridge\r\n{\r\n\r\nstd::shared_ptr<FactoryInterface>\r\nget_factory_ros2_msgs(const std::string & ros1_type_name, const std::string & ros2_type_name);\r\n\r\nstd::unique_ptr<ServiceFactoryInterface>\r\nget_service_factory_ros2_msgs(const std::string & ros_id, const std::string & package_name, const std::string & service_name);\r\n\r\n// conversion functions for available interfaces\r\n\r\ntemplate<>\r\nvoid\r\nFactory<\r\n  ros1_msgs::EgoData,\r\n  ros2_msgs::msg::Size\r\n>::convert_1_to_2(\r\n  const ros1_msgs::EgoData & ros1_msg,\r\n  ros2_msgs::msg::Size & ros2_msg);\r\n\r\ntemplate<>\r\nvoid\r\nFactory<\r\n  ros1_msgs::EgoData,\r\n  ros2_msgs::msg::Size\r\n>::convert_2_to_1(\r\n  const ros2_msgs::msg::Size & ros2_msg,\r\n  ros1_msgs::EgoData & ros1_msg);\r\n\r\n}  // namespace ros1_bridge\r\n```\r\n\r\n</details>\r\n\r\n\r\n\r\n# Test that bridging now works \r\n\r\nNote: each shell is assumed to be a new shell in the container with nothing sourced in it\r\n\r\n### Shell a:\r\n```\r\nsource /opt/ros/melodic/setup.bash\r\nroscore\r\n```\r\n\r\n### Shell b:\r\n```\r\nsource /opt/ros/melodic/setup.bash \r\nsource ~/ros1_bridge_bug/ros1_msgs_overlay/install_isolated/setup.bash \r\nsource /opt/ros/bouncy/setup.bash \r\nsource ~/ros1_bridge_bug/ros2_msgs_overlay/install/setup.bash \r\nsource ~/ros1_bridge_bug/ros1_bridge_ws/install/setup.bash \r\nros2 run ros1_bridge dynamic_bridge\r\n```\r\n\r\n### Shell c:\r\n```\r\napt install ros-melodic-rostopic\r\nsource /opt/ros/melodic/setup.bash \r\nsource ~/ros1_bridge_bug/ros1_msgs_overlay/install_isolated/setup.bash \r\nrostopic pub /foo ros1_msgs/EgoData \"vehicleLength: 0.0\"\r\n```\r\n\r\n### Shell d:\r\n```\r\nsource ~/ros1_bridge_bug/ros2_msgs_overlay/install/setup.bash \r\nsource /opt/ros/bouncy/setup.bash \r\nsource ~/ros1_bridge_bug/ros2_msgs_overlay/install/setup.bash\r\nros2 topic echo /foo ros2_msgs/Size\r\n```\r\nYou should see the bridged message printed:\r\n```\r\nlength: 0.0\r\n```\r\n\r\n## CI\r\nJust regular packaging CI to make sure everything else works as before: [![Build Status](https://ci.ros2.org/job/ci_packaging_linux/138/badge/icon)](https://ci.ros2.org/job/ci_packaging_linux/138/)"}}
{"actor":{"display_login":"mikaelarguedas"}}