Skip to content

Commit e2a2f1f

Browse files
jstnhuangchris-smith
authored andcommitted
Used Time.now() instead of timeUtils.now() in action server/client (#100)
1 parent fa98c27 commit e2a2f1f

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/actions/ActionServer.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const EventEmitter = require('events');
2323

2424
const ActionServerInterface = require('../lib/ActionServerInterface.js');
2525
const GoalHandle = require('./GoalHandle.js');
26+
const Time = require('../lib/Time.js');
2627

2728
let GoalIdMsg = null;
2829
let GoalStatusMsg = null;
@@ -185,28 +186,28 @@ class ActionServer extends EventEmitter {
185186

186187
publishResult(status, result) {
187188
const msg = this._createMessage('actionResult', { status, result });
188-
msg.header.stamp = timeUtils.now();
189+
msg.header.stamp = Time.now();
189190
msg.header.seq = this._getAndIncrementSeq('actionResult');
190191
this._asInterface.publishResult(msg);
191192
this.publishStatus();
192193
}
193194

194195
publishFeedback(status, feedback) {
195196
const msg = this._createMessage('actionFeedback', { status, feedback });
196-
msg.header.stamp = timeUtils.now();
197+
msg.header.stamp = Time.now();
197198
msg.header.seq = this._getAndIncrementSeq('actionFeedback');
198199
this._asInterface.publishFeedback(msg);
199200
this.publishStatus();
200201
}
201202

202203
publishStatus() {
203204
const msg = new GoalStatusArrayMsg();
204-
msg.header.stamp = timeUtils.now();
205+
msg.header.stamp = Time.now();
205206
msg.header.seq = this._getAndIncrementSeq('status');
206207

207208
let goalsToRemove = new Set();
208209

209-
const now = timeUtils.toNumber(timeUtils.now());
210+
const now = timeUtils.toNumber(Time.now());
210211

211212
for (let i = 0, len = this._goalHandleList.length; i < len; ++i) {
212213
const goalHandle = this._goalHandleList[i];

src/lib/ActionClientInterface.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
'use strict';
1919

20-
const timeUtils = require('../utils/time_utils.js');
2120
const msgUtils = require('../utils/message_utils.js');
2221
const EventEmitter = require('events');
22+
const Time = require('./Time.js');
2323
let GoalID = null;
2424
let Header = null;
2525

@@ -100,7 +100,7 @@ class ActionClientInterface extends EventEmitter {
100100
* @param [goalId] {string} id of the goal to cancel
101101
*/
102102
cancel(goalId) {
103-
const cancelGoal = new GoalID({stamp: timeUtils.now()});
103+
const cancelGoal = new GoalID({stamp: Time.now()});
104104
if (!goalId) {
105105
this._cancelPub.publish(cancelGoal);
106106
}
@@ -113,7 +113,7 @@ class ActionClientInterface extends EventEmitter {
113113
sendGoal(goal) {
114114
if (!goal.goal_id) {
115115
goal.goal_id = new GoalID({
116-
stamp: timeUtils.now(),
116+
stamp: Time.now(),
117117
id: this.generateGoalId()
118118
});
119119
}

0 commit comments

Comments
 (0)