Start ROS node and connect to ROS master
The ros.Node
object represents a ROS node in the ROS
network. 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 the rosinit
function, or by calling ros.Node
:
rosinit
— Creates a
single ROS node in MATLAB®. You can specify an existing ROS master, or the function
creates one for you. The Node
object is not
visible.
ros.Node
— Creates multiple ROS nodes for use on
the same ROS network in MATLAB.
N = ros.Node(
initializes
the ROS node with Name
)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.