Universal Robots Forum

How to move robot

Is there any example code to move a robot in URcap code?

What kind of movement do you want to achieve?
The approach would be different depending on a movement before or after the Robot Program was started.

I want to move the x, y, z coordinates I set.

I will recommend using the RobotMovement user interaction provided in the API.
This is demonstrated in the Ellipse example.

If you set only the pose that you want to move robot to RobotMovement function and put it as parameter, do you go to the set pose?

When requestUserToMoveRobot() the user is brought to the Auto Move screen.
When the user has completed this movement (i.e. holding the Auto button), the onComplete() method in the RobotPositionCallback argument in the request.

1 Like

Does the user have to press auto to move?
Is there any way to change the pose of a robot simply by calling one function?

you could use the ClientSendScript Class: Sample: Send Script with button push URCap
and send a move command over the Secondary Client Interface with your Pose data. This would immediately move the robot without automove function needed (though i won’t recommend doing so).

2 Likes

If you use move script with Send Script, the robot turns off after the robot moves.
I want to know what turns it off.

String myPose = β€œp[” + String.format ("%f", x2) + β€œ,” + String.format ("%f", y2) + β€œ,” + String.format ("%f", z2) + β€œ,” + String.format ("%f", rx) + β€œ,” + String.format ("%f", ry) + β€œ,” + String.format ("%f", rz) + β€œ]”;

scriptSender.sendMoveJ(myPose);

As shown in the above code, when I move the robot through the send script, I get the error shown in the screenshot I posted.