Main Content

Connect to ROS Master from MATLAB and Read Current State of Robot

  1. Execute the rosinit command from MATLAB® with the IP address of the Linux host where the ROS master is running.

  2. Execute rostopic list, rosnode list, rosservice list and rosaction list commands to view list of accessible nodes, topics, services and actions.

  3. Execute the following set of commands to read current robot state.

    jSub = rossubscriber('/joint_states');
    jMsg = receive(jSub);

    The jMsg contains the robot data in the structure depicted by sensor_msgs/JointState.