Main Content

search

Search ROS network for parameter names

Description

example

pnames = search(ptree,searchstr) searches within the parameter tree ptree and returns the parameter names that contain the specified search string, searchstr.

[pnames,pvalues] = search(ptree,searchstr) also returns the parameter values.

The following ROS data types are supported as values of parameters. For each ROS data type, the corresponding MATLAB data type is also listed:

  • 32-bit integers — int32

  • Booleans — logical

  • doubles — double

  • strings — string scalar, string, or character vector, char

  • lists — cell array

  • dictionaries — structure

Examples

collapse all

Connect to ROS network. Specify the IP address of the ROS master.

rosinit('192.168.17.128')
Initializing global node /matlab_global_node_48144 with NodeURI http://192.168.17.1:54848/

Create a parameter tree.

ptree = rosparam;

Search for parameter names that contain 'gravity'.

[pnames,pvalues] = search(ptree,'gravity')
pnames = 1×3 cell array
    {'/gazebo/gravity_x'}    {'/gazebo/gravity_y'}    {'/gazebo/gravity_z'}

pvalues = 3×1 cell array
    {[      0]}
    {[      0]}
    {[-9.8000]}

Input Arguments

collapse all

Parameter tree, specified as a ParameterTree object handle. Create this object using the rosparam function.

ROS parameter search string specified as a string scalar or character vector. The search function returns all parameters that contain this character vector.

Output Arguments

collapse all

Parameter names, returned as a cell array of character vectors. These character vectors match the parameter names in the ROS master that contain the search character vector.

The following ROS data types are supported as values of parameters. For each ROS data type, the corresponding MATLAB data type is also listed:

  • 32-bit integers — int32

  • Booleans — logical

  • doubles — double

  • strings — string scalar, string, or character vector, char

  • lists — cell array

  • dictionaries — structure

Base64-encoded binary data and iso 8601 data from ROS are not supported.

Limitations

Base64-encoded binary data and iso8601 data from ROS are not supported.

See Also

|

Introduced in R2019b