Skip to content

Commit

Permalink
Fix wrong clock message type
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoninRousset committed Aug 14, 2023
1 parent 7081170 commit 94e33e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/time_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand All @@ -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)
);
Expand Down
4 changes: 2 additions & 2 deletions test/test-time-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 94e33e1

Please sign in to comment.