ros::NodeHandle nh_; std::string img_pub_name, loca_pub_name, sub_color_name, sub_depth_name, sub_state_name, yolo_engine; float conf_thre; bool img_rotate, infer_state, is_seg; std::vector<std::string> class_names; std::map<std::string, int> all_classes{{"circle",1}, {"others_ballon",2}, {"red_ballon",3}, {"purple_ballon",4}, {"outdoor_ballon",5}}; ros::Publisher img_pub, loca_pub; message_filters::Subscriber<Image> *sub_color, *sub_depth; message_filters::Synchronizer<syncPolicy> *sync_; ros::Subscriber sub_state; cv_bridge::CvImagePtr color_ptr, depth_ptr; YoLov5TRT *yolov5trt; std::vector<Detection> res_boxes; std::vector<float> resized_box; detect_msgs::BoundingBoxes batch_boxes; std::vector<detect_msgs::BoundingBox> boxes; detect_msgs::BoundingBox b;
时间: 2024-04-21 13:24:08 浏览: 18
这段代码是一个类的成员变量的声明部分。其中包含了ROS相关的节点句柄(nh_)和发布器(img_pub和loca_pub),以及消息订阅器(sub_color、sub_depth和sub_state)。还有一些其他的变量,如图像发布器名称(img_pub_name)、目标位置发布器名称(loca_pub_name)、彩色图像订阅器名称(sub_color_name)、深度图像订阅器名称(sub_depth_name)、状态订阅器名称(sub_state_name)、YOLO引擎名称(yolo_engine)、置信度阈值(conf_thre)、图像旋转标志(img_rotate)、推理状态标志(infer_state)和是否进行分割的标志(is_seg)。
接下来是一些数据结构,如类别名称的字符串向量(class_names)和类别与编号的映射关系(all_classes)。
然后是一些指针和对象的声明,如消息过滤器的订阅器指针(sub_color和sub_depth)、同步器指针(sync_)、状态订阅器对象(sub_state)、图像指针对象(color_ptr和depth_ptr)、YOLOv5推理对象指针(yolov5trt)、检测结果的向量(res_boxes)、重新调整后的边界框向量(resized_box)、批量边界框消息对象(batch_boxes)、边界框向量(boxes)和边界框对象(b)。
这些成员变量被用于处理图像消息和执行目标检测推理的过程中。