Open simulacrus opened 2 years ago
First, function toRosMsg. It's better to publish a unique_ptr instead of an object, avoiding unnecessary copying when publishing a message
using std::move would be better?
point_cloud_pub_.publish(std::move(toRosMsg(msg)));
the implementation of the driver as a component
It should be hard for the current rslidar_sdk arch, because PointCloudRosAdapter
inherits from AdapterBase
.
First, function toRosMsg. It's better to publish a unique_ptr instead of an object, avoiding unnecessary copying when publishing a message
using std::move would be better?
point_cloud_pub_.publish(std::move(toRosMsg(msg)));
There is some difference between publish methods(publish(const MessageT & msg)
and publish(std::unique_ptr<MessageT, MessageDeleter> msg)
) in rclcpp here. When intra_process_isenabled flag is enabled(only for component) then one copy operation will not be processed.
the implementation of the driver as a component
It should be hard for the current rslidar_sdk arch, because
PointCloudRosAdapter
inherits fromAdapterBase
.
Maybe need to implement init method like this void PointCloudRosAdapter::init(const YAML::Node& config, rclcpp::Node* node=nullptr)
and create node in int main(int argc, char** argv)
function?
Hi, is there any update on implementing a component version of the driver?
I found several places for improvement.
First, function toRosMsg. It's better to publish a unique_ptr instead of an object, avoiding unnecessary copying when publishing a message
Second, the implementation of the driver as a component