@@ -69,13 +69,13 @@ IsDetected::IsDetected(const std::string & xml_tag_name, const BT::NodeConfigura
6969 getInput (" pub_bb_img" , pub_bb_img_);
7070
7171 if (pub_bb_img_) {
72- pub_bb_img_ = node_->create_publisher <sensor_msgs::msg::Image>(
72+ bb_img_pub_ = node_->create_publisher <sensor_msgs::msg::Image>(
7373 " /bb_img_best_detection" , 10 );
7474 img_sub_ = node_->create_subscription <sensor_msgs::msg::Image>(
7575 " /camera/color/image_raw" , 10 ,
7676 std::bind (&IsDetected::image_callback, this , _1));
7777 } else {
78- pub_bb_img_ = nullptr ;
78+ bb_img_pub_ = nullptr ;
7979 img_sub_ = nullptr ;
8080 }
8181
@@ -233,9 +233,6 @@ BT::NodeStatus IsDetected::tick()
233233 RCLCPP_INFO (node_->get_logger (), " [IsDetected] %d detections after filter" , frames_.size ());
234234 }
235235
236-
237-
238- // pub->publish(detections[0].image);
239236
240237 setOutput (" best_detection" , detections[0 ].class_name );
241238
@@ -250,7 +247,7 @@ BT::NodeStatus IsDetected::tick()
250247 cv::Scalar (0 , 0 , 255 ), 2 );
251248
252249 auto msg = cv_bridge::CvImage (std_msgs::msg::Header (), " bgr8" , last_image_).toImageMsg ();
253- pub_bb_img_ ->publish (*msg);
250+ bb_img_pub_ ->publish (*msg);
254251 }
255252
256253 RCLCPP_DEBUG (node_->get_logger (), " [IsDetected] Detections sorted" );
@@ -269,13 +266,14 @@ void IsDetected::image_callback(const sensor_msgs::msg::Image::SharedPtr msg)
269266{
270267 cv_bridge::CvImagePtr image_rgb_ptr;
271268 try {
272- image_rgb_ptr = cv_bridge::toCvCopy (msg-> source_img , sensor_msgs::image_encodings::BGR8);
269+ image_rgb_ptr = cv_bridge::toCvCopy (msg, sensor_msgs::image_encodings::BGR8);
273270 } catch (cv_bridge::Exception & e) {
274- RCLCPP_ERROR (get_logger (), " cv_bridge exception: %s" , e.what ());
271+ RCLCPP_ERROR (node_-> get_logger (), " cv_bridge exception: %s" , e.what ());
275272 return ;
276273 }
277274 last_image_ = image_rgb_ptr->image ;
278275
276+ }
279277} // namespace perception
280278
281279BT_REGISTER_NODES (factory) {
0 commit comments