UNPKG

roslib

Version:

The standard ROS Javascript Library

41 lines (40 loc) 1.53 kB
import { rosapi } from '../types/rosapi.ts'; import { default as Ros } from './Ros.ts'; /** * A ROS parameter. */ export default class Param<T = unknown> { ros: Ros; name: string; /** * @param options * @param options.ros - The ROSLIB.Ros connection handle. * @param options.name - The param name, like max_vel_x. */ constructor({ ros, name }: { ros: Ros; name: string; }); /** * Fetch the value of the param. * * @param callback - The callback function. * @param [failedCallback] - The callback function when the service call failed or the parameter retrieval was unsuccessful. */ get(callback: (value: T) => void, failedCallback?: (error: string) => void): void; /** * Set the value of the param in ROS. * * @param value - The value to set param to. * @param [callback] - The callback function. * @param [failedCallback] - The callback function when the service call failed or the parameter setting was unsuccessful. */ set(value: T, callback?: (message: rosapi.SetParamResponse) => void, failedCallback?: (error: string) => void): void; /** * Delete this parameter on the ROS server. * * @param callback - The callback function. * @param [failedCallback] - The callback function when the service call failed or the parameter deletion was unsuccessful. */ delete(callback: (message: rosapi.DeleteParamResponse) => void, failedCallback?: (error: string) => void): void; }