mrpt-ros-pkg / mrpt_slam

ROS wrappers for SLAM algorithms in MRPT
http://wiki.ros.org/mrpt_slam
BSD 3-Clause "New" or "Revised" License
114 stars 49 forks source link

[ INFO] [1487222698.043716432, 2244.557000000]: Failed to subtract global_frame (/map) from odom_frame (/odom) #19

Closed andrestoga closed 7 years ago

andrestoga commented 7 years ago

Hi,

I'm getting the following error when I feed the topic /landmark with observations:

[ INFO] [1487222698.043716432, 2244.557000000]: Failed to subtract global_frame (/map) from odom_frame (/odom)

Plus I cannot get the transformation from base_link to map:

Exception thrown:Lookup would require extrapolation into the past. Requested time 0.100000000 but the earliest data is at time 2717.133000000, when looking up transform from frame [base_link] to frame [map]

I don't know why the Most recent transform and the oldest transform of the map frame is always 0.1:

http://imgur.com/a/remCB

Best,

andrestoga commented 7 years ago

Seems like getting the time in method EKFslamWrapper::landmarkCallback

185 timeLastUpdate_ = sf->getObservationByIndex(0)->timestamp;

is setting a value different to the one of the observation and in line:

468 mrpt_bridge::convert(timeLastUpdate_, stamp);

is changing also the value which at the end will be .1 and will throw the error of extrapolation. To fix it, I just set the time of the msg directly to that variable in method EKFslamWrapper::landmarkCallback

timeLastUpdate_ = _msg.header.stamp.toSec();

and then use it to initialize a ros::Time in the EKFslamWrapper::publishTF method:

ros::Time stamp(timeLastUpdate_);

with that, now, it can get the transformation. Let me know if that is that a correct way to fix it.

Best,

Logrus commented 7 years ago

Hi andrestoga,

Thanks for looking into this! Unfortunately I've been pilled up with other things and couldn't look up what is the problem myself. Your solution seems reasonable, please fill free to make a pull request, I'd be happy to review and merge your changes.

Best, Vladislav

Logrus commented 7 years ago

The problem occurred because tf transform were published even when no new robot poses were computed. It should be fixed right now.