Skip to content

Commit 026bf1b

Browse files
authored
Put time back to ROS 1 time for now (#1017)
1 parent 728e44d commit 026bf1b

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

src/actionlib/Goal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export default class Goal<T> extends EventEmitter {
4141
this.goalMessage = {
4242
goal_id: {
4343
stamp: {
44-
sec: 0,
45-
nsec: 0,
44+
secs: 0,
45+
nsecs: 0,
4646
},
4747
id: this.goalID,
4848
},

src/actionlib/SimpleActionServer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default class SimpleActionServer<
9797
// Track the goals and their status in order to publish status...
9898
this.statusMessage = {
9999
header: {
100-
stamp: { sec: 0, nsec: 100 },
100+
stamp: { secs: 0, nsecs: 100 },
101101
frame_id: "",
102102
},
103103
/** @type {{goal_id: any, status: number}[]} */
@@ -143,8 +143,8 @@ export default class SimpleActionServer<
143143
cancelListener.subscribe((cancelMessage) => {
144144
// cancel ALL goals if both empty
145145
if (
146-
cancelMessage.stamp.sec === 0 &&
147-
cancelMessage.stamp.nsec === 0 &&
146+
cancelMessage.stamp.secs === 0 &&
147+
cancelMessage.stamp.nsecs === 0 &&
148148
cancelMessage.id === ""
149149
) {
150150
this.nextGoal = null;
@@ -189,7 +189,7 @@ export default class SimpleActionServer<
189189
);
190190
this.statusMessage.header = {
191191
...this.statusMessage.header,
192-
stamp: { sec: secs, nsec: nsecs },
192+
stamp: { secs, nsecs },
193193
};
194194
statusPublisher.publish(this.statusMessage);
195195
}, 500); // publish every 500ms

src/types/actionlib_msgs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { GoalStatus as GoalStatusEnum } from "../core/GoalStatus.js";
44
export namespace actionlib_msgs {
55
export interface GoalID {
66
id: string;
7-
stamp: { sec: number; nsec: number };
7+
stamp: std_msgs.time;
88
}
99
export interface GoalStatus {
1010
goal_id: GoalID;

src/types/std_msgs.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ export namespace std_msgs {
22
// rosbridge fills this in with defaults if you leave them unspecified, which is common in roslibjs code, so we artificially make it a Partial
33
export type ROS1Header = Partial<{
44
seq: number;
5-
stamp: { sec: number; nsec: number };
5+
stamp: time;
66
frame_id: string;
77
}>;
8+
// This is ROS 1 time. It is rectified to ROS 2 time by rosbridge_suite in-transit. We'll switch this to ROS 2 time when we drop ROS 1 support.
9+
export interface time {
10+
secs: number;
11+
nsecs: number;
12+
}
813
}

0 commit comments

Comments
 (0)