roslib
    Preparing search index...

    Class Ros

    Manages connection to the rosbridge server and all interactions with ROS.

    Emits the following events:

    • 'connection' - Connected to the rosbridge server.
    • 'close' - Disconnected to the rosbridge server.
    • 'error' - There was an error with ROS.
    • <topicName> - A message came from rosbridge with the given topic name.
    • <serviceID> - A service response came from rosbridge with the given ID.

    Hierarchy

    Index

    Constructors

    • Parameters

      • __namedParameters: { transportFactory?: ITransportFactory; url?: string } = {}
        • OptionaltransportFactory?: ITransportFactory

          The factory to use to create a transport. Defaults to a WebSocket transport factory.

        • Optionalurl?: string

          The rosbridge server URL. Can be specified later with connect. If specified, then will immediately try to connect to the server.

      Returns Ros

    Properties

    prefixed: string | boolean

    Accessors

    Methods

    • Type Parameters

      • T extends string

      Parameters

      • event: T
      • fn: (
            ...args: ArgumentMap<
                { close: [unknown]; connection: [unknown]; error: [unknown] } & Record<
                    string,
                    [RosbridgeMessage],
                >,
            >[Extract<T, string>],
        ) => void
      • Optionalcontext: any

      Returns this

    • Send an authorization request to the server.

      Parameters

      • mac: string

        MAC (hash) string given by the trusted source.

      • client: string

        IP of the client.

      • dest: string

        IP of the destination.

      • rand: string

        Random string given by the trusted source.

      • t: number

        Time of the authorization request.

      • level: string

        User level as a string given by the client.

      • end: number

        End time of the client's session.

      Returns void

    • Parameters

      • url: string

      Returns Promise<void>

    • Calls each of the listeners registered for a given event.

      Type Parameters

      • T extends string

      Parameters

      • event: T
      • ...args: ArgumentMap<
            { close: [unknown]; connection: [unknown]; error: [unknown] } & Record<
                string,
                [RosbridgeMessage],
            >,
        >[Extract<T, string>]

      Returns boolean

    • Return an array listing the events for which the emitter has registered listeners.

      Returns string[]

    • Retrieve a list of action servers in ROS as an array of string.

      Parameters

      • callback: (actionservers: string[]) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Retrieve the details of a ROS message.

      Parameters

      • message: string

        The name of the message type.

      • callback: (typedefs: TypeDef[]) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Retrieve a list of subscribed topics, publishing topics and services of a specific node.

      Parameters

      • node: string

        Name of the node.

      • callback: (result: NodeDetailsResponse) => void
      • failedCallback: (error: string) => void = console.error

      Returns void

    • Retrieve a list of active node names in ROS.

      Parameters

      • callback: (result: string[]) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Retrieve a list of parameter names from the ROS Parameter Server.

      Parameters

      • callback: (names: string[]) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Retrieve the details of a ROS service request.

      Parameters

      • type: string

        The type of the service.

      • callback: (result: ServiceRequestDetailsResponse) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Retrieve the details of a ROS service response.

      Parameters

      • type: string

        The type of the service.

      • callback: (result: ServiceResponseDetailsResponse) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Retrieve a list of active service names in ROS.

      Parameters

      • callback: (services: string[]) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Retrieve a list of services in ROS as an array as specific type.

      Parameters

      • serviceType: string

        The service type to find.

      • callback: (services: string[]) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Retrieve the type of a ROS service.

      Parameters

      • service: string

        Name of the service.

      • callback: (type: string) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Retrieve a list of topics in ROS as an array.

      Parameters

      • callback: (result: TopicsResponse) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Retrieve a list of topics and their associated type definitions.

      Parameters

      • callback: (result: TopicsAndRawTypesResponse) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Retrieve a list of topics in ROS as an array of a specific type.

      Parameters

      • topicType: string

        The topic type to find.

      • callback: (topics: string[]) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Retrieve the type of a ROS topic.

      Parameters

      • topic: string

        Name of the topic.

      • callback: (type: string) => void

        Function with the following params:

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

        The callback function when the service call failed with params:

      Returns void

    • Return the number of listeners listening to a given event.

      Parameters

      • event: string

      Returns number

    • Return the listeners registered for a given event.

      Type Parameters

      • T extends string

      Parameters

      • event: T

      Returns (
          (
              ...args: ArgumentMap<
                  { close: [unknown]; connection: [unknown]; error: [unknown] } & Record<
                      string,
                      [RosbridgeMessage],
                  >,
              >[Extract<T, string>],
          ) => void
      )[]

    • Type Parameters

      • T extends string

      Parameters

      • event: T
      • Optionalfn: (
            ...args: ArgumentMap<
                { close: [unknown]; connection: [unknown]; error: [unknown] } & Record<
                    string,
                    [RosbridgeMessage],
                >,
            >[Extract<T, string>],
        ) => void
      • Optionalcontext: any
      • Optionalonce: boolean

      Returns this

    • Add a listener for a given event.

      Type Parameters

      • T extends string

      Parameters

      • event: T
      • fn: (
            ...args: ArgumentMap<
                { close: [unknown]; connection: [unknown]; error: [unknown] } & Record<
                    string,
                    [RosbridgeMessage],
                >,
            >[Extract<T, string>],
        ) => void
      • Optionalcontext: any

      Returns this

    • Add a one-time listener for a given event.

      Type Parameters

      • T extends string

      Parameters

      • event: T
      • fn: (
            ...args: ArgumentMap<
                { close: [unknown]; connection: [unknown]; error: [unknown] } & Record<
                    string,
                    [RosbridgeMessage],
                >,
            >[Extract<T, string>],
        ) => void
      • Optionalcontext: any

      Returns this

    • Type Parameters

      • T

      Parameters

      • options: Omit<ConstructorParameters<typeof Param>[0], "ros">

      Returns Param<T>

    • Remove all listeners, or those of the specified event.

      Parameters

      • Optionalevent: string

      Returns this

    • Remove the listeners of a given event.

      Type Parameters

      • T extends string

      Parameters

      • event: T
      • Optionalfn: (
            ...args: ArgumentMap<
                { close: [unknown]; connection: [unknown]; error: [unknown] } & Record<
                    string,
                    [RosbridgeMessage],
                >,
            >[Extract<T, string>],
        ) => void
      • Optionalcontext: any
      • Optionalonce: boolean

      Returns this

    • Send a set_level request to the server.

      Parameters

      • level: "error" | "info" | "warning" | "none"

        Status level (none, error, warning, info).

      • Optionalid: string

        Operation ID to change status level on.

      Returns void

    • Type Parameters

      • T

      Parameters

      • options: Omit<ConstructorParameters<typeof Topic>[0], "ros">

      Returns Topic<T>