ros1_bridge icon indicating copy to clipboard operation
ros1_bridge copied to clipboard

Handle special case of std::vector<bool>

Open oKermorgant opened this issue 2 years ago • 4 comments

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

oKermorgant avatar Jul 07 '23 10:07 oKermorgant

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

Timple avatar Jul 11 '23 17:07 Timple

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...).

oKermorgant avatar Jul 27 '23 16:07 oKermorgant

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

Thanks @oKermorgant !

mikaelarguedas avatar May 01 '24 18:05 mikaelarguedas