my source code is this
#include <ros/ros.h>
#include <tf/transform_broadcaster.h>
#include <tf/transform_listener.h>
#include <geometry_msgs/PointStamped.h>
#include <pcl_ros/point_cloud.h>
#include <pcl_ros/transforms.h>
#include <jsk_recognition_msgs/BoundingBoxArray.h>
#include <pharos_msgs/object_custom_msg.h>
#include <pharos_msgs/object_custom_msgs.h>
///전역변수///
///------////
class velodyne_
{
public:
ros::NodeHandlePtr nh;
ros::NodeHandlePtr pnh;
velodyne_()
{
nh = ros::NodeHandlePtr(new ros::NodeHandle(""));
pnh = ros::NodeHandlePtr(new ros::NodeHandle("~"));
///서브스크라이브는 this 사용 publish는 메세지형식 이것만 잘 생각해놓기
sub_custom_msg = nh->subscribe("pharos_object_msg", 10 , &velodyne_::BOX_CB,this);
pub_box_msg = nh->advertise<jsk_recognition_msgs::BoundingBoxArray>("object_box",10);
}
void BOX_CB(const pharos_msgs::object_custom_msgs &input_msg){
///CALLBACK 함수
jsk_recognition_msgs::BoundingBoxArray BOXS;
for(int i=0; i<input_msg.objects.size(); i++){
jsk_recognition_msgs::BoundingBox box;
box.label = i+1;
box.pose.position.x = input_msg.objects[i].min_x;
box.pose.position.y = input_msg.objects[i].min_y;
box.pose.position.z = input_msg.objects[i].min_z;
box.dimensions.x = input_msg.objects[i].max_x;
box.dimensions.y = input_msg.objects[i].max_y;
box.dimensions.z = input_msg.objects[i].max_z;
box.header.frame_id ="velodyne";
box.header.stamp = input_msg.header.stamp;
BOXS.boxes.push_back(box);
}
BOXS.header.stamp=input_msg.header.stamp;
BOXS.header.frame_id = "velodyne";
pub_box_msg.publish(BOXS);
}
protected:
ros::Subscriber sub_custom_msg;
ros::Publisher pub_box_msg;
};
int main(int argc, char **argv)
{
ros::init(argc, argv, "object_box"); //노드명 초기화
ROS_INFO("started object_box");
ROS_INFO("SUBTOPIC : ");
ROS_INFO("PUBTOPIC : ");
velodyne_ hello;
ros::spin();
}
i want to show up box with object ex)
i know min_x,y,z , max_x,y,z so i have 8 points of bound box how i can bounding object with jsk msg? i can publish some image but doesnt match size and position
Originally posted by dnjsxor564 on ROS Answers with karma: 11 on 2018-08-19
Post score: 0