Main Content

recordRobotState

Log the key robot state parameters during motion of robot

Since R2022a

Description

data = recordRobotState(ur) waits for the next published joint state from the Universal Robots cobot connected through ROS interface, and records state data at a default rate. If no message is received in 5 seconds, the function displays an error.

example

data = recordRobotState(ur,rate,velthr) allows you to specify the rate of logging (in Hz) and a velocity threshold (in rad/s). The method starts logging the data from the cobot when any one of the joint angle speed crosses the specified threshold, and stops logging when all of the joint angle speeds drop below the threshold. If no message is received in 5 seconds, the function displays an error.

example

Examples

collapse all

Connect to a physical or simulated cobot, using either urROSNode or urROS2Node object (based on the option for connectivity – ROS or ROS 2, which you selected in the Hardware Setup screen).

  • Connect to a physical or simulated cobot at IP address 192.168.2.112 on the ROS network.

    ur = urROSNode('192.168.2.112');
  • Connect to a physical or simulated cobot on the ROS 2 network.

    ur = urROS2Node;

Log the key robot state parameters during motion of robot, at a default rate.

data = recordRobotState(ur);

Specify a rate of logging of 100 Hz and a velocity threshold of 1e-4 while logging the state parameters of the cobot.

data = recordRobotState(ur,100,1e-4);
Robot motion detected. Recording Data....
Robot motion stopped.
data = 
    JointConfiguration: [816×6 double]
         JointVelocity: [816×6 double]
                  Pose: [816×6 double]
            EEVelocity: [816×6 double]

Input Arguments

collapse all

Connection to physical or simulated cobot from Universal Robots, specified as a urROSNode object, urROS2Node object, or urRTDEClient object.

Rate at which the state data must be logged from the simulated cobot during its motion, specified in Hz (hertz).

Data Types: double

Velocity threshold for logging joint angle movements from the simulated cobot during its motion, specified in rad/s.

Data Types: double

Output Arguments

collapse all

Data logged from joint angle movements of the simulated cobot, returned as a 1-by-4 structure array consisting of joint configuration, joint velocity, Cartesian pose, and velocity of end-effector.

Data Types: struct

Version History

Introduced in R2022a