During model initialization, Simulink connects to a ROS master and also creates a node associated with the model. The ROS master URI and Node Host are specified in the “Configure ROS Network Addresses” dialog. You can access this in the menu under Tools>>Robot Operating System (ROS) by selecting “Configure ROS Network Addresses”.
The Network Address parameter can be set to “Default” or “Custom”.
For the ROS master URI, if Network Address is set to “Default”, Simulink® uses the following rules to set the ROS Master URI:
variable if it is set.
If a MATLAB® global ROS node exists, use the Master
URI associated with the global node. The global node is created automatically
rosinit is called.
other two rules do not apply.
For the Node Host, if Network Address is set to “Default”, Simulink uses the following rules to set the ROS Node Host:
ROS_HOSTNAME environment variable
if it is set.
ROS_IP environment variable
if it is set.
Use hostname or IP address of the first network interface on the system if available.
other rules do not apply.
For both, these are the same rules that MATLAB uses to resolve its ROS network addresses.
Otherwise, if you chose “Custom”, you can set all the variables as shown below. This overrides the environment variables.
Note: These addresses are saved in MATLAB preferences, not the model. Therefore, this information is shared across all Simulink models and multiple MATLAB installs of the same release.
You can also use the “Test” button to ensure you
can connect to the ROS master. If you get an error, call
rosinit to setup a local ROS network,
or if you specified a remote ROS master, check your settings are correct.
The custom ROS master or node host settings are not used in generated code when deploying a standalone node.