Main Content

recordRobotState

Log the key robot state parameters during motion of robot

Since R2022a

Description

ROS or ROS2 interface

example

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.

RTDE interface

example

jointConfigMatrix = recordRobotState(ur,duration,interval) records the cobot's joint configuration over the specified time and interval.

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]

Connect to a physical or simulated cobot, using urRTDEClient object.

ur = urRTDEClient('172.19.98.176');

Record the robot's joint configuration over a specified duration and interval.

duration = 4
interval = 0.5
jointConfigMatrix = recordRobotState(ur, duration, interval)
data = 
    jointConfigMatrix: [816×6 double]
         

Input Arguments

collapse all

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

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

Note

This argument is valid only if the function is used with urROSNode or urROS2Node objects; it is not valid for urRTDEClient object.

Data Types: double

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

Note

This argument is valid only if the function is used with urROSNode or urROS2Node objects; it is not valid for urRTDEClient object.

Data Types: double

Total time to record the joint configurations, specified in seconds.

Data Types: double

Time between each recorded configuration, specified in seconds.

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

Matrix where each row represents the joint configuration at a given time.

Data Types: struct

Version History

Introduced in R2022a