Skip to content

Commit

Permalink
changed smart ptr to stack var
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-edward committed Apr 3, 2023
1 parent 3ff1141 commit e9322cc
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions uwrt_mars_rover_science/dinolite/src/cam_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ void CamNode::frame() {
auto stamp = this->get_clock()->now();

// fill message
sensor_msgs::msg::Image::UniquePtr image_msg(new sensor_msgs::msg::Image());
auto image_msg = sensor_msgs::msg::Image();

image_msg->header.stamp = stamp;
image_msg->header.frame_id = cxt_.camera_frame_id_;
image_msg->height = frame.rows;
image_msg->width = frame.cols;
image_msg->encoding = mat_type2encoding(frame.type());
image_msg->is_bigendian = false;
image_msg->step = static_cast<sensor_msgs::msg::Image::_step_type>(frame.step);
image_msg->data.assign(frame.datastart, frame.dataend);
image_msg.header.stamp = stamp;
image_msg.header.frame_id = cxt_.camera_frame_id_;
image_msg.height = frame.rows;
image_msg.width = frame.cols;
image_msg.encoding = mat_type2encoding(frame.type());
image_msg.is_bigendian = false;
image_msg.step = static_cast<sensor_msgs::msg::Image::_step_type>(frame.step);
image_msg.data.assign(frame.datastart, frame.dataend);

// publish message
image_pub_->publish(std::move(image_msg));
image_pub_->publish(image_msg);
if (camera_info_pub_) {
camera_info_msg_.header.stamp = stamp;
camera_info_msg_.header.frame_id = cxt_.camera_frame_id_;
Expand All @@ -92,4 +92,4 @@ void CamNode::frame() {

#include "rclcpp_components/register_node_macro.hpp"

RCLCPP_COMPONENTS_REGISTER_NODE(dinolite::CamNode)
RCLCPP_COMPONENTS_REGISTER_NODE(dinolite::CamNode)

0 comments on commit e9322cc

Please sign in to comment.