Command robot to move to desired Cartesian pose and wait for the motion to complete
commands the Universal Robots cobot connected through ROS interface, and waits for the robot
to complete the motion, based on the specified Cartesian pose of the end-effector, maximum
duration, and timeout. The method commands the robot to complete the motion from current
Cartesian pose to the desired Cartesian pose within the duration and returns the goal state
and the result. If the server does not return the result with in the additional timeout
period that you specified, the function displays an error.
state] = sendCartesianPose(
Command the Cobot to Desired Cartesian Pose and Wait for Result
Connect to a physical or simulated cobot at IP address
192.168.2.112 on the ROS network.
ur = universalrobot('192.168.2.112');
Command the cobot to by providing the desired Cartesian pose and by specifying the time to reach the pose as 7 seconds, and a timeout (to display an error message otherwise) as 8 seconds.
pose = [-pi/2 0 -pi/2 0.5 0 0.8]; [result,state] = sendCartesianPose(ur,pose,EndTime=7,TimeOut=8);
result = 1 state = 'succeeded'
ur — Connection to Universal Robots cobot
Connection to physical or simulated cobot from Universal Robots, specified as a
pose — Desired Cartesian pose
Desired Cartesian pose of the simulated cobot, represented as a 1-by-6 numeric vector, in the form of [thetaz thetay thetax x y z]. The units are radians and seconds respectively for the three axes.
endtime — Duration to complete the motion
Maximum duration by which the simulated cobot must try to complete the motion to reach the desired cartesian pose, specified in seconds.
timeout — Timeout period
scalar in seconds
Timeout period for receiving a result message, specified as a scalar in seconds. If the client does not receive a new result message in that time period, an error is displayed.
Minimum value of
endtime + 2
result — Motion status of Universal Robots cobot
logical scalar |
Motion status of simulated cobot from Universal Robots, specified as a logical
state — Final goal state
Final goal state of the simulated cobot, returned as one of the following:
'pending'— Goal was received, but has not yet been accepted or rejected.
'active'— Goal was accepted and is running on the server.
'succeeded'— Goal executed successfully.
'preempted'— An action client canceled the goal before it finished executing.
'rejected'— The goal was not accepted after being in the 'pending' state. The action server typically triggers this status.
'aborted'— The goal was aborted before it finished executing. The action server typically aborts a goal.
'recalled'— A client canceled the goal while it was in the 'pending' state.
'lost'— An internal error occurred in the action client.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Introduced in R2022a