UNPKG

@foxglove/ros1

Version:

Standalone TypeScript implementation of the ROS 1 (Robot Operating System) protocol with a pluggable transport layer

57 lines (45 loc) 1.76 kB
import { XmlRpcValue } from "@foxglove/xmlrpc"; import { RosXmlRpcClient } from "./RosXmlRpcClient"; import { RosXmlRpcResponse } from "./XmlRpcTypes"; export type ProtocolParams = [string, ...XmlRpcValue[]]; export class RosFollowerClient extends RosXmlRpcClient { async getBusStats(callerId: string): Promise<RosXmlRpcResponse> { return await this._methodCall("getBusStats", [callerId]); } async getBusInfo(callerId: string): Promise<RosXmlRpcResponse> { return await this._methodCall("getBusInfo", [callerId]); } async shutdown(callerId: string, msg = ""): Promise<RosXmlRpcResponse> { return await this._methodCall("shutdown", [callerId, msg]); } async getPid(callerId: string): Promise<RosXmlRpcResponse> { return await this._methodCall("getPid", [callerId]); } async getSubscriptions(callerId: string): Promise<RosXmlRpcResponse> { return await this._methodCall("getSubscriptions", [callerId]); } async getPublications(callerId: string): Promise<RosXmlRpcResponse> { return await this._methodCall("getPublications", [callerId]); } async paramUpdate( callerId: string, parameterKey: string, parameterValue: XmlRpcValue, ): Promise<RosXmlRpcResponse> { return await this._methodCall("paramUpdate", [callerId, parameterKey, parameterValue]); } async publisherUpdate( callerId: string, topic: string, publishers: string[], ): Promise<RosXmlRpcResponse> { return await this._methodCall("publisherUpdate", [callerId, topic, publishers]); } async requestTopic( callerId: string, topic: string, protocols: ProtocolParams[], ): Promise<RosXmlRpcResponse> { return await this._methodCall("requestTopic", [callerId, topic, protocols]); } }