Main Content

Getting Started with UR RTDE Blocks Library to Control UR Series Cobot from Simulink

This example shows how to use Simulink blocks under UR RTDE Blocks Simulink Library to manipulate motion of UR Series cobot using joint configuration or joint space waypoints, and obtain feedback from the cobot.

The Robotics System Toolbox™ Support Package for Universal Robots UR Series Manipulators enables you to connect and control UR Series Manipulators from Universal Robots using MATLAB and Simulink®. The Simulink library, UR RTDE Blocks, includes two blocks that allow you to command the cobot using RTDE interface - either by specifying the required joint configuration (Send Joint Configuration block) or by providing the required joint waypoints (Follow Joint Waypoints block). The library also provides blocks to read joint configuration and motion status to verify the manipulation.

Prerequisites

Model

This example provides a Simulink model, gettingStartedExampleRTDEBlocks, which includes the various blocks from the UR RTDE Blocks Simulink Library, and additionally uses the two Manual Switch blocks from Simulink to enable/disable the manipulation of the cobot. The Enable port in the two blocks, Send Joint Configuration and Follow Joint Waypoints, accepts Boolean values (0 or 1) from these Manual Switch blocks, and keeps the motion active while the value is 1.

Control Cobot Manipulation and Obtain Feedback

All the RTDE-based Simulink blocks in the model are configured with the UR Controller IP address parameter set 192.168.1.10. Validate this IP address by completing the test connection to UR Series cobot or URSIM simulator, by first completing the Hardware Setup process. After that, you can proceed with these steps to control the cobot using the Simulink model:

  1. Click Run to simulate the model.

  2. Double-click the Enable Send Joints (Manual Switch) block to toggle the switch position to accept 1 (True), thereby enabling the Send Joint Configuration block. This results in the actual movement of cobot's joints as per the values defined for Joint Config (Constant) block connected to the q input of the block.

  3. Observe the output value of Read Motion Status block. The Motion Status (Display) block displays one of these values : 2 (if the motion is completed), 1 (if the motion execution is in progress), or 0 (if the motion has not started).

  4. Once the Motion Status (Display) block displays 2, verify the final position of joints by observing the values for Joints Rad or Joints Deg (Display) blocks connected to the q output of Read Joint Configuration block.

  5. Double-click the Enable Send Joints (Manual Switch) block to toggle the switch position to accept 0 (False), thereby enabling the Follow Joint Waypoints block and disabling the Send Joint Configuration block . This results in the actual movement of cobot's joints as per the values defined for Joint Waypoints (Constant) block connected to the Waypoints input of the Follow Joint Waypoints block.

  6. Once the Motion Status (Display) block displays 2, verify the movement of joints by observing the values for Joints Vel or Joints Acc (Display) blocks connected to the qd and qdd outputs respectively of the Read Controller Output block.

  7. Double-click the Enable Gripper (Manual Switch) block to toggle the switch position to accept 1 (True), thereby enabling the Actuate Gripper block. Double-click the Actuate (Manual Switch) block to toggle the switch position to accept 1 (True). This results in the closing the gripper conected to the cobot's end-effector.

Other Things to Try

  • Use a supervisory controller using Stateflow® to send Boolean values to the various Manual Switch blocks.

  • The present example uses a constant value for Joint Configuration and Joint Waypoints input. Try to implement dynamic calculation of required joint configuration and joint waypoints based on desired end-effector pose.