Creating JointTargets
This examples creates a joint target corresponding to the IRB140's home position, and adds it to the active task. A joint target is a target defined by the robots joints. Targets can also be defined by setting its coordinates and orientation (this is called a RsRobTarget).
Example
Project.UndoContext.BeginUndoStep("RsJointTargetExample");
try
{
Station station = Station.ActiveStation;
// Create a joint target corresponding to the robots home position.
RsJointTarget myHomeJointTarget = new RsJointTarget();
// Get a valid RAPID name for the target and assign it.
myHomeJointTarget.Name = station.ActiveTask.GetValidRapidName("JointTarget", "_", 1);
// Add the JointTarget to the station.
station.ActiveTask.DataDeclarations.Add(myHomeJointTarget);
// Create the RobAxisValues for the target.
RobotAxisValues rbHomeAxis = new RobotAxisValues();
rbHomeAxis.Rax_1 = 0;
rbHomeAxis.Rax_2 = 0;
rbHomeAxis.Rax_3 = 0;
rbHomeAxis.Rax_4 = 0;
rbHomeAxis.Rax_5 = 30;
rbHomeAxis.Rax_6 = 0;
// Set the robot axis values of the target.
myHomeJointTarget.SetRobotAxes(rbHomeAxis, false);
// Set the target to visible in the graphics.
myHomeJointTarget.Visible = true;
// Show the name of the target in the graphics.
myHomeJointTarget.ShowName = true;
// Make the frame size twice as big for the target.
myHomeJointTarget.FrameSize = myHomeJointTarget.FrameSize * 2;
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}