Skip to content

Commit a6687ba

Browse files
feat: Merge pull request #24 from 6RiverSystems/feat/goal-timestamp
feat: adding timestamp for goals MOVEMENT-1442
2 parents 0c0145d + 29b7e18 commit a6687ba

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/actionlib/ActionClient.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,13 @@ ActionClient.prototype.__proto__ = EventEmitter2.prototype;
125125
* Cancel all goals associated with this ActionClient.
126126
*/
127127
ActionClient.prototype.cancel = function() {
128-
var cancelMessage = new Message();
128+
var date = new Date();
129+
var cancelMessage = new Message({
130+
stamp: {
131+
secs : Math.floor(date * 1e-3),
132+
nsecs : date % 1000 * 1000000
133+
}
134+
});
129135
this.cancelTopic.publish(cancelMessage);
130136
};
131137

src/actionlib/Goal.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ function Goal(options) {
3232
this.goalMessage = new Message({
3333
goal_id : {
3434
stamp : {
35-
secs : 0,
36-
nsecs : 0
35+
secs : Math.floor(date * 1e-3),
36+
nsecs : date % 1000 * 1000000
3737
},
3838
id : this.goalID
3939
},
@@ -80,7 +80,12 @@ Goal.prototype.send = function(timeout) {
8080
* Cancel the current goal.
8181
*/
8282
Goal.prototype.cancel = function() {
83+
var date = new Date();
8384
var cancelMessage = new Message({
85+
stamp: {
86+
secs : Math.floor(date * 1e-3),
87+
nsecs : date % 1000 * 1000000
88+
},
8489
id : this.goalID
8590
});
8691
this.actionClient.cancelTopic.publish(cancelMessage);

0 commit comments

Comments
 (0)