Can`t publish point array msg and there is no error info

asked 2017-05-14 23:54:14 -0500

westeast gravatar image

updated 2017-05-15 01:31:33 -0500

this is my msg file:

point msg: trajectory_point.msg

# time information
Header header

# the perception object id
int32 object_id

# x,y donates the position of the object
float64 x
float64 y
float64 theta
float64 velocity

point array msg:trajectory.msg

# time information
Header header

# trajectory points
trajectory_point[] trajectory

the following is my code :

// init publiser,the msg publisher rate depends on perception rate from wenbo.
        _pub_trajectory_point = _nh.advertise<trajectory::trajectory_point>("/trajectory_point",10);
        _pub_trajectory = _nh.advertise<trajectory::trajectory>("/obstacle_trajectory",10);


for loop ten times  { 
if(_is_need_pub_msg){
                _trajectory_point_msg.header.frame_id = "/base_link";
                _trajectory_point_msg.header.stamp = ros::Time();
                _trajectory_point_msg.x = x_expr;
                _trajectory_point_msg.y = y_expr;
                _trajectory_point_msg.velocity = velocity_expr;
                _trajectory_point_msg.theta = theta_expr;

                _pub_trajectory_point.publish(_trajectory_point_msg);
                _trajectory_msg.trajectory.push_back(_trajectory_point_msg);
            }
        }

        if(_is_need_pub_msg){
            ROS_INFO_STREAM("Trajectory Generation Begins:========frame_id========"
                    << _trajectory_msg.trajectory[0].header.frame_id
                    << "====x===="
                    << _trajectory_msg.trajectory[0].x);
            //ros::message_operations::Printer<trajectory::trajectory_>(_trajectory_msg);


            _trajectory_msg.header.frame_id = "/base_link";
            _trajectory_msg.header.stamp = ros::Time();
            _pub_trajectory.publish(_trajectory_msg);
        }

Then I run rostopic echo /trajectory_point the result is normal,and there are many message. but when i run rostopic echo /obstacle_trajectory : the result is empty ,and there is no any error infromation .

edit retag flag offensive close merge delete