Commit 0bf03a12 authored by oscar's avatar oscar

提交参数可以配置topic名称

parent c546d668
......@@ -321,10 +321,26 @@ void TrackingRos::Init(ros::NodeHandle& nh)
SDK_IDX_LOG(1, SDK_INFO, "date,frameNum,time,id,input_radian,input_angle,predict_radian,predict_angle,output_radian,output_angle,input_type,input_x,input_y,input_z,input_l,input_w,input_h,last_type,predict_x,predict_y,predict_z,predict_l,predict_w,preditc_h,output_type,output_x,output_y,output_z,output_l,output_w,output_h,output_rot_y,v_x,v_y,v_z,lat,lon");
//m_coordinate.Init(value[0][0], value[0][1], value[0][2], value[0][3], value[1][0], value[1][1]);
m_pub = nh.advertise<jfx_common_msgs::det_tracking_array>("/tracking_res", 100);
m_pubCloud = nh.advertise<sensor_msgs::PointCloud2>("/tracking_cloud", 100);
m_pubBoundingBoxes = nh.advertise<jsk_recognition_msgs::BoundingBoxArray>("/tracking_bbox", 100);
m_pubMarkerArray = nh.advertise<visualization_msgs::MarkerArray>("/tracking_loc", 100);
std::string fusion_topic = "/fusion_res";
std::string tracking_topic = "/tracking_res";
std::string cloud_topic = "/tracking_cloud";
std::string tracking_box_topic = "/tracking_bbox";
std::string tracking_marker_topic = "/tracking_loc";
if(config["fusion_topic_name"])
fusion_topic = config["fusion_topic_name"].as<std::string>();
if(config["tracking_topic_name"])
tracking_topic = config["tracking_topic_name"].as<std::string>();
if(config["cloud_topic_name"])
cloud_topic = config["cloud_topic_name"].as<std::string>();
if(config["tracking_box_topic_name"])
tracking_box_topic = config["tracking_box_topic_name"].as<std::string>();
if(config["tracking_marker_topic_name"])
tracking_marker_topic = config["tracking_marker_topic_name"].as<std::string>();
m_subFusionRes = nh.subscribe<jfx_common_msgs::det_tracking_array>(fusion_topic.c_str(), 1000, &TrackingRos::TrackingCallBackFunc, this);
m_pub = nh.advertise<jfx_common_msgs::det_tracking_array>(tracking_topic.c_str(), 100);
m_pubCloud = nh.advertise<sensor_msgs::PointCloud2>(cloud_topic.c_str(), 100);
m_pubBoundingBoxes = nh.advertise<jsk_recognition_msgs::BoundingBoxArray>(tracking_box_topic.c_str(), 100);
m_pubMarkerArray = nh.advertise<visualization_msgs::MarkerArray>(tracking_marker_topic.c_str(), 100);
#ifdef _SEND_ABUZHABI_
m_pubAbuzhabi = nh.advertise<std_msgs::String>("/abuzhabi_msg",100);
#endif
......
......@@ -46,6 +46,7 @@ public:
ros::Publisher m_pubCloud;//发送点云数据
ros::Publisher m_pubBoundingBoxes;//发送3D框信息
ros::Publisher m_pubMarkerArray;//发送marker框信息
ros::Subscriber m_subFusionRes;
#ifdef _SEND_ABUZHABI_
ros::Publisher m_pubAbuzhabi;//阿布扎比发送的数据
#endif
......
......@@ -57,7 +57,7 @@ int main(int argc, char*argv[]) {
TrackingRos jfx_tracking;
jfx_tracking.Init(nh);
ros::Subscriber track_sub = nh.subscribe<jfx_common_msgs::det_tracking_array>("/fusion_res", 1000, &TrackingRos::TrackingCallBackFunc, &jfx_tracking);
// ros::Subscriber track_sub = nh.subscribe<jfx_common_msgs::det_tracking_array>("/fusion_res", 1000, &TrackingRos::TrackingCallBackFunc, &jfx_tracking);
//rospy.Subscriber("/detection/lidar_detector/objects", det_tracking_array, callback)
ros::spin();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment