Main Content

executePrimaryURScriptCommand

Execute primary URScript command to control cobot over ROS interface

Since R2023a

Description

executePrimaryURScriptCommand(ur,cmdStr) executes the URScript command specified by cmdStr using ROS topic interface. This function accepts the URScript commands in terms of string or char.

Note

This function does not check for the syntax validity of the command. Ensure that you verify the command before sending it to the physical robot.

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;

Specify the URScript command for moving a joint to position, and execute the command.

commandString = "movej([0, -1.57, 0,-1.57, 0, 0])";
executePrimaryURScriptCommand(ur,commandString);

Input Arguments

collapse all

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

URScript command, specified as a string scalar or character vector.

Example: movep(pose, 1.2, 0.25, 0)

Data Types: string | char

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2023a