Main Content

ROS 2 Network Connection and Exploration

Set up and interact with ROS 2 Networks

Connect to ROS 2 to prototype robotics applications and access robotics hardware or simulators over a ROS network. You can create your own ROS network using MATLAB® or connect to an existing ROS 2 network. To set up a ROS 2 network, create a ROS 2 node using ros2node object.

You can access ROS 2 parameters using ros2param object and its object functions.

The ros2rate object helps control the timing of code execution.

Functions

expand all

ros2Retrieve information about ROS 2 network (Since R2019b)
ros2messageCreate ROS 2 message structures (Since R2019b)
ros2tfReceive, send, verify and apply ROS 2 transformations (Since R2023a)
rosApplyTransformTransform ROS and ROS 2 message entities into target frame (Since R2021a)
rosReadTransformReturn transformation from ROS or ROS 2 TransformStamped message structure (Since R2023b)
canTransformVerify if transformation is available (Since R2023a)
transformTransform message entities into target coordinate frame (Since R2023a)
getTransformReturn the transformation between two coordinate frames (Since R2023a)
sendTransformSend a transformation to the ROS 2 network (Since R2023a)
ros2timeAccess ROS 2 time functionality (Since R2022b)
ros2rateExecute loop at fixed frequency (Since R2022b)
ros2durationCreate a ROS 2 duration message (Since R2022b)
ros2deviceConnect to remote ROS 2 device (Since R2021a)
runNodeStart ROS or ROS 2 node (Since R2019b)
stopNodeStop ROS or ROS 2 node (Since R2019b)
isNodeRunningDetermine if ROS or ROS 2 node is running (Since R2019b)

Objects

expand all

ros2nodeCreate a ROS 2 node on the specified network (Since R2019b)
ros2paramCreate object to access parameters from ROS 2 nodes (Since R2022b)

Blocks

Blank MessageCreate blank ROS 2 message using specified message type (Since R2019b)
Current TimeRetrieve current ROS 2 time or system time (Since R2022b)
Get ParameterGet ROS 2 parameter value (Since R2022b)