UnderAutomation
Eine Frage?

[email protected]

Kontakt
UnderAutomation
⌘Q
Diese Seite ist nur auf Englisch verfügbar.

Real-time control

Make the robot follow a target that changes at any time, or compute the position of the robot at every cycle with a callback.

  • Follow a target
  • Follow a Cartesian target
  • Compute each position

When the motion is not known in advance, for example with a camera, a force sensor or a joystick, the robot must react to new data while it moves. Stream Motion offers two ways to do this.

NeedUse
The robot goes to a target that changes at any timeTarget tracking
Your application computes the position at every cycleCallback streaming

Follow a target

With target tracking, the robot goes to the last target as fast as the limits allow, and stops on it. You can change the target at any time, from any thread, even during the motion: the robot then goes smoothly to the new target.

var sm = robot.StreamMotion;
sm.StartMonitoring();
// The robot follows a target at 30% of its velocity limits
sm.StartTracking(PositionFormat.Joint, 30);
// Change the target at any time, from any thread
JointsPosition start = sm.QueueEndJointPosition;
sm.SetJointTrackingTarget(new JointsPosition(start.Values) { J1 = start.J1 + 10 });
Thread.Sleep(500);
sm.SetJointTrackingTarget(new JointsPosition(start.Values) { J1 = start.J1 - 5 });
// Wait until the robot is stopped on the target
sm.WaitForIdle(10000);
// Stop following targets. A moving robot stops as fast as the limits allow.
sm.StopTracking();
robot.Disconnect();
}
Click to see the full code
J1 with this example: the target changes during the motion, and the robot turns back smoothly within its limits.J1 with this example: the target changes during the motion, and the robot turns back smoothly within its limits.
J1 with this example: the target changes during the motion, and the robot turns back smoothly within its limits.
  • The limits are JointLimits of the client (read from the robot by StartMonitoring()), scaled by the speed and acceleration percentages of StartTracking().
  • The first target is the current position. The robot does not move before the first call to SetJointTrackingTarget().
  • Each axis moves on its own, so the path to the target is not a straight line.
  • WaitForIdle() returns when the robot is stopped on the target.
  • The delay between a new target and the start of the motion is about BufferLeadTime plus the delay of the robot. Reduce BufferLeadTime in the connection parameters for a faster reaction.

Follow a Cartesian target

Set CartesianLimits before starting a Cartesian tracking. The linear limits are shared between X, Y and Z, and the angular limits between the 3 rotation axes.

var sm = robot.StreamMotion;
sm.StartMonitoring();
// Cartesian tracking needs Cartesian limits
sm.CartesianLimits = new CartesianLimits(250, 1000, 5000, 45, 180, 900);
sm.StartTracking(PositionFormat.Cartesian, 50, 50);
// For example, a target given by a sensor
XYZWPRPosition start = sm.QueueEndCartesianPosition;
sm.SetCartesianTrackingTarget(new XYZWPRPosition(start.X + 20, start.Y, start.Z - 10, start.W, start.P, start.R));
sm.WaitForIdle(10000);
sm.StopTracking();
robot.Disconnect();
}
Click to see the full code

Compute each position

With callback streaming, the SetpointRequested event asks your application for the next position at every cycle. Give it with SetJoints() or SetCartesian():

var sm = robot.StreamMotion;
sm.StartMonitoring();
JointsPosition start = sm.QueueEndJointPosition;
// Called on the communication thread, a few cycles before the robot uses the position
sm.SetpointRequested += (sender, e) =>
{
// e.Time: time of this position since the start, in seconds
double offset = 5 * (1 - Math.Cos(2 * Math.PI * e.Time / 4)) / 2;
e.SetJoints(new JointsPosition(start.Values) { J1 = start.J1 + offset });
};
sm.StartCallbackStreaming(PositionFormat.Joint);
Thread.Sleep(8000);
// The robot keeps its last position, or stops smoothly if it was moving
sm.StopCallbackStreaming();
robot.Disconnect();
}
Click to see the full code

Rules of the callback:

  • The event runs on the communication thread, a few cycles before the robot uses the position. It must return quickly, in less than one cycle.
  • The first position (CycleIndex 0) must be the current position of the robot, and the next positions must respect the limits of the robot. Use Check on recorded positions to validate your algorithm.
  • If the handler throws an exception or gives no position, the robot keeps its position, or stops smoothly if it was moving, and ErrorOccurred is raised. Call Hold() to keep the position on purpose.
  • With Python, the callback works, but its timing depends on the interpreter: prefer target tracking.

Only one source of positions is active at a time: the queue, the target tracking or the callback. Abort(), Finish() and the end of the session stop the target tracking and the callback streaming.

The format given to StartTracking() or StartCallbackStreaming() must be the format of the current session. To use the other format, call Finish() and start in the next session (see one format per session).


Integrieren Sie Roboter von Universal Robots, Fanuc, Yaskawa, ABB oder Staubli ganz einfach in Ihre .NET-, Python-, LabVIEW- oder Matlab-Anwendungen

UnderAutomation
KontaktLegal

© All rights reserved.