Node
Start ROS node and connect to ROS master
Description
Theros.Node
对象代表一个活性氧ROS节点网络。The object enables you to communicate with the rest of the ROS network. You must create a node before you can use other ROS functionality, such as publishers, subscribers, and services.
You can create a ROS node using therosinit
function, or by callingros.Node
:
rosinit
— Creates a single ROS node in MATLAB®. You can specify an existing ROS master, or the function creates one for you. TheNode
object is not visible.ros.Node
— Creates multiple ROS nodes for use on the same ROS network in MATLAB.
Creation
Syntax
Description
N = ros.Node(
initializes the ROS node withName
)Name
and tries to connect to the ROS master at default URI,http://localhost:11311
.
N = ros.Node(
tries to connect to the ROS master at the specified IP address or host name,Name
,Host
)Host
using the default port number,11311
.
N = ros.Node(
tries to connect to the ROS master with port number,Name
,Host
,Port
)Port
.
N = ros.Node(
tries to connect to the ROS master at the specified IP address,Name
,MasterURI
,Port
)MasterURI
.
N = ros.Node(___,'NodeHost',HostName)
specifies the IP address or host name that the node uses to advertise itself to the ROS network. Examples include"192.168.1.1"
or"comp-home"
. You can use any of the arguments from the previous syntaxes.