roslib
Version:
The standard ROS Javascript Library
71 lines (70 loc) • 2.64 kB
TypeScript
import { default as Ros } from '../core/Ros.ts';
import { default as Topic } from '../core/Topic.ts';
import { EventEmitter } from 'eventemitter3';
import { actionlib_msgs } from '../types/actionlib_msgs.ts';
import { default as Goal } from './Goal.ts';
/**
* An actionlib action client.
*
* Emits the following events:
* * 'timeout' - If a timeout occurred while sending a goal.
* * 'status' - The status messages received from the action server.
* * 'feedback' - The feedback messages received from the action server.
* * 'result' - The result returned from the action server.
*
*/
export default class ActionClient<TGoal = unknown, TFeedback = unknown, TResult = unknown> extends EventEmitter<{
timeout: undefined;
}> {
goals: Record<string, Goal<TGoal>>;
/** flag to check if a status has been received */
receivedStatus: boolean;
ros: Ros;
serverName: string;
actionName: string;
timeout?: number;
omitFeedback?: boolean;
omitStatus?: boolean;
omitResult?: boolean;
feedbackListener: Topic<{
status: actionlib_msgs.GoalStatus;
feedback: TFeedback;
}>;
statusListener: Topic<actionlib_msgs.GoalStatusArray>;
resultListener: Topic<{
status: actionlib_msgs.GoalStatus;
result: TResult;
}>;
goalTopic: Topic<{
goal: TGoal;
goal_id: actionlib_msgs.GoalID;
}>;
cancelTopic: Topic<Partial<actionlib_msgs.GoalID>>;
/**
* @param options
* @param options.ros - The ROSLIB.Ros connection handle.
* @param options.serverName - The action server name, like '/fibonacci'.
* @param options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'.
* @param [options.timeout] - The timeout length when connecting to the action server.
* @param [options.omitFeedback] - The flag to indicate whether to omit the feedback channel or not.
* @param [options.omitStatus] - The flag to indicate whether to omit the status channel or not.
* @param [options.omitResult] - The flag to indicate whether to omit the result channel or not.
*/
constructor({ ros, serverName, actionName, timeout, omitFeedback, omitStatus, omitResult, }: {
ros: Ros;
serverName: string;
actionName: string;
timeout?: number;
omitFeedback?: boolean;
omitStatus?: boolean;
omitResult?: boolean;
});
/**
* Cancel all goals associated with this ActionClient.
*/
cancel(): void;
/**
* Unsubscribe and unadvertise all topics associated with this ActionClient.
*/
dispose(): void;
}