[Documentation] [TitleIndex] [WordIndex

rosnodejs exposes a thin wrapper around xmlrpc in order to interact with the Parameter Server. All of the methods return a Promise that resolves when the method call is complete. You can use this API to set and retrieve strings, numbers, booleans, lists, and objects.

Getting Parameters

Fetches a value from the parameter server. Promise will resolve with the value of the parameter if it exists.

nh.getParam(paramName)
.then((paramValue) => {
  // a whole new parameter-y world
});

Setting Parameters

Sets a value on the parameter server.

nh.setParam(paramName, paramValue);

nh.setParam('a_string', 'baz');
nh.setParam('~private_int', 2);
nh.setParam('list_of_floats', [1.1, 2.2, 3.3, 4.4]);
nh.setParam('gains', {'p': 1, 'i': 2, 'd': 3});

Parameter Existence

Check if the parameter server has the specified parameter.

nh.hasParam(paramName)
.then((exists) => {
  console.log('Has param ? ' + exists);
});

Delete Parameters

Removes a parameter from the parameter server.

nh.deleteParam(paramName);


2024-12-14 18:16