auto-ros - v2.2.0
    Preparing search index...

    Class AutoRos

    Auto reconnecting wrapper of ROSLIB.Ros

    This class extends EventEmitter and provides automatic reconnection functionality for ROS connections through rosbridge.

    import AutoRos from 'auto-ros'

    const autoRos = new AutoRos()
    autoRos.connect('ws://localhost:9090')

    autoRos.on('status', (status) => {
    console.log('Connection status:', status)
    })

    Hierarchy

    • EventEmitter
      • AutoRos
    Index

    Constructors

    Properties

    ros: Ros

    The underlying Ros instance

    prefixed: string | boolean

    Accessors

    Methods

    • Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • fn: (...args: any[]) => void
      • Optionalcontext: any

      Returns this

    • Connect to rosbridge

      If a URL is provided, it will connect to that one. Otherwise, it will use the previous URL. Uses a URL based on the hostname if no URLs have been provided.

      Parameters

      • Optionalurl: string

        WebSocket URL to connect to (e.g., 'ws://localhost:9090')

      Returns void

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

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • ...args: any[]

      Returns boolean

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

      Returns (string | symbol)[]

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

      Parameters

      • event: string | symbol

      Returns number

    • Return the listeners registered for a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T

      Returns ((...args: any[]) => void)[]

    • Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • Optionalfn: (...args: any[]) => void
      • Optionalcontext: any
      • Optionalonce: boolean

      Returns this

    • Add a listener for a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • fn: (...args: any[]) => void
      • Optionalcontext: any

      Returns this

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

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • fn: (...args: any[]) => void
      • Optionalcontext: any

      Returns this

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

      Parameters

      • Optionalevent: string | symbol

      Returns this

    • Remove the listeners of a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • Optionalfn: (...args: any[]) => void
      • Optionalcontext: any
      • Optionalonce: boolean

      Returns this