Building IRB140 Model
This is the model for the IRB140. The example creates all the links and joints of the mechanism. We set the limits for each joint and defines the home position of the mechanism.
What you will see from this example is the TCP of the IRB140. Right click on MyIRB140 in the Layout browser and select Mechanism Joint Jog. Jog the robot and you will see how the TCP moves around.
Use this procedure to create an IRB 140 robot model :
Create the different parts of the robot.
Start the mechanism builder to build a robot.
Add joints to the mechanism
Set the limits of the joints
Set the base frame, home position, calibration position and joint mask
Create mechanism, set its name and add it to station.
Solution
Create the different parts of the robot.
// Create the different parts of the robot. Part Base = new Part(); Part Link1 = new Part(); Part Link2 = new Part(); Part Link3 = new Part(); Part Link4 = new Part(); Part Link5 = new Part(); Part Link6 = new Part();
Start the mechanism builder to build a robot.
// Start the mechanism builder to build a robot. MechanismBuilder mb = new MechanismBuilder(MechanismType.Robot); // Set the name of the robot. mb.ModelName = "IRB140_M2000";
Add joints to the mechanism.
// Add joints to the mechanism (connects the parts with each other). mb.AddJoint("J1", "Base", "Link1", new Vector3(0, 0, 0), new Vector3(0, 0, 0.117), JointType.Rotational, true); mb.AddJoint("J2", "Link1", "Link2", new Vector3(0.070, -0.109, 0.352), new Vector3(0.070, -0.108, 0.352), JointType.Rotational, true); mb.AddJoint("J3", "Link2", "Link3", new Vector3(0.070, -0.073, 0.712), new Vector3(0.070, -0.072, 0.712), JointType.Rotational, true); mb.AddJoint("J4", "Link3", "Link4", new Vector3(0.3075, 0, 0.712), new Vector3(0.3085, 0, 0.712), JointType.Rotational, true); mb.AddJoint("J5", "Link4", "Link5", new Vector3(0.450, 0.030, 0.712), new Vector3(0.450, 0.031, 0.712), JointType.Rotational, true); mb.AddJoint("J6", "Link5", "Link6", new Vector3(0.515, 0, 0.712), new Vector3(0.516, 0, 0.712), JointType.Rotational, true);
Set the limits of the joints.
// Set the limits of the joints (in radians). mb.SetJointLimit("J1", -180 * System.Math.PI / 180, 180 * System.Math.PI / 180); mb.SetJointLimit("J2", -90 * System.Math.PI / 180, 110 * System.Math.PI / 180); mb.SetJointLimit("J3", -230 * System.Math.PI / 180, 50 * System.Math.PI / 180); mb.SetJointLimit("J4", -200 * System.Math.PI / 180, 200 * System.Math.PI / 180); mb.SetJointLimit("J5", -120 * System.Math.PI / 180, 120 * System.Math.PI / 180); mb.SetJointLimit("J6", -400 * System.Math.PI / 180, 400 * System.Math.PI / 180);
Set the base frame, home position, calibration position and joint mask.
// Set the base frame. mb.BaseFrame = Matrix4.Identity; // Set the home position. double[] homeJointsPos = { 0, 0, 0, 0, 30 * System.Math.PI / 180, 0 }; mb.SetSyncJointPosition(homeJointsPos); // Set the calibration position. Matrix4[] calibPos = { Matrix4.Identity }; mb.SetCalibrationPosition(calibPos); // Set the joint mask (the active joints). int[] jointMask = { 1, 1, 1, 1, 1, 1 }; mb.SetJointMask(jointMask);
Create mechanism, set its name and add it to station.
// Create the mechanism (compile it), and set its name. Mechanism mech = mb.CompileMechanism(); mech.Name = "MyIRB140"; // Add it to the station. Station station = Project.ActiveProject as Station; station.GraphicComponents.Add(mech);
Example
This example creates IRB 140 Model.
private static void BuildIRB140()
{
Project.UndoContext.BeginUndoStep("Build IRB140");
try
{
// Create the different parts of the robot.
Part Base = new Part();
Part Link1 = new Part();
Part Link2 = new Part();
Part Link3 = new Part();
Part Link4 = new Part();
Part Link5 = new Part();
Part Link6 = new Part();
// Start the mechanism builder to build a robot.
MechanismBuilder mb = new MechanismBuilder(MechanismType.Robot);
// Set the name of the robot.
mb.ModelName = "IRB140_M2000";
// Add the links to the mechanism.
mb.AddLink("Base", Base);
mb.AddLink("Link1", Link1);
mb.AddLink("Link2", Link2);
mb.AddLink("Link3", Link3);
mb.AddLink("Link4", Link4);
mb.AddLink("Link5", Link5);
mb.AddLink("Link6", Link6);
// Set the base link.
mb.BaseLink = "Base";
// Add joints to the mechanism (connects the parts with each other).
mb.AddJoint("J1", "Base", "Link1", new Vector3(0, 0, 0),
new Vector3(0, 0, 0.117), JointType.Rotational, true);
mb.AddJoint("J2", "Link1", "Link2", new Vector3(0.070, -0.109, 0.352),
new Vector3(0.070, -0.108, 0.352), JointType.Rotational, true);
mb.AddJoint("J3", "Link2", "Link3", new Vector3(0.070, -0.073, 0.712),
new Vector3(0.070, -0.072, 0.712), JointType.Rotational, true);
mb.AddJoint("J4", "Link3", "Link4", new Vector3(0.3075, 0, 0.712),
new Vector3(0.3085, 0, 0.712), JointType.Rotational, true);
mb.AddJoint("J5", "Link4", "Link5", new Vector3(0.450, 0.030, 0.712),
new Vector3(0.450, 0.031, 0.712), JointType.Rotational, true);
mb.AddJoint("J6", "Link5", "Link6", new Vector3(0.515, 0, 0.712),
new Vector3(0.516, 0, 0.712), JointType.Rotational, true);
// Set the limits of the joints (in radians).
mb.SetJointLimit("J1", -180 * System.Math.PI / 180, 180 * System.Math.PI / 180);
mb.SetJointLimit("J2", -90 * System.Math.PI / 180, 110 * System.Math.PI / 180);
mb.SetJointLimit("J3", -230 * System.Math.PI / 180, 50 * System.Math.PI / 180);
mb.SetJointLimit("J4", -200 * System.Math.PI / 180, 200 * System.Math.PI / 180);
mb.SetJointLimit("J5", -120 * System.Math.PI / 180, 120 * System.Math.PI / 180);
mb.SetJointLimit("J6", -400 * System.Math.PI / 180, 400 * System.Math.PI / 180);
// Add flange.
Matrix4 flangeOffset = new Matrix4(new Vector3(0, 0, -1), new Vector3(0, 1, 0),
new Vector3(1, 0, 0), new Vector3(0.515, 0, 0.712));
mb.AddFlange("wrist", "Link6", flangeOffset, false);
// Set the base frame.
mb.BaseFrame = Matrix4.Identity;
// Set the home position.
double[] homeJointsPos = { 0, 0, 0, 0, 30 * System.Math.PI / 180, 0 };
mb.SetSyncJointPosition(homeJointsPos);
// Set the calibration position.
Matrix4[] calibPos = { Matrix4.Identity };
mb.SetCalibrationPosition(calibPos);
// Set the joint mask (the active joints).
int[] jointMask = { 1, 1, 1, 1, 1, 1 };
mb.SetJointMask(jointMask);
// Create the mechanism (compile it), and set its name.
Mechanism mech = mb.CompileMechanism();
mech.Name = "MyIRB140";
// Add it to the station.
Station station = Project.ActiveProject as Station;
station.GraphicComponents.Add(mech);
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
}
Required Namespaces
ABB.
ABB.