Converted trapezoid_profile over to monotonic_clock
This also involves updating all the callers, and updating
control_loop's frequency variable.
Change-Id: Ic88d2715db30efcc25721da2dd8c89910ede7788
diff --git a/aos/common/util/trapezoid_profile.cc b/aos/common/util/trapezoid_profile.cc
index f441fbe..4e4546e 100644
--- a/aos/common/util/trapezoid_profile.cc
+++ b/aos/common/util/trapezoid_profile.cc
@@ -7,10 +7,8 @@
namespace aos {
namespace util {
-TrapezoidProfile::TrapezoidProfile(const time::Time &delta_time)
- : maximum_acceleration_(0),
- maximum_velocity_(0),
- timestep_(delta_time) {
+TrapezoidProfile::TrapezoidProfile(::std::chrono::nanoseconds delta_time)
+ : maximum_acceleration_(0), maximum_velocity_(0), timestep_(delta_time) {
output_.setZero();
}
@@ -26,7 +24,9 @@
double goal_velocity) {
CalculateTimes(goal_position - output_(0), goal_velocity);
- double next_timestep = timestep_.ToSeconds();
+ double next_timestep =
+ ::std::chrono::duration_cast<::std::chrono::duration<double>>(timestep_)
+ .count();
if (acceleration_time_ > next_timestep) {
UpdateVals(acceleration_, next_timestep);