Main Content

getCartesianPose

Get current end-effector pose from the robot

Since R2022a

Description

pose=getCartesianPose(ur) waits for the next published joint state from the Universal Robots cobot connected through ROS interface, and returns current end-effector pose. If no message is received in 5 seconds, the function displays an error.

pose=getCartesianPose(ur,timeout) allows you to specify a timeout for obtaining the current end-effector pose from the Universal Robots cobot connected through ROS interface. If no message is received within the specified time, 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;

Get the current end-effector pose of the cobot, representing the current position and orientation of the end-effector.

pose = getCartesianPose(ur);
pose = 1×6    
    3.1415    0.5176   -1.5708   -0.2435   -0.2329    0.7613

Specify a timeout of 10 seconds while obtaining current end-effector pose of the cobot.

jointangles = getCartesianPose(ur,10);

Input Arguments

collapse all

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

Timeout value by which the end-effector pose must be obtained from the simulated cobot, specified in seconds.

Data Types: double

Output Arguments

collapse all

Current end effector pose, returned as a 1-by-6 vector consisting of the three orientation and position values (represented as [theta(z) theta(y) theta(x) x y z]) in radians and meters respectively.

Data Types: double

Extended Capabilities

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

Version History

Introduced in R2022a