-
Notifications
You must be signed in to change notification settings - Fork 278
Closed
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Bug report
Required Info:
- Operating System:
- Ubuntu 20.04
- Installation type:
- binaries
- Version or commit hash:
- ros-foxy-rclcpp 2.4.0-1focal.20211112.191736 (latest)
- ros-foxy-rclpy 1.0.7-1focal.20211112.191643 (latest)
- Client library (if applicable):
- rclpy
Steps to reproduce issue
Publish String from C++ with arbitrary byte content:
publisher_ = this->create_publisher<std_msgs::msg::String>("topic", 1);
/* ... */
std::string data;
for (uint8_t c = 120; c < 130; c++) data.push_back(c);
auto message = std_msgs::msg::String();
message.data = std::string("Hello, ") + data + std::string("!");
publisher_->publish(message);
Listen to the topic from Python:
ros2 topic echo /topic
or:
import rclpy, std_msgs.msg
rclpy.init()
node = rclpy.create_node("listener")
node.create_subscription(std_msgs.msg.String, "/topic", print, 1)
rclpy.spin(node)Expected behavior
Prints message:
data: Hello, xyz{|}~��!
Actual behavior
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/__init__.py", line 191, in spin
executor.spin_once()
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 714, in spin_once
raise handler.exception()
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/task.py", line 239, in __call__
self._handler.send(None)
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 422, in handler
arg = take_from_wait_list(entity)
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 347, in _take_subscription
msg_info = _rclpy.rclpy_take(capsule, sub.msg_type, sub.raw)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 15: invalid start byte
Sample C++ package attached: example.tar.gz; unpack to workspace src-directory; build and run with:
colcon build --packages-select example
source $COLCON_PREFIX_PATH/setup.bash
ros2 run example publisherReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed