Skip to content

Commit

Permalink
Change datatype of timeout from int to milliseconds
Browse files Browse the repository at this point in the history
  • Loading branch information
abnv-goyal committed Nov 9, 2024
1 parent 2823947 commit 1e31620
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/TunePID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ extern "C" {
#include "HindsightCAN/CANCommon.h"
}

enum class targetmode_t {
step, sinusoidal
enum class targetmode_t
{
step,
sinusoidal
};

using namespace robot::types;
Expand Down Expand Up @@ -138,10 +140,9 @@ int main(int argc, char** argv) {
double period = 8.0;

time_point<steady_clock> start = steady_clock::now();
constexpr int timeout = 300ms;
constexpr milliseconds timeout = 300ms;
DataPoint<int32_t> starting_angle_data_point = can::motor::getMotorPosition(serial);
while (!starting_angle_data_point.isValid() &&
steady_clock::now() - start < milliseconds(timeout)) {
while (!starting_angle_data_point.isValid() && steady_clock::now() - start < timeout) {
starting_angle_data_point = can::motor::getMotorPosition(serial);
}

Expand Down

0 comments on commit 1e31620

Please sign in to comment.