Topic listing and robot namespacesΒΆ

Use olo.core.Core to inspect ROS topics and resolve the default robot namespace.

from olo import Client

with Client() as client:
    # List all topics and their message types.
    topics = client.core.list_topics(timeout=2.0)
    for topic in topics:
        print(topic.name, topic.msg_type)

    # Resolve the default robot namespace when unambiguous.
    robot = client.robot()
    print(robot.namespace or "<global>")
import { connect } from "olo/web";

const client = connect();

// List all topics and their message types.
const topics = await client.core.listTopics({ timeoutMs: 2000 });
for (const topic of topics) {
  console.log(topic.name, topic.msgType);
}

// Resolve the default robot namespace when unambiguous.
const robot = await client.robot();
console.log(robot.namespace || "<global>");