Set Parameter
Set values on ROS parameter server
Libraries:
ROS Toolbox /
ROS
Description
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.
Ports
Input
Value — Parameter value
scalar | logical | uint8 array
Parameter value from the ROS network. The value depends on the Data type parameter.
Length — Length of string parameter
integer
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
.
Note
When casting your string parameters to uint8
, ASCII values 0–31 (control characters) return an error due to their incompatible character type.
Dependencies
To enable this port, set the Data type to uint8[] (string)
.
Parameters
Source — Source for specifying the parameter name
Select from ROS network
| Specify your own
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.
Name — Parameter name
string
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 — Data type of your parameter
double | int32 | boolean | uint8[] (string)
Data type of your parameter, specified as a string.
Note
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 (Simulink) block to compare the string to a desired parameter value. For more information, see ROS Parameters in Simulink.
Data Types: double
| int32
| Boolean
| uint8
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2019b
See Also
External Websites
MATLAB Command
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)