bohlender / sicks300

ROS package for reading continuous data output of the SICK S300 Professional laser scanner. Supports both the old (v.1.02) and the new (v.1.03) protocol
http://wiki.ros.org/sicks300
GNU General Public License v3.0
5 stars 17 forks source link

both amcl and gmapping do not work with this driver because of zero header time of each scan message #12

Closed marija185 closed 3 years ago

marija185 commented 3 years ago

Hello Alexandre

we found an issue with the driver. The header time of the scan message is always zero so both amcl and gmapping can not work with such a scan message. We solved this by putting the line:

m_receivedTime = ros::Time::now();

at the line 256 of src/serialcomm_s300.cpp.

Can you please double check this and make the change? If not I can fork this driver and make a merge request later.

best regards

Marija

bohlender commented 3 years ago

Hello Marija,

no idea who "Alexandre" is but I'm surprised that m_receivedTime seems to always be zero in your case. I would expect it to be set whenever a header is read.

If I understand you correctly, you suggest to update m_receivedTime on every call of SerialCommS300::readData by moving the above assignment to line 256. This will change the semantics of m_receivedTime though. With this change, m_receivedTime won't denote the header's time of arrival anymore but rather the time when SerialCommS300::readData was called. I have a feeling that this is only a spurious fix to the issue you encountered.

Unfortunately I don't have access to an S300 Pro laser scanner anymore (I'm working in a different place now) so I cannot assess the suggested change properly. Can someone else with access to the laser chime in? I'd also be happy to make the above change, or approve a corresponding merge request, if someone with said laser scanner can confirm the change of semantics being unproblematic.

marija185 commented 3 years ago

Hello Dimitri I'm sorry for the open issue. I did a mistake. I was looking at the wrong driver. The actual problem was in this driver taken from yours: https://github.com/alexdesaint/Sick300Pro_ROS_TCP

Here m_receivedTime was never set.

best regards

Marija