Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/roslib/src/core/Action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @author Sebastian Castro - sebastian.castro@picknik.ai
*/

import { actionlib_msgs } from "../types/actionlib_msgs.ts";
import { GoalStatus } from "./GoalStatus.ts";
import type { RosbridgeSendActionGoalMessage } from "../types/protocol.ts";
import {
Expand All @@ -13,6 +14,8 @@ import {
} from "../types/protocol.ts";
import type Ros from "./Ros.ts";
import { v4 as uuidv4 } from "uuid";
import Topic from "./Topic.ts";
import GoalStatusArray = actionlib_msgs.GoalStatusArray;

class GoalError extends Error {
override name = "GoalError";
Expand Down Expand Up @@ -292,4 +295,15 @@ export default class Action<
result: false,
});
}

/**
* Returns the status topic for this action.
*/
getStatusTopic() {
return new Topic<GoalStatusArray>({
ros: this.ros,
name: `${this.name}/_action/status`,
messageType: "action_msgs/msg/GoalStatusArray",
});
}
}