UNPKG

roslib

Version:

The standard ROS Javascript Library

46 lines (45 loc) 1.43 kB
import { EventEmitter } from 'eventemitter3'; import { default as ActionClient } from './ActionClient.ts'; import { actionlib_msgs } from '../types/actionlib_msgs.ts'; /** * An actionlib goal that is associated with an action server. * * Emits the following events: * * 'timeout' - If a timeout occurred while sending a goal. */ export default class Goal<TGoal, TFeedback = unknown, TResult = unknown> extends EventEmitter<{ timeout: undefined; status: [actionlib_msgs.GoalStatus]; feedback: [TFeedback]; result: [TResult]; }> { isFinished: boolean; status?: actionlib_msgs.GoalStatus; result?: TResult; feedback?: TFeedback; goalID: string; actionClient: ActionClient<TGoal, TFeedback, TResult>; goalMessage: { goal: TGoal; goal_id: actionlib_msgs.GoalID; }; /** * @param options * @param options.actionClient - The ROSLIB.ActionClient to use with this goal. * @param options.goalMessage - The JSON object containing the goal for the action server. */ constructor({ actionClient, goalMessage, }: { actionClient: ActionClient<TGoal, TFeedback, TResult>; goalMessage: TGoal; }); /** * Send the goal to the action server. * * @param [timeout] - A timeout length for the goal's result. */ send(timeout?: number): void; /** * Cancel the current goal. */ cancel(): void; }