This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

rosnode

Retrieve information about ROS network nodes

Syntax

rosnode list
rosnode info nodename
rosnode ping nodename
nodelist = rosnode("list")
nodeinfo = rosnode("info",nodename)
rosnode("ping",nodename)

Description

example

rosnode list returns a list of all nodes registered on the ROS network. Use these nodes to exchange data between MATLAB® and the ROS network.

rosnode info nodename returns a structure containing the name, URI, publications, subscriptions, and services of a specific ROS node,nodename.

rosnode ping nodename pings a specific node, nodename, and displays the response time.

nodelist = rosnode("list") returns a cell array of character vectors containing the nodes registered on the ROS network.

example

nodeinfo = rosnode("info",nodename) returns a structure containing the name, URI, publications, subscriptions, and services of a specific ROS node, nodename.

example

rosnode("ping",nodename) pings a specific node, nodename and displays the response time.

Examples

collapse all

Note: This example requires a valid ROS network to be active with ROS nodes previously set up.

Connect to the ROS network. Specify the IP address for your specific network.

rosinit('192.168.203.129')
Initializing global node /matlab_global_node_90274 with NodeURI http://192.168.203.1:63594/

List the nodes available from the ROS master.

rosnode list
/bumper2pointcloud
/cmd_vel_mux
/depthimage_to_laserscan
/gazebo
/laserscan_nodelet_manager
/matlab_global_node_90274
/mobile_base_nodelet_manager
/robot_state_publisher
/rosout

Shut down the ROS network.

rosshutdown
Shutting down global node /matlab_global_node_90274 with NodeURI http://192.168.203.1:63594/

Connect to the ROS network. Specify the IP address for your specific network.

rosinit('192.168.154.131')
Initializing global node /matlab_global_node_40513 with NodeURI http://192.168.154.1:61991/

Get information on the '/robot_state_publisher' node. This node is available on the ROS master.

nodeinfo = rosnode('info','/robot_state_publisher')
nodeinfo = 

  struct with fields:

         NodeName: '/robot_state_publisher'
              URI: 'http://192.168.154.131:40244/'
     Publications: [2×1 struct]
    Subscriptions: [2×1 struct]
         Services: [2×1 struct]

Shut down the ROS network.

rosshutdown
Shutting down global node /matlab_global_node_40513 with NodeURI http://192.168.154.1:61991/

Connect to the ROS network. Specify the IP address for your specific network.

rosinit('192.168.154.131')
Initializing global node /matlab_global_node_88195 with NodeURI http://192.168.154.1:50275/

Ping the '/robot_state_publisher' node. This node is available on the ROS master.

nodeinfo = rosnode('info','/robot_state_publisher')
nodeinfo = 

  struct with fields:

         NodeName: '/robot_state_publisher'
              URI: 'http://192.168.154.131:40244/'
     Publications: [2×1 struct]
    Subscriptions: [2×1 struct]
         Services: [2×1 struct]

Shut down the ROS network.

rosshutdown
Shutting down global node /matlab_global_node_88195 with NodeURI http://192.168.154.1:50275/

Input Arguments

collapse all

Name of node, specified as a string scalar or character vector. The name of the node must match the name given in ROS.

Output Arguments

collapse all

Information about ROS node, returned as a structure containing these fields: NodeName, URI, Publications, Subscriptions, and Services. Access these properties using dot syntax, for example, nodeinfo.NodeName.

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

See Also

|

Introduced in R2015a