Ask Your Question
0

Time issue after changing type of time

asked 2012-01-27 22:15:35 -0500

alfa_80 gravatar image

I received a warning that is related to timing issue. This warning causes my node that is supposed to transform LaserScan to PointCloud not working. If I use my dataset's timestamp, it will be fine, but then, I need to refactor the code by using ROS timestamp to resolve timing issue.

I'm actually confused when to use ros::Time::now() and likewise, when to use ros::Time(0). Perhaps I wrongly assigned those values somewhere.

By the way, when publishing all my messages(LaserScan, Pose, etc), I just assigned them ros::Time::now. Is that right doing that?

The code snippet that is needed to be refactored to use ROS timestamp:

      static tf::TransformBroadcaster tfb;
      tf::Transform xform;
      xform.setOrigin(tf::Vector3(pose3D_LDD.pose.position.x, pose3D_LDD.pose.position.y, pose3D_LDD.pose.position.z));
      xform.setRotation(tf::Quaternion(pose3D_LDD.pose.orientation.x, pose3D_LDD.pose.orientation.y, pose3D_LDD.pose.orientation.z, pose3D_LDD.pose.orientation.w));
      tfb.sendTransform(tf::StampedTransform(xform, ros::Time(pose3D_LDD.header.stamp), "base_link", "laser")); 
      tfListener_.waitForTransform("base_link", "laser", previous_scan_.header.stamp, ros::Duration(2.0)); 

      try
      {
        projector_.transformLaserScanToPointCloud("base_link", previous_scan_, cloud, tfListener_); 
      }
      catch (tf::TransformException ex)
      {
        ROS_WARN("Problem: %s", ex.what());
      }

The code snippet after refactored to use ROS timestamp, but obtained a serious warning:

      static tf::TransformBroadcaster tfb;
      tf::Transform xform;
      xform.setOrigin(tf::Vector3(pose3D_LDD.pose.position.x, pose3D_LDD.pose.position.y, pose3D_LDD.pose.position.z));
      xform.setRotation(tf::Quaternion(pose3D_LDD.pose.orientation.x, pose3D_LDD.pose.orientation.y, pose3D_LDD.pose.orientation.z, pose3D_LDD.pose.orientation.w));
      tfListener_.waitForTransform("base_link", "laser", ros::Time(0), ros::Duration(2.0));

      try
      {
        projector_.transformLaserScanToPointCloud("base_link", previous_scan_, cloud, tfListener_); 
      }
      catch (tf::TransformException ex)
      {
        ROS_WARN("Problem: %s", ex.what());
      }

All my callback functions are coded this way:

    void PointCloudBuilder::poseLDCallback(const geometry_msgs::PoseStampedConstPtr& poseLD_ptr)
    {

            previous_poseLD_ = *poseLD_ptr;
            poseLD_updated_ = true;

            if(poseLD_updated_  && yaw_updated_ &&  scan_updated_)
                    computePointCloud();
    }

The emitted warning:

[ INFO] [1327752242.614698280]: pointcloud_builder_node started
[ WARN] [1327752243.045818408]: Problem: Frame id / does not exist! Frames (3): Frame   /laser exists with parent /base_link.
Frame /base_link exists with parent NO_PARENT.

[ WARN] [1327752243.364658771]: Problem: Unable to lookup transform, cache is empty, when looking up transform from frame [/laser] to frame [/base_link]

What I can see the warning was originated from the catch block, looking at the warning message of "Problem:..". But then, I'm stuck to proceed with this kind of warning.

edit retag flag offensive close merge delete

Comments

Is this just a startup issue? Have you resolved it?

tfoote gravatar image tfoote  ( 2012-03-27 09:42:07 -0500 )edit

Yes, it's resolved. Thanks for reminding me to update it!

alfa_80 gravatar image alfa_80  ( 2012-03-28 00:58:16 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-03-28 00:57:38 -0500

alfa_80 gravatar image

I've resolved it by using ros::Time::now(), instead of using my dataset's timestamp.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-01-27 22:15:35 -0500

Seen: 316 times

Last updated: Mar 28 '12