roslib
    Preparing search index...

    Class Action<TGoal, TFeedback, TResult>

    A ROS 2 action client.

    Type Parameters

    • TGoal = unknown
    • TFeedback = unknown
    • TResult = unknown
    Index

    Constructors

    Properties

    actionType: string
    isAdvertised: boolean = false
    name: string
    ros: Ros

    Methods

    • Advertise the action. This turns the Action object from a client into a server. The callback will be called with every goal sent to this action.

      Parameters

      • actionCallback: (goal: TGoal, id: string) => void

        This works similarly to the callback for a C++ action.

      • cancelCallback: (id: string) => void

        A callback function to execute when the action is canceled.

      Returns void

    • Sends an action goal. Returns the feedback in the feedback callback while the action is running and the result in the result callback when the action is completed. Does nothing if this action is currently advertised.

      Parameters

      • goal: TGoal

        The action goal to send.

      • resultCallback: (result: TResult) => void

        The callback function when the action is completed.

      • OptionalfeedbackCallback: (feedback: TFeedback) => void

        The callback function when the action pulishes feedback.

      • OptionalfailedCallback: (error: string) => void = console.error

        The callback function when the action failed.

      Returns string | undefined