ros2 / ros1_bridge

ROS 2 package that provides bidirectional communication between ROS 1 and ROS 2
Apache License 2.0
421 stars 274 forks source link

Handle special case of std::vector<bool> #411

Open oKermorgant opened 1 year ago

oKermorgant commented 1 year ago

This PR modifies the interface_factories template file and adds a special case to handle fields which are std:vector<bool>.

The current approach to stream a std::vector is to memcpy its content into/from the stream.

Unfortunately, it does not work for std::vector<bool> as there is not a single bool inside such.

In this PR the template file generates a special call when a vector<bool> is detected.

This should answer https://github.com/ros2/ros1_bridge/issues/391, https://github.com/ros2/ros1_bridge/issues/393

Timple commented 1 year ago

@oKermorgant You probably should signoff on your commits: https://github.com/ros2/ros1_bridge/pull/411/checks?check_run_id=14855763467

oKermorgant commented 11 months ago

The last push is to handle vector<bool> that lie in services, the code was generated elsewhere. In order to handle this I had to use index-based for-loops instead of iterators (you cannot iterate on a vector<bool> and hope to get a pointer to a bool...).

mikaelarguedas commented 2 months ago

fixes the bool list issue for me :+1: (setup: Ubuntu 24.04, ROS 2 Jazzy / ROS Noetic)

Thanks @oKermorgant !