Skip to content

Commit

Permalink
BUGFIX: Wrong speed conversion factor (#157)
Browse files Browse the repository at this point in the history
The current code assumed time intervals from the Phisgets API was microseconds, but it's actually milliseconds. Reported speeds are all wrong by a factor of 1e3.

Co-authored-by: Jose Luis Blanco-Claraco <joseluisblancoc@gmail.com>
  • Loading branch information
mintar and jlblancoc committed Dec 22, 2022
1 parent acf156a commit c5c7e7f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void HighSpeedEncoderRosI::positionChangeHandler(int channel,
{
std::lock_guard<std::mutex> lock(encoder_mutex_);

double instantaneous_speed = position_change / (time * 1e-6);
double instantaneous_speed = position_change / (time * 1e-3);
enc_data_to_pub_[channel].instantaneous_speed = instantaneous_speed;
enc_data_to_pub_[channel].speeds_buffer.push_back(instantaneous_speed);
enc_data_to_pub_[channel].speed_buffer_updated = true;
Expand Down

0 comments on commit c5c7e7f

Please sign in to comment.