Main Content

del

Delete a ROS parameter

Description

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.

example

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.47919 seconds.
Initializing ROS master on http://172.20.149.13:53133.
Initializing global node /matlab_global_node_16892 with NodeURI http://dcc158922glnxa64:42229/ and MasterURI http://localhost:53133.
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_16892 with NodeURI http://dcc158922glnxa64:42229/ and MasterURI http://localhost:53133.
Shutting down ROS master on http://172.20.149.13:53133.

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

| |