From 3c20d70c767eb2f6d72b8a6600bef9c8130b652d Mon Sep 17 00:00:00 2001 From: AndrewHWang1605 <70298553+AndrewHWang1605@users.noreply.github.com> Date: Mon, 29 Apr 2024 19:08:28 -0700 Subject: [PATCH] Update ff_sim/ff_sim/controller_metrics.py Change incorrect usage of self.get_clock().now() function Co-authored-by: Alvin Sun --- ff_sim/ff_sim/controller_metrics.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ff_sim/ff_sim/controller_metrics.py b/ff_sim/ff_sim/controller_metrics.py index e725d3c..83a8550 100755 --- a/ff_sim/ff_sim/controller_metrics.py +++ b/ff_sim/ff_sim/controller_metrics.py @@ -88,10 +88,8 @@ def process_new_wheel_cmd(self, msg: WheelVelCommand) -> None: def process_new_binary_thrust_cmd(self, msg: ThrusterCommand) -> None: """Process binary thrusters""" - now = self.get_clock().now().to_msg() - dtsec = now.sec - self.curr_time.sec - dtnsec = now.nanosec - self.curr_time.nanosec - dt = dtsec + dtnsec / 1e9 + now = self.get_clock().now() + dt = (now - self.curr_time).nanoseconds / 1e9 # Perform Euler integration for how long each thruster was on thrusters = np.array(msg.switches, dtype=float)