UnderAutomation
Une question ?

[email protected]

Contactez-nous
UnderAutomation
⌘Q
Cette page est disponible uniquement en anglais.

Move the robot from a PC

Switch the servo on and move a Yaskawa robot in a straight line from C# or Python, without a job. Which move to choose, how to wait for the end, and the frequent errors.

  • Prerequisites
  • Which move to choose
  • Example
  • Wait for the end of a move
  • Troubleshooting
  • What to read next

This article shows how to move a Yaskawa Motoman robot from a PC, without a job, in C# or Python. It gives a complete program that switches the servo on, moves the tool 50 mm up in a straight line, waits for the end of the move and goes back.

Prerequisites

  • The SDK is connected to the controller: see Connect to your robot.
  • The controller accepts the remote commands. See Prepare the controller.
  • The cell is safe for a move: nobody in the cell, the safety functions active. Test at low speed first.

Which move to choose

NeedMethod and command type
Go to a Cartesian position in a straight lineMoveCartesian, StraightAbsolute
Go to a Cartesian position, fastest pathMoveCartesian, LinkAbsolute
Move by an offset (approach, retract)MoveCartesian, StraightIncrement
Go back to a position read in pulsesMoveJoints, LinkAbsolute
Run a taught pathA job: see Run a job

Example

using UnderAutomation.Yaskawa;
using UnderAutomation.Yaskawa.HighSpeedEServer;
public class HowToMoveRobot
{
static void Main()
{
var robot = new YaskawaRobot();
robot.Connect("192.168.0.1");
// 1. Remote mode, no alarm
RobotStatusData status = robot.HighSpeedEServer.GetStatusInformation();
if (!status.CommandRemote) throw new InvalidOperationException("Enable the remote mode");
if (status.Alarming) robot.HighSpeedEServer.AlarmReset(AlarmResetType.Reset);
// 2. Servo on
robot.HighSpeedEServer.ServoCommand(OnOffCommandType.Servo, true);
// 3. Read the current position, then move 50 mm up in a straight line, at 20 mm/s
RobotPositionCartesianData start = robot.HighSpeedEServer.GetRobotCartesianPosition();
robot.HighSpeedEServer.MoveCartesian(
start.X, start.Y, start.Z + 50, start.Rx, start.Ry, start.Rz,
PositionCommandClassification.Cartesian_MM_S, 20,
PositionCommandOperationCoordinate.Robot,
posture: start.Form,
commandtype: PositionCommandType.StraightAbsolute);
// 4. The method returns when the controller accepts the move: wait for the target, 30 s at most
DateTime timeout = DateTime.Now.AddSeconds(30);
while (Math.Abs(robot.HighSpeedEServer.GetRobotCartesianPosition().Z - (start.Z + 50)) > 0.5)
{
if (DateTime.Now > timeout) throw new TimeoutException("Target not reached");
Thread.Sleep(100);
}
// 5. Back to the start, joint interpolated, at 10 %
robot.HighSpeedEServer.MoveCartesian(
start.X, start.Y, start.Z, start.Rx, start.Ry, start.Rz,
PositionCommandClassification.LinkPercent, 10,
PositionCommandOperationCoordinate.Robot,
posture: start.Form,
commandtype: PositionCommandType.LinkAbsolute);
robot.Disconnect();
}
}

The program:

  1. checks the remote mode and resets a pending alarm;
  2. switches the servo on;
  3. reads the current position and sends a straight move 50 mm above it, at 20 mm/s, with the same posture;
  4. reads the position every 100 ms until the robot is within 0.5 mm of the target, with a timeout of 30 s;
  5. goes back to the start with a joint move at 10 % of the maximum speed.

Wait for the end of a move

MoveCartesian and MoveJoints return when the controller accepts the move. To chain moves or to act after a move, wait for the target as in the example. Send the next move only after the end of the previous one.

Troubleshooting

  • The robot moves by the values instead of going to them: MoveCartesian uses StraightIncrement when commandtype is not given. Pass StraightAbsolute or LinkAbsolute.
  • Servo OFF or Turn ON the servo power: switch the servo on before the move.
  • Command remote not set: see Prepare the controller.
  • The robot takes another configuration: pass the posture of the start position (Form) to MoveCartesian.
  • A speed or frame setting error: check the pair of PositionCommandClassification and command type, and the tool and user frame numbers.

What to read next

  • Motion: all the arguments of the moves.
  • Get the robot position.

Intégrez facilement les robots Universal Robots, Fanuc, Yaskawa, ABB ou Staubli dans vos applications .NET, Python, LabVIEW ou Matlab

UnderAutomation
Contactez-nousLegal

© All rights reserved.