This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Set Parameter

Set values on ROS parameter server

  • Library:
  • Robotics System Toolbox / ROS


The Set Parameter block sets the Value input to the specified name on the ROS parameter server. The block uses the ROS node of the Simulink® model to connect to the ROS network. This node is created when you run the model and is deleted when the model terminates. If the model does not have a node, the block creates one.



expand all

Parameter value from the ROS network. The value depends on the Data type parameter.

Length of the string parameter, specified as an integer. This length is the number of elements of the uint8 array or the number of characters in the string that you cast to uint8.


When casting your string parameters to uint8, ASCII values 0–31 (control characters) return an error due to their incompatible character type.


To enable this port, set the Data type to uint8[] (string).


expand all

Source for specifying the parameter name as one of the following:

  • Select from ROS network — Use Select to select a parameter name. The Data type parameter is set automatically. You must be connected to a ROS network.

  • Specify your own — Enter a parameter name in Name and specify its data type in Data type. You must match a parameter name exactly.

Parameter name to get from the ROS network, specified as a string. When Source is set to Select from ROS network, use Select to select an existing parameter. You must be connected to a ROS network to get a list of parameters. Otherwise, specify the parameter and data type.

Parameter name strings must follow the rules of ROS graph names. Valid names have these characteristics:

  • The first character is an alpha character ([a-z|A-Z]), tilde (~), or forward slash (/).

  • Subsequent characters are alphanumeric ([0-9|a-z|A-Z]), underscores(_), or forward slashes (/).

Data type of your parameter, specified as a string.


The uint8[] (string) data type is an array of ASCII values corresponding to the characters in a string. When getting string parameters, you can create a MATLAB Function block to compare the string to a desired parameter value. For more information, see ROS String Parameters.

Data Types: double | int32 | Boolean | uint8

Extended Capabilities

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

Introduced in R2015b