matlab ros连接,Configure ROS Network Addresses

Configure ROS Network Addresses

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 Simulation tab by selecting ROS Toolbox > ROS

Network.

bfa0a1880358fbddf9f4be3d74882092.png

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:

Use ROS_MASTER_URI environment 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 when

rosinit is called.

Use address http://localhost:11311 if 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:

Use ROS_HOSTNAME environment variable if it is set.

Use ROS_IP environment variable if it is set.

Use hostname or IP address of the first network interface on the system if

available.

Use address http://localhost:11311 if 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.

97c9d439f8f3f9fba23e6783f84779c1.png

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.

See Also

Related Examples

More About

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值