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 1.0203 seconds.
Initializing ROS master on http://172.20.221.140:57122.
Initializing global node /matlab_global_node_31363 with NodeURI http://dcc031654glnxa64:34211/ and MasterURI http://localhost:57122.
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_31363 with NodeURI http://dcc031654glnxa64:34211/ and MasterURI http://localhost:57122.
Shutting down ROS master on http://172.20.221.140:57122.

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

| |