Utility Methods

getActiveSubscriptions()

Get list of currently subscribed topics.

Returns: Array - Array of subscribed topic names

getActivePublications()

Get list of currently published topics.

Returns: Array - Array of published topic names

resolveCmdVelTopic(preferredTopicName)

Resolve the best cmd_vel topic for robot control.

Parameters:

  • preferredTopicName (string, optional) - Preferred topic name

Returns: Promise<string> - Resolved cmd_vel topic name

JS
const cmdVelTopic = await oloClient.core.resolveCmdVelTopic('/cmd_vel'); console.log('Using cmd_vel topic:', cmdVelTopic);

discoverRobots(options)

Discover robot instances in the ROS environment by analyzing TF frames, topics, and services to identify distinct robot instances.

Parameters:

  • options (object, optional) - Discovery options
    • filterFn (function) - Optional filter function to apply to discovered robots
    • windowMs (number) - Time window to collect TF data (default: 800ms)
    • maxCacheMs (number) - Cache validity duration (default: 8000ms)

Returns: Promise<Array> - Array of discovered robot instances

Robot Instance Object:

JS
{ id: "instance_1", // Unique instance ID namespace: "robot1", // Robot namespace (empty string for global namespace) name: "Robot 1", // Human-friendly robot name baseFrame: "robot1/base_link", // Base frame reference (null for global namespace robots) frameCount: 15, // Number of TF frames in this robot's hierarchy signals: { hasCmdVel: true, // Has velocity control topic hasJointStates: true, // Has joint state information hasOdom: true, // Has odometry data hasControllers: false, // Has controller_manager hasSensors: true // Has sensor topics (cameras, lidars) }, confidence: 4, // Confidence score (0-5) based on detected signals topics: [ // All topics associated with this robot instance { topic: "/robot1/cmd_vel", messageType: "geometry_msgs/Twist" }, { topic: "/robot1/odom", messageType: "nav_msgs/Odometry" } ] }
JS
// Discover all robots in the environment const robots = await oloClient.core.discoverRobots(); console.log(`Found ${robots.length} robot instances:`); robots.forEach(robot => { console.log(`- ${robot.name} (namespace: ${robot.namespace || '(global)'}) [${robot.type}]`); console.log(` Base frame: ${robot.baseFrame || 'N/A'}`); console.log(` Confidence: ${robot.confidence}/5`); console.log(` Has cmd_vel: ${robot.signals.hasCmdVel}`); console.log(` Has joint_states: ${robot.signals.hasJointStates}`); }); // Example output in multi-robot environment: // Found 2 robot instances: // - robot1 (namespace: robot1) // Base frame: robot1/base_link // Confidence: 5/5 // Has cmd_vel: true // Has joint_states: true // - Global (namespace: (global)) // Base frame: N/A // Confidence: 3/5 // Has cmd_vel: false // Has joint_states: true // Filter for robots with high confidence const reliableRobots = await oloClient.core.discoverRobots({ filterFn: (robot) => robot.confidence >= 3 }); // Filter for mobile robots (have cmd_vel) const mobileRobots = await oloClient.core.discoverRobots({ filterFn: (robot) => robot.signals.hasCmdVel }); // Filter for manipulators/arms (have joints but no cmd_vel) const manipulators = await oloClient.core.discoverRobots({ filterFn: (robot) => robot.signals.hasJointStates && !robot.signals.hasCmdVel }); // Custom TF collection window const quickScan = await oloClient.core.discoverRobots({ windowMs: 500, // Shorter TF collection window for faster response maxCacheMs: 10000 // Longer cache duration });

How Robot Discovery Works:

  1. TF Analysis - Collects transform data from /tf and /tf_static topics to build robot frame hierarchies
  2. Connected Components - Groups related frames into distinct robot instances using graph analysis
  3. Namespace Detection - Identifies robot namespaces from TF frame prefixes (majority vote) and topic patterns
  4. Topic Scoring - Falls back to topic pattern scoring if TF prefixes are inconclusive
  5. Signal Detection - Analyzes topics to detect robot capabilities (movement, sensors, joints, controllers)
  6. Global Namespace Handling - Detects robots in global namespace (like manipulators, arms) that may not have TF components
  7. Confidence Scoring - Rates each discovered instance (0-5) based on detected robot signals
  8. Filtering & Merging - Deduplicates and merges components with same namespace
  9. Caching - Results are cached to avoid repeated expensive discovery operations

Use Cases:

  • Multi-robot environments where you need to identify available robots
  • Dynamic robot fleet management
  • Automatically adapting control interfaces to discovered robot capabilities
  • Detecting robot manipulators and arms in the global namespace
  • Debugging complex multi-robot ROS setups

Important Notes:

  • Each instance includes a type field (mobile_robot, robot_arm, or unknown) so you can filter or adapt UIs without re-analyzing signals
  • Mobile signals (cmd_vel, odom) take precedence: if present, the instance is mobile_robot even when it also has joint/arm topics
  • Global namespace robots (empty string namespace) are detected when they have robot-related topics (joint_states, robot_description, controller_manager) but no TF component; their type is derived the same way (e.g. robot_arm when only arm-like topics)
  • This is common for robot manipulators, arms (Panda, UR, etc.), and standalone joint controllers
  • The discovery uses an 800ms window by default to collect sufficient TF data - adjust windowMs if needed for your environment
  • Results are cached for 8 seconds by default to improve performance on repeated calls
  • For namespaced robots, topics are analyzed from both the specific namespace AND the global namespace

getClientInfo()

Get client version and loaded modules information.

Returns: Object - Version and module information

JS
const info = oloClient.getClientInfo(); console.log('Client version:', info.version); console.log('Available modules:', info.modules); console.log('Features:', info.features);

cleanup()

Clean up all resources without destroying the client. This also clears all internal caches (URDF, SRDF, robot info) so that subsequent calls to detectRobotInfo() and getSRDF() will fetch fresh data. This is important when switching between different robots to avoid sending a stale planning group name to MoveIt.

JS
oloClient.cleanup();

destroy()

Destroy the client and clean up all resources.

JS
oloClient.destroy();