Click or drag to resize

Motion domain

Overview

The MotionDomain namespace lets you access the mechanical units of the robot system.

Using a MotionSystem object you can send jogging commands to an mechanical unit and get or set the incremental jogging mode. Using a MechanicalUnit object you can get a lot of information about the mechanical units of the robot system.

You can also subscribe to changes of the mechanical unit, for example changed tool, work object, coordinated system, motion mode or incremental step size.

MotionSystem object

You can access the motion system by using a the Controller property MotionSystem.

C#
private MotionSystem aMotionSystem;
aMotionSystem = aController.MotionSystem;
VB
Private aMotionSystem As MotionSystem
aMotionSystem = aController.MotionSystem
Accessing Mechanical units

The mechanical units can be of different types, for example a robot with a TCP, a multiple axes manipulator, or a single axis unit. Mechanical units are available through the MotionSystem object. If only the active mechanical unit is of interest you may use the method GetActiveMechanicalUnit.

C#
MechanicalUnitCollection aMechCol = aController.MotionSystem.GetMechanicalUnits();
MechanicalUnit aMechUnit = aController.MotionSystem.GetActiveMechanicalUnit();
VB
Dim aMechCol As MechanicalUnitCollection = aController.MotionSystem.GetMechanicalUnits()
Dim aMechUnit As MechanicalUnit = aController.MotionSystem.GetActiveMechanicalUnit();
Jogging

It is possible to jog the active mechanical unit using the SetJoggingCmd method and the calls JoggingStart and JoggingStop. Depending on the selected MotionMode and IncrementalMode different joints and speeds are configured.

C#
aController.MotionSystem.JoggingStop();
aMechUnit.MotionMode = MotionModeType.Linear;
aController.MotionSystem.IncrementalMode = IncrementalModeType.Small;
aController.MotionSystem.SetJoggingCmd(-50, 50, 0);
aController.MotionSystem.JoggingStart();
VB
aController.MotionSystem.JoggingStop()
aMechUnit.MotionMode = MotionModeType.Linear
aController.MotionSystem.IncrementalMode = IncrementalModeType.Small
aController.MotionSystem.SetJoggingCmd(-50, 50, 0)
aController.MotionSystem.JoggingStart()
Mechanical unit properties and methods

There are numerous properties available for the mechanical unit, for example Name, Model, NumberOfAxes, SerialNumber, CoordinateSystem, MotionMode, IsCalibrated, Tool and WorkObject and so on. It is also possible to get the current position of a mechanical unit as a RobTarget or JointTarget.

C#
Controller aController = new Controller();
RobTarget aRobTarget = aController.MotionSystem.ActiveMechanicalUnit.GetPosition(CoordinateSystemType.World);
JointTarget aJointTarget = aController.MotionSystem.ActiveMechanicalUnit.GetPosition2();
VB
Dim aController As New Controller()
Dim aRobTarget As RobTarget = c.MotionSystem.ActiveMechanicalUnit.GetPosition(CoordinateSystemType.World)
Dim aJointTarget As JointTarget = c.MotionSystem.ActiveMechanicalUnit.GetPosition()
DataChanged event

By subscribing to the DataChanged event of the MechanicalUnit object, you will be notified when a change of tool, work object, coordinated system, motion mode or incremental step size occurs.

C#
aMechUnit.DataChanged += new MechanicalUnitDataEventHandler(aMech_DataChanged);
.....
private void aMech_DataChanged(object sender, MechanicalUnitDataEventArgs e) {
switch (e.Reason) {
case MechanicalUnitDataChangeReason.Tool:
ChangeOfTool((MechanicalUnit)sender)
case MechanicalUnitDataChangeReason.WorkObject:
......
}
}
VB
AddHandler aMechUnit.DataChanged, AddressOf aMech_DataChanged
......
Private Sub aMech_DataChanged(sender As Object, e As MechanicalUnitDataEventArgs)
Select e.Reason
Case MechanicalUnitDataChangeReason.Tool
ChangeOfTool(DirectCast(sender, MechanicalUnit))
Case MechanicalUnitDataChangeReason.WorkObject
......
End Select
End Sub
Tip Tip
Read more about the classes, methods and properties available in the MotionDomain in the Reference Manual FlexPendant SDK.