Main Content

del

Delete a ROS parameter

Since R2019b

Description

example

del(ptree,paramname) deletes a parameter with name paramname from the parameter tree, ptree. The parameter is also deleted from the ROS parameter server. If the specified paramname does not exist, the function displays an error.

del(ptree,namespace) deletes from the parameter tree all parameter values under the specified namespace.

Examples

collapse all

Connect to the ROS network. Create a parameter tree and a 'MyParam' parameter. Check that the parameter exists.

rosinit
Launching ROS Core...
Done in 0.78162 seconds.
Initializing ROS master on http://172.29.195.158:55594.
Initializing global node /matlab_global_node_66319 with NodeURI http://dcc602414glnxa64:35107/ and MasterURI http://localhost:55594.
ptree = rosparam;
set(ptree,'MyParam','test')
has(ptree,'MyParam')
ans = logical
   1

Delete the parameter. Verify it was deleted. Shut down the ROS network.

del(ptree,'MyParam')
has(ptree,'MyParam')
ans = logical
   0

rosshutdown
Shutting down global node /matlab_global_node_66319 with NodeURI http://dcc602414glnxa64:35107/ and MasterURI http://localhost:55594.
Shutting down ROS master on http://172.29.195.158:55594.

Input Arguments

collapse all

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

ROS parameter name, specified as a string scalar or character vector. This string must match the parameter name exactly.

ROS parameter namespace, specified as a string scalar or character vector. All parameter names starting with this string are listed when calling rosparam("list",namespace).

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2019b

See Also

| |