[Documentation] [TitleIndex] [WordIndex

Loading the rosparam service

Using an Orocos program script at deployment

/!\ Make sure you have a roscore running before you start the deployer.

An example script test.ops:

   1 import(your_component_package)
   2 import("rtt_ros_param")
   3 loadComponent("YourComponentName","your_component_package::YourComponent")
   4 loadService("YourComponentName","rosparam")
   5 #Store all properties on the ROS parameter server
   6 YourComponentName.rosparam.storeProperties()
   7 #Refresh all properties with the values on the ROS parameter server if available
   8 YourComponentName.rosparam.refreshProperties()
   9 #Store a single property on the ROS parameter server, in the global namespace
  10 YourComponentName.rosparam.storeProperty("PropertyName",false,false)
  11 #Refresh a single property from the ROS parameter server, from the private and relative namespace
  12 YourComponentName.rosparam.refreshProperty("PropertyName",true,true)

Which you can run using:

rosrun ocl deployer-gnulinux -s test.ops

The meaning of the rosparam functions are explained in the next section.

Available rosparam functions

Storing Properties on the ROS parameter server

Storing a single property

   1 bool storeProperty(string PropertyName, bool private_namespace, bool relative_component_name)

The storeProperty function takes 3 arguments:

  1. propertyName: this is the name of the Property you want to store

  2. private_namespace: a boolean indicating if you want to store the Property in the private namespace of the deployer

  3. relative_component_name: a boolean indicating if you want to store the Property in the namespace of the component

storeProperty will return false if RTT does not know how to store the Property, this can happen if you do not have a RTT typekit for the Property type.

This results in 4 possibilities of storing the Property on the parameter server:

Storing all properties

   1 bool storeProperties()

This will always store all the components properties in the private and relative component namespace:

/nodeName/componentName/propertyName1

/nodeName/componentName/propertyName2

...

/nodeName/componentName/propertyNameN

Refreshing Property values from the ROS parameter server

Refresh a single properties

   1 bool refreshProperty(string PropertyName, bool private_namespace, bool relative_component_name)

The refreshProperty function takes 3 arguments:

  1. propertyName: this is the name of the Property you want to refresh

  2. private_namespace: a boolean indicating if you want to refresh the Property from the private namespace of the deployer

  3. relative_component_name: a boolean indicating if you want to refresh the Property from the namespace of the component

refreshProperty will return false if the parameter is not found on the parameter server or if RTT does not know how to compose the Property value from the paramter value, this can happen if you do not have a RTT typekit for the Property type.

This results in 4 possibilities of refreshing the Property from the parameter server:

Refresh all properties

   1 bool refreshProperties()

This will always refresh all the components properties from the private and relative component namespace if they are availabe, if one of the properties in not found, refreshProperties will silently go on.


2024-12-07 18:19