MATLAB 도움말 센터
List all parameters in associated ROS 2 node
Since R2022b
paramList = list(paramObj)
paramList = list(paramObj) returns paramList which contains the list of all the parameters in the ROS 2 node associated with the parameter object, paramObj
paramList
paramObj
example
collapse all
Create a ROS 2 node with parameters.
nodeParams.my_double = 2.0; nodeParams.my_namespace.my_int = int64(1); nodeParams.my_double_array = [1.1 2.2 3.3]; nodeParams.my_string = "Keyparams"; mainNode = ros2node("mainNode",Parameters=nodeParams); pause(1)
Create a ros2param object to interact with the parameters of the ROS 2 node, /node1.
ros2param
/node1
paramObj = ros2param("mainNode");
Use the set function to change the value of the parameter my_string.
set
my_string
set(paramObj,"my_string","Newparams");
Use the get function to obtain the new value of my_string.
get
stringVal = get(paramObj,"my_string")
stringVal = 'Newparams'
Use the has function to check if the parameter my_char exists in the ROS 2 node, /node1.
has
my_char
flag = has(paramObj,"my_char")
flag = logical 0
Use the search function to search for names of all the parameters that contain the string "my_d". Obtain the values of the matching parameters.
search
my_d
[pNames,pVals] = search(paramObj,"my_d")
pNames = 2×1 cell {'my_double' } {'my_double_array'}
pVals=2×1 cell array {[ 2]} {[1.1000 2.2000 3.3000]}
Use the list function to list the names of all parameters in the ROS 2 node.
list
pList = list(paramObj)
pList = 10×1 cell {'my_double' } {'my_double_array' } {'my_namespace.my_int' } {'my_string' } {'qos_overrides./parameter_events.publisher.depth' } {'qos_overrides./parameter_events.publisher.durability' } {'qos_overrides./parameter_events.publisher.history' } {'qos_overrides./parameter_events.publisher.reliability'} {'start_type_description_service' } {'use_sim_time' }
ROS 2 parameter object, specified as a ros2param object handle.
List of all parameter names in the associated ROS 2 node, returned as a cell array.
Introduced in R2022b
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
유럽
아시아 태평양
지역별 지사에 문의