Skip to content

Commit

Permalink
Fix modulo error (#2258)
Browse files Browse the repository at this point in the history
The denominator for the modulo operation was too large, causing
incorrect nanosecond timestamp values. The denominator should have been
1.0 instead of 10.0.


Co-authored-by: Misheel Bayartsengel <[email protected]>
  • Loading branch information
adamlm and MishkaMN authored Jan 5, 2024
1 parent 4413270 commit 4651dc4
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static auto to_ros_msg(const mot::CtraTrack & track)

msg.header.stamp.sec = mot::remove_units(units::math::floor(track.timestamp));
msg.header.stamp.nanosec = mot::remove_units(
units::time::nanosecond_t{units::math::fmod(track.timestamp, units::time::second_t{10.0})});
units::time::nanosecond_t{units::math::fmod(track.timestamp, units::time::second_t{1.0})});
msg.header.frame_id = "map";

msg.id = track.uuid.value();
Expand Down Expand Up @@ -204,7 +204,7 @@ static auto to_ros_msg(const mot::CtrvTrack & track)

msg.header.stamp.sec = mot::remove_units(units::math::floor(track.timestamp));
msg.header.stamp.nanosec = mot::remove_units(
units::time::nanosecond_t{units::math::fmod(track.timestamp, units::time::second_t{10.0})});
units::time::nanosecond_t{units::math::fmod(track.timestamp, units::time::second_t{1.0})});
msg.header.frame_id = "map";

msg.id = track.uuid.value();
Expand Down

0 comments on commit 4651dc4

Please sign in to comment.