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 2 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.

You can also visualize a comprehensive overview of a ROS 2 network graph by using the ROS 2 Network Analyzer app.

Apps

ROS 2 Network AnalyzerVisualize and analyze nodes, topics, services and actions interaction in ROS 2 network (Since R2024b)

Functions

expand all

ros2Retrieve information about ROS 2 network
ros2messageCreate ROS 2 message structures
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
stopNodeStop ROS or ROS 2 node
isNodeRunningDetermine if ROS or ROS 2 node is running

Objects

expand all

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

Blocks

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

Topics

Featured Examples