ros2node
Create a ROS 2 node on the specified network
Description
The ros2node
object represents a ROS 2 node, and allows you to
communicate with the rest of the ROS 2 network. You have to create a node before you can
create publishers and subscribers.
Creation
Description
initializes a ROS 2 node with the given node
= ros2node(Name
)Name
. The node will be on the
network specified by the domain identification 0
, unless otherwise
specified by the ROS_DOMAIN_ID
environment variable.
By default the node uses the 'rmw_fastrtps_cpp'
ROS middleware
(RMW) implementation unless otherwise specified by the
RMW_IMPLEMENTATION
environment variable. Set the
RMW_IMPLEMENTATION
environment variable before creating the
ros2node
object. For example,
setenv('RMW_IMPLEMENTATION','rmw_cyclonedds_cpp')
sets the RMW
implementation to 'rmw_cyclonedds_cpp'
. For more information on RMW
implementations see Switching Between ROS Middleware Implementations.
specifies parameters to be declared during the node startup using the name-value argument
node
= ros2node(___,Parameters=params
)Parameters
, using any of the arguments from the previous syntaxes.
Specify params
as a structure that contains the parameters as its
fields. Each parameter in params
can be a scalar or an array of
uint8
, int64
, logical
,
string
, char
or double
datatype.
Input Arguments
Properties
Object Functions
delete | Remove reference to ROS 2 node |
getParameter | Get value of parameter declared in ROS 2 node |
setParameter | Set value of parameter declared in ROS 2 node |
Examples
Extended Capabilities
Version History
Introduced in R2019b