官网上persontracking教程 (https://github.com/OpenPTrack/open_ptrack/wiki/Tracking)
运行以上命令,在打开的rviz中,添加显示类型PointCloud2,选择topic,如/tracker/history,在显示窗口中就可以观察到相应人员的行动轨迹。
1、执行rosrun rqt_graphrqt_graph命令可显示当前运行的节点和话题:
发现tracking node与ground_based_people_detector_node间通过haardispada node(在detector_kinect1.launch中启动)联系。可通过launch中type参数和CMakeLists.txt文件确定node的cpp文件,以下是前面提到的三个node中相关topic和消息类型: 查看detection包下ground_based_people_detector_node.cpp: //Publishers: detection_pub= nh.advertise<DetectionArray>(output_topic,3); 其中output_topic(查看launch文件可知) 为:/ground_based_people_detector_$(arg camera_name)/detections
查看tracking包下tracker_node.cpp: //Subscribers ros::Subscriber input_sub = nh.subscribe("input", 5,detection_cb); 其中input (查看launch文件可知) 为: /detector/detections 回调函数 void detection_cb(const opt_msgs::DetectionArray::ConstPtr&msg){…}
查看haardispada_node .cpp: pub_detections_=node_advertise<DetectionArray>("/detector/detections",3);
sub_detections_.subscribe(node_,"input_detections",qs);
其中input_detections(查看launch文件可知) 为:/ground_based_people_detector_$(arg camera_name)/detections
2、DetectionArray(openptrack自定义消息类型)结构如下:
Header header
opt_msgs/Detection[] detections
float64[] intrinsic_matrix
string confidence_type
string image_type
其中opt_msgs/Detection[] 结构如下:
opt_msgs/BoundingBox3D box_3D
opt_msgs/BoundingBox2D box_2D
geometry_msgs/Vector3 centroid
geometry_msgs/Vector3 bottom
geometry_msgs/Vector3 top
float64 height
float64 confidence
float64 distance
bool occluded
3、在命令行中打出上文中两个topic的信息(通过rostopic echo [topic]命令):
图片左边为topic--/ground_based_people_detector_$(arg camera_name)/detections
右边为topic-- /detector/detections
对比可发现,在相同ros time时,两个topic中DetectionArray消息的各参数值除seq,confidence,confidence_type,image_type不同外均相同,与行人位置信息有关的centroid,bottom,top并未改变。
|