Skip to content

Commit

Permalink
Follow-up of previous commit to convert all float64 timestamps correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
matlabbe committed Dec 2, 2024
1 parent e5667b2 commit 3bdbcdf
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions rtabmap_conversions/src/MsgConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,21 @@ bool deskew_impl(
else if(timeDatatype == 8) //float64
{
double sec = *((const double*)(&output.data[u*output.point_step]+offsetTime));
if(sec > 1.e18)
{
// convert nanoseconds to seconds
sec /= 1.e9;
}
else if(sec > 1.e15)
{
// convert microseconds to seconds
sec /= 1.e6;
}
else if(sec > 1.e12)
{
// sec milliseconds to seconds
sec /= 1.e3;
}
stamp = ros::Time(sec);
}

Expand Down Expand Up @@ -3296,6 +3311,21 @@ bool deskew_impl(
else if(timeDatatype == 8)
{
double sec = *((const double*)(&output.data[v*output.row_step]+offsetTime));
if(sec > 1.e18)
{
// convert nanoseconds to seconds
sec /= 1.e9;
}
else if(sec > 1.e15)
{
// convert microseconds to seconds
sec /= 1.e6;
}
else if(sec > 1.e12)
{
// sec milliseconds to seconds
sec /= 1.e3;
}
stamp = ros::Time(sec);
}

Expand Down

0 comments on commit 3bdbcdf

Please sign in to comment.