Skip to content

Commit

Permalink
Merge branch 'ros2' into jazzy_to_ros2
Browse files Browse the repository at this point in the history
  • Loading branch information
azeey authored Jun 27, 2024
2 parents 9167809 + a781b78 commit cc9eb90
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions ros_gz_bridge/src/convert/sensor_msgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,11 @@ convert_gz_to_ros(

ros_msg.is_bigendian = false;
ros_msg.step = ros_msg.width * num_channels * octets_per_channel;

auto count = ros_msg.step * ros_msg.height;
ros_msg.data.resize(ros_msg.step * ros_msg.height);
std::copy(
gz_msg.data().begin(),
gz_msg.data().begin() + count,
ros_msg.data.begin());

// Prefer memcpy over std::copy for performance reasons,
// see https://github.com/gazebosim/ros_gz/pull/565
memcpy(ros_msg.data.data(), gz_msg.data().c_str(), gz_msg.data().size());
}

template<>
Expand Down

0 comments on commit cc9eb90

Please sign in to comment.