osrf / ros2_serial_example

61 stars 13 forks source link

Make the serial bridge composable #76

Closed clalancette closed 4 years ago

clalancette commented 4 years ago

As it stands, ros2_serial_bridge_main.cpp does way too much work. This means that the node is not composable with other nodes. What we should probably do here is:

  1. Remove the signal_handler and the running variable; I don't think they serve a purpose anymore.
  2. Move the get_parameter for write_sleep_ms into the constructor (or get rid of it completely).
  3. Think about how to get rid of the rate loop; if we code it properly, we should just be able to call rclcpp::spin on the constructed node.
  4. Add a dependency on rclcpp_components to the package.xml and CMakeLists.txt.
  5. Add the RCLCPP_COMPONENTS_REGISTER_NODE macro to the end of ros2_to_serial_bridge.cpp.
  6. Add launch files showing how to launch the node in both composable and non-composable modes.
ahcorde commented 4 years ago

@clalancette I reviewed all your comments. If you have some time please review https://github.com/osrf/ros2_serial_example/pull/77

I have also addressed some comments from @mjcarrol