From 13ec992764cb1da2da077b909258339fa7691ee1 Mon Sep 17 00:00:00 2001 From: Antonin Rousset Date: Fri, 18 Aug 2023 07:10:27 +0200 Subject: [PATCH] Fix wrong clock message type (#928) Co-authored-by: AntoninRousset --- lib/time_source.js | 4 ++-- test/test-time-source.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/time_source.js b/lib/time_source.js index 3d2edf9b..d08928a1 100644 --- a/lib/time_source.js +++ b/lib/time_source.js @@ -176,7 +176,7 @@ class TimeSource { } _clockCallback(msg) { - this._lastTimeSet = Time.fromMsg(msg); + this._lastTimeSet = Time.fromMsg(msg.clock); this._associatedClocks.forEach((clock) => { clock.rosTimeOverride = this._lastTimeSet; }); @@ -185,7 +185,7 @@ class TimeSource { _subscribeToClockTopic() { if (!this._clockSubscription && this._node) { this._clockSubscription = this._node.createSubscription( - 'builtin_interfaces/msg/Time', + 'rosgraph_msgs/msg/Clock', CLOCK_TOPIC, this._clockCallback.bind(this) ); diff --git a/test/test-time-source.js b/test/test-time-source.js index 2e574572..b3e33c5c 100644 --- a/test/test-time-source.js +++ b/test/test-time-source.js @@ -45,10 +45,10 @@ describe('rclnodejs TimeSource testing', function () { }); function publishClockMessage(node) { - let pub = node.createPublisher('builtin_interfaces/msg/Time', '/clock'); + let pub = node.createPublisher('rosgraph_msgs/msg/Clock', '/clock'); let count = 0; timer = setInterval(() => { - pub.publish({ sec: count, nanosec: 0 }); + pub.publish({ clock: { sec: count, nanosec: 0 } }); count += 1; }, 1000); }