ros2

Retrieve information about ROS 2 network

Description

example

ros2 msg list returns a list of all available ROS 2 message types that can be used in MATLAB.

example

ros2 msg show msgType provides the definition of the ROS 2 message, msgType.

example

ros2 node list lists nodes on the ROS 2 network.

example

ros2 topic list lists topic names with registered publishers or subscribers on the ROS 2 network.

example

msgList = ros2("msg", "list") returns a list of all available ROS 2 message types that can be used in MATLAB.

example

msgInfo = ros2("msg", "show", msgType) provides the definition of the ROS 2 message, msgType.

example

nodeList = ros2("node", "list") lists nodes on the ROS 2 network.

example

topicList = ros2("topic", "list") lists topic names with registered publishers or subscribers on the ROS 2 network.

Examples

collapse all

Show the definition of the geometry_msgs/Accel message.

ros2 msg show geometry_msgs/Accel
# This expresses acceleration in free space broken into its linear and angular parts.
Vector3  linear
Vector3  angular

Show the definition of the geometry_msgs/Accel message.

ros2 msg show geometry_msgs/Accel
# This expresses acceleration in free space broken into its linear and angular parts.
Vector3  linear
Vector3  angular

Create sample node, myNode, on the ROS 2 network.

node = ros2node("myNode");

Lists the nodes on the network.

ros2 node list
myNode

Remove myNode from the network.

delete(node)

List the available ROS 2 topics.

ros2 topic list
/clock
/parameter_events

Input Arguments

collapse all

Message type, specified as a string scalar or character vector. The string is case-sensitive and no partial matches are allowed. It must match a message on the list given by calling ros2("msg", "list").

Output Arguments

collapse all

List of all message types available in MATLAB, returned as a cell array of character vectors.

Details of the information inside the ROS message definition, returned as a character vector.

List of topics from ROS master, returned as a cell array of character vectors.

List of node names available, returned as a cell array of character vectors.

Introduced in R2019b