ROS pcl::PointXYZ 데이터 게시 시 시간 스탬프 문제

3517 단어 ROS
ROS를 이용하여 pcl::pointXYZ 데이터를 발표하는 중 오류가 발생했습니다.
실행 중 오류: ERROR:terminate called after throwing an instance of'std::runtime_error'   what():  Time is out of dual 32-bit range
#include 
#include 
#include 

typedef pcl::PointCloud<:pointxyz> PointCloud;

int main(int argc, char** argv)
{
    ros::init (argc, argv, "pub_pcl");
    ros::NodeHandle nh;
    ros::Publisher pub = nh.advertise ("points2", 1);

    PointCloud::Ptr msg (new PointCloud);
    msg->header.frame_id = "some_tf_frame";
    msg->height = msg->width = 1;
    msg->points.push_back (pcl::PointXYZ(1.0, 2.0, 3.0));

    ros::Rate loop_rate(4);
    while (nh.ok())
    {
        msg->header.stamp = ros::Time::now ();
        pub.publish (msg);
        ros::spinOnce ();
        loop_rate.sleep ();
   } 
}
오류:
error: no se puede convertir ‘ros::Time’ a ‘uint64_t {aka long unsigned int}’ en la asignación (it's in Spanish, I don't know how to change my compiler language)
error: 'ros::Time' cannot be converted to 'uint64_t {aka long unsigned int}' in assignment

해결 방법:
참조:http://answers.ros.org/question/172730/pcl-header-timestamp/pcl_conversions  has conversion functions :http://docs.ros.org/indigo/api/pcl_co...
To convert the time:
#include 
...
pcl_conversions::toPCL(ros::Time::now(), point_cloud_msg->header.stamp);

Or convert an entire header from a ros message:
pcl_conversions::toPCL(ros_msg->header, point_cloud_msg>header);

좋은 웹페이지 즐겨찾기