diff --git a/packages/roslib/src/core/Action.ts b/packages/roslib/src/core/Action.ts index adcc5c13e..715a10b2f 100644 --- a/packages/roslib/src/core/Action.ts +++ b/packages/roslib/src/core/Action.ts @@ -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 { @@ -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"; @@ -292,4 +295,15 @@ export default class Action< result: false, }); } + + /** + * Returns the status topic for this action. + */ + getStatusTopic() { + return new Topic({ + ros: this.ros, + name: `${this.name}/_action/status`, + messageType: "action_msgs/msg/GoalStatusArray", + }); + } }