Class RsRobTarget
A RsRobTarget corresponds to a robtarget declaration in RAPID. A robtarget is used to define the position of a robot and external axes.
Implements
Inherited Members
Namespace: ABB.Robotics.RobotStudio.Stations
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
public sealed class RsRobTarget : RsDataDeclaration, ISupportCopy, IDeclaration, IGfxObject
Examples
RsRobTarget Example.
Project.UndoContext.BeginUndoStep("RsRobTargetExample");
try
{
// NOTE: This example requires a station containing an IRB_140 and a running VC.
Station station = Station.ActiveStation;
// Create a RobTarget, that corresponds to the home position of a IRB_140.
RsRobTarget myRobTarget = new RsRobTarget();
// Set the name of the RobTarget.
myRobTarget.Name = station.ActiveTask.GetValidRapidName("Target", "_", 10);
// Set the position and rotation of the RobTarget.
myRobTarget.Frame.X = 0.50629;
myRobTarget.Frame.Y = 0;
myRobTarget.Frame.Z = 0.67950;
myRobTarget.Frame.RX = Globals.DegToRad(180); // From ABB.Robotics.Math
myRobTarget.Frame.RY = Globals.DegToRad(60);
myRobTarget.Frame.RZ = Globals.DegToRad(180);
// Add the RobTarget to the DataDeclarations of the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myRobTarget);
// Set the RobTarget not to be an inline declaration.
myRobTarget.IsInline = false;
// Create an RsTarget for the RobTarget, to give it a graphical representation and use it to get configs.
RsTarget myRsTarget = new RsTarget(station.ActiveTask.ActiveWorkObject, myRobTarget);
myRsTarget.Name = myRobTarget.Name;
// Add it to the ActiveTask.
station.ActiveTask.Targets.Add(myRsTarget);
bool includeTurns = true; //get the turns also = all solutions
// Get all the solutions for the RobTarget using the mechanism.
ConfigurationData[] myConfs = station.ActiveTask.Mechanism.GetAllConfigurations(myRsTarget, station.ActiveTask.ActiveTool, includeTurns);
if (myConfs.Length > 0)
{
// There is at least one configuration for the RobTarget, use the first.
myRobTarget.ConfigurationData = myConfs[0];
// Set the ConfigurationStatus as defined, since there is a valid config.
myRobTarget.ConfigurationStatus = ConfigurationStatus.Defined;
// Output the config.
Logger.AddMessage(new LogMessage("The configuration of RobTarget: '" + myRobTarget.Name
+ "' is: '[" + myRobTarget.ConfigurationData.Cf1 + ", "
+ myRobTarget.ConfigurationData.Cf4 + ", "
+ myRobTarget.ConfigurationData.Cf6 + ", "
+ myRobTarget.ConfigurationData.Cfx + "]'"));
}
else
{
// Could not find any valid configurations fo the RobTarget.
// Set the configuration status to no solutions.
myRobTarget.ConfigurationStatus = ConfigurationStatus.NoSolutions;
// Output a message.
Logger.AddMessage(new LogMessage("There are no configuration for robtarget: '" + myRobTarget.Name + "'"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Constructors
RsRobTarget()
Creates and initializes a new RsRobTarget object.
Declaration
public RsRobTarget()
Examples
Create RsRobTarget.
Project.UndoContext.BeginUndoStep("RsRobTargetExample");
try
{
// NOTE: This example requires a station containing an IRB_140 and a running VC.
Station station = Station.ActiveStation;
// Create a RobTarget, that corresponds to the home position of a IRB_140.
RsRobTarget myRobTarget = new RsRobTarget();
// Set the name of the RobTarget.
myRobTarget.Name = station.ActiveTask.GetValidRapidName("Target", "_", 10);
// Set the position and rotation of the RobTarget.
myRobTarget.Frame.X = 0.50629;
myRobTarget.Frame.Y = 0;
myRobTarget.Frame.Z = 0.67950;
myRobTarget.Frame.RX = Globals.DegToRad(180); // From ABB.Robotics.Math
myRobTarget.Frame.RY = Globals.DegToRad(60);
myRobTarget.Frame.RZ = Globals.DegToRad(180);
// Add the RobTarget to the DataDeclarations of the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myRobTarget);
// Set the RobTarget not to be an inline declaration.
myRobTarget.IsInline = false;
// Create an RsTarget for the RobTarget, to give it a graphical representation and use it to get configs.
RsTarget myRsTarget = new RsTarget(station.ActiveTask.ActiveWorkObject, myRobTarget);
myRsTarget.Name = myRobTarget.Name;
// Add it to the ActiveTask.
station.ActiveTask.Targets.Add(myRsTarget);
bool includeTurns = true; //get the turns also = all solutions
// Get all the solutions for the RobTarget using the mechanism.
ConfigurationData[] myConfs = station.ActiveTask.Mechanism.GetAllConfigurations(myRsTarget, station.ActiveTask.ActiveTool, includeTurns);
if (myConfs.Length > 0)
{
// There is at least one configuration for the RobTarget, use the first.
myRobTarget.ConfigurationData = myConfs[0];
// Set the ConfigurationStatus as defined, since there is a valid config.
myRobTarget.ConfigurationStatus = ConfigurationStatus.Defined;
// Output the config.
Logger.AddMessage(new LogMessage("The configuration of RobTarget: '" + myRobTarget.Name
+ "' is: '[" + myRobTarget.ConfigurationData.Cf1 + ", "
+ myRobTarget.ConfigurationData.Cf4 + ", "
+ myRobTarget.ConfigurationData.Cf6 + ", "
+ myRobTarget.ConfigurationData.Cfx + "]'"));
}
else
{
// Could not find any valid configurations fo the RobTarget.
// Set the configuration status to no solutions.
myRobTarget.ConfigurationStatus = ConfigurationStatus.NoSolutions;
// Output a message.
Logger.AddMessage(new LogMessage("There are no configuration for robtarget: '" + myRobTarget.Name + "'"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Properties
ConfigurationData
Gets or sets the ConfigurationData of the robtarget.
Declaration
public ConfigurationData ConfigurationData { get; set; }
Property Value
Type | Description |
---|---|
ConfigurationData |
Examples
Get/Set ConfigurationData.
Project.UndoContext.BeginUndoStep("RsRobTargetExample");
try
{
// NOTE: This example requires a station containing an IRB_140 and a running VC.
Station station = Station.ActiveStation;
// Create a RobTarget, that corresponds to the home position of a IRB_140.
RsRobTarget myRobTarget = new RsRobTarget();
// Set the name of the RobTarget.
myRobTarget.Name = station.ActiveTask.GetValidRapidName("Target", "_", 10);
// Set the position and rotation of the RobTarget.
myRobTarget.Frame.X = 0.50629;
myRobTarget.Frame.Y = 0;
myRobTarget.Frame.Z = 0.67950;
myRobTarget.Frame.RX = Globals.DegToRad(180); // From ABB.Robotics.Math
myRobTarget.Frame.RY = Globals.DegToRad(60);
myRobTarget.Frame.RZ = Globals.DegToRad(180);
// Add the RobTarget to the DataDeclarations of the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myRobTarget);
// Set the RobTarget not to be an inline declaration.
myRobTarget.IsInline = false;
// Create an RsTarget for the RobTarget, to give it a graphical representation and use it to get configs.
RsTarget myRsTarget = new RsTarget(station.ActiveTask.ActiveWorkObject, myRobTarget);
myRsTarget.Name = myRobTarget.Name;
// Add it to the ActiveTask.
station.ActiveTask.Targets.Add(myRsTarget);
bool includeTurns = true; //get the turns also = all solutions
// Get all the solutions for the RobTarget using the mechanism.
ConfigurationData[] myConfs = station.ActiveTask.Mechanism.GetAllConfigurations(myRsTarget, station.ActiveTask.ActiveTool, includeTurns);
if (myConfs.Length > 0)
{
// There is at least one configuration for the RobTarget, use the first.
myRobTarget.ConfigurationData = myConfs[0];
// Set the ConfigurationStatus as defined, since there is a valid config.
myRobTarget.ConfigurationStatus = ConfigurationStatus.Defined;
// Output the config.
Logger.AddMessage(new LogMessage("The configuration of RobTarget: '" + myRobTarget.Name
+ "' is: '[" + myRobTarget.ConfigurationData.Cf1 + ", "
+ myRobTarget.ConfigurationData.Cf4 + ", "
+ myRobTarget.ConfigurationData.Cf6 + ", "
+ myRobTarget.ConfigurationData.Cfx + "]'"));
}
else
{
// Could not find any valid configurations fo the RobTarget.
// Set the configuration status to no solutions.
myRobTarget.ConfigurationStatus = ConfigurationStatus.NoSolutions;
// Output a message.
Logger.AddMessage(new LogMessage("There are no configuration for robtarget: '" + myRobTarget.Name + "'"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
ConfigurationStatus
Gets or sets the ConfigurationStatus of the robtarget.
Declaration
public ConfigurationStatus ConfigurationStatus { get; set; }
Property Value
Type | Description |
---|---|
ConfigurationStatus |
Examples
Get/Set ConfigurationStatus.
Project.UndoContext.BeginUndoStep("RsRobTargetExample");
try
{
// NOTE: This example requires a station containing an IRB_140 and a running VC.
Station station = Station.ActiveStation;
// Create a RobTarget, that corresponds to the home position of a IRB_140.
RsRobTarget myRobTarget = new RsRobTarget();
// Set the name of the RobTarget.
myRobTarget.Name = station.ActiveTask.GetValidRapidName("Target", "_", 10);
// Set the position and rotation of the RobTarget.
myRobTarget.Frame.X = 0.50629;
myRobTarget.Frame.Y = 0;
myRobTarget.Frame.Z = 0.67950;
myRobTarget.Frame.RX = Globals.DegToRad(180); // From ABB.Robotics.Math
myRobTarget.Frame.RY = Globals.DegToRad(60);
myRobTarget.Frame.RZ = Globals.DegToRad(180);
// Add the RobTarget to the DataDeclarations of the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myRobTarget);
// Set the RobTarget not to be an inline declaration.
myRobTarget.IsInline = false;
// Create an RsTarget for the RobTarget, to give it a graphical representation and use it to get configs.
RsTarget myRsTarget = new RsTarget(station.ActiveTask.ActiveWorkObject, myRobTarget);
myRsTarget.Name = myRobTarget.Name;
// Add it to the ActiveTask.
station.ActiveTask.Targets.Add(myRsTarget);
bool includeTurns = true; //get the turns also = all solutions
// Get all the solutions for the RobTarget using the mechanism.
ConfigurationData[] myConfs = station.ActiveTask.Mechanism.GetAllConfigurations(myRsTarget, station.ActiveTask.ActiveTool, includeTurns);
if (myConfs.Length > 0)
{
// There is at least one configuration for the RobTarget, use the first.
myRobTarget.ConfigurationData = myConfs[0];
// Set the ConfigurationStatus as defined, since there is a valid config.
myRobTarget.ConfigurationStatus = ConfigurationStatus.Defined;
// Output the config.
Logger.AddMessage(new LogMessage("The configuration of RobTarget: '" + myRobTarget.Name
+ "' is: '[" + myRobTarget.ConfigurationData.Cf1 + ", "
+ myRobTarget.ConfigurationData.Cf4 + ", "
+ myRobTarget.ConfigurationData.Cf6 + ", "
+ myRobTarget.ConfigurationData.Cfx + "]'"));
}
else
{
// Could not find any valid configurations fo the RobTarget.
// Set the configuration status to no solutions.
myRobTarget.ConfigurationStatus = ConfigurationStatus.NoSolutions;
// Output a message.
Logger.AddMessage(new LogMessage("There are no configuration for robtarget: '" + myRobTarget.Name + "'"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Frame
Gets the Transform that defines the position of the robtarget relative to a RsWorkObject.
Declaration
public Transform Frame { get; }
Property Value
Type | Description |
---|---|
Transform |
Examples
Get Frame.
Project.UndoContext.BeginUndoStep("RsRobTargetExample");
try
{
// NOTE: This example requires a station containing an IRB_140 and a running VC.
Station station = Station.ActiveStation;
// Create a RobTarget, that corresponds to the home position of a IRB_140.
RsRobTarget myRobTarget = new RsRobTarget();
// Set the name of the RobTarget.
myRobTarget.Name = station.ActiveTask.GetValidRapidName("Target", "_", 10);
// Set the position and rotation of the RobTarget.
myRobTarget.Frame.X = 0.50629;
myRobTarget.Frame.Y = 0;
myRobTarget.Frame.Z = 0.67950;
myRobTarget.Frame.RX = Globals.DegToRad(180); // From ABB.Robotics.Math
myRobTarget.Frame.RY = Globals.DegToRad(60);
myRobTarget.Frame.RZ = Globals.DegToRad(180);
// Add the RobTarget to the DataDeclarations of the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myRobTarget);
// Set the RobTarget not to be an inline declaration.
myRobTarget.IsInline = false;
// Create an RsTarget for the RobTarget, to give it a graphical representation and use it to get configs.
RsTarget myRsTarget = new RsTarget(station.ActiveTask.ActiveWorkObject, myRobTarget);
myRsTarget.Name = myRobTarget.Name;
// Add it to the ActiveTask.
station.ActiveTask.Targets.Add(myRsTarget);
bool includeTurns = true; //get the turns also = all solutions
// Get all the solutions for the RobTarget using the mechanism.
ConfigurationData[] myConfs = station.ActiveTask.Mechanism.GetAllConfigurations(myRsTarget, station.ActiveTask.ActiveTool, includeTurns);
if (myConfs.Length > 0)
{
// There is at least one configuration for the RobTarget, use the first.
myRobTarget.ConfigurationData = myConfs[0];
// Set the ConfigurationStatus as defined, since there is a valid config.
myRobTarget.ConfigurationStatus = ConfigurationStatus.Defined;
// Output the config.
Logger.AddMessage(new LogMessage("The configuration of RobTarget: '" + myRobTarget.Name
+ "' is: '[" + myRobTarget.ConfigurationData.Cf1 + ", "
+ myRobTarget.ConfigurationData.Cf4 + ", "
+ myRobTarget.ConfigurationData.Cf6 + ", "
+ myRobTarget.ConfigurationData.Cfx + "]'"));
}
else
{
// Could not find any valid configurations fo the RobTarget.
// Set the configuration status to no solutions.
myRobTarget.ConfigurationStatus = ConfigurationStatus.NoSolutions;
// Output a message.
Logger.AddMessage(new LogMessage("There are no configuration for robtarget: '" + myRobTarget.Name + "'"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
IsInline
Gets or sets whether the robtarget will be decalared inline in the RAPID when synchronized.
Declaration
public bool IsInline { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Examples
Get/Set IsInline.
Project.UndoContext.BeginUndoStep("RsRobTargetExample");
try
{
// NOTE: This example requires a station containing an IRB_140 and a running VC.
Station station = Station.ActiveStation;
// Create a RobTarget, that corresponds to the home position of a IRB_140.
RsRobTarget myRobTarget = new RsRobTarget();
// Set the name of the RobTarget.
myRobTarget.Name = station.ActiveTask.GetValidRapidName("Target", "_", 10);
// Set the position and rotation of the RobTarget.
myRobTarget.Frame.X = 0.50629;
myRobTarget.Frame.Y = 0;
myRobTarget.Frame.Z = 0.67950;
myRobTarget.Frame.RX = Globals.DegToRad(180); // From ABB.Robotics.Math
myRobTarget.Frame.RY = Globals.DegToRad(60);
myRobTarget.Frame.RZ = Globals.DegToRad(180);
// Add the RobTarget to the DataDeclarations of the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myRobTarget);
// Set the RobTarget not to be an inline declaration.
myRobTarget.IsInline = false;
// Create an RsTarget for the RobTarget, to give it a graphical representation and use it to get configs.
RsTarget myRsTarget = new RsTarget(station.ActiveTask.ActiveWorkObject, myRobTarget);
myRsTarget.Name = myRobTarget.Name;
// Add it to the ActiveTask.
station.ActiveTask.Targets.Add(myRsTarget);
bool includeTurns = true; //get the turns also = all solutions
// Get all the solutions for the RobTarget using the mechanism.
ConfigurationData[] myConfs = station.ActiveTask.Mechanism.GetAllConfigurations(myRsTarget, station.ActiveTask.ActiveTool, includeTurns);
if (myConfs.Length > 0)
{
// There is at least one configuration for the RobTarget, use the first.
myRobTarget.ConfigurationData = myConfs[0];
// Set the ConfigurationStatus as defined, since there is a valid config.
myRobTarget.ConfigurationStatus = ConfigurationStatus.Defined;
// Output the config.
Logger.AddMessage(new LogMessage("The configuration of RobTarget: '" + myRobTarget.Name
+ "' is: '[" + myRobTarget.ConfigurationData.Cf1 + ", "
+ myRobTarget.ConfigurationData.Cf4 + ", "
+ myRobTarget.ConfigurationData.Cf6 + ", "
+ myRobTarget.ConfigurationData.Cfx + "]'"));
}
else
{
// Could not find any valid configurations fo the RobTarget.
// Set the configuration status to no solutions.
myRobTarget.ConfigurationStatus = ConfigurationStatus.NoSolutions;
// Output a message.
Logger.AddMessage(new LogMessage("There are no configuration for robtarget: '" + myRobTarget.Name + "'"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Methods
AfterLoad(PimDocument)
Declaration
protected override void AfterLoad(PimDocument doc)
Parameters
Type | Name | Description |
---|---|---|
RobotStudio.API.Persistence.PimDocument | doc |
Overrides
Copy()
Declaration
public override ProjectObject Copy()
Returns
Type | Description |
---|---|
ProjectObject |
Overrides
GetExternalAxes(Boolean)
Gets the ExternalAxisValues of the robtarget.
Declaration
public ExternalAxisValues GetExternalAxes(bool convertFromRapidDataToSI)
Parameters
Type | Name | Description |
---|---|---|
Boolean | convertFromRapidDataToSI | Specifies whether the ExternalAxisValues should be converted from the RAPID data format to SI or not. |
Returns
Type | Description |
---|---|
ExternalAxisValues | The ExternalAxisValues of the robtarget. |
SetConfiguration(Int32, Int32, Int32, Int32)
Sets the configuration values of the robtarget.
Declaration
public void SetConfiguration(int cf1, int cf4, int cf6, int cfx)
Parameters
Type | Name | Description |
---|---|---|
Int32 | cf1 | |
Int32 | cf4 | |
Int32 | cf6 | |
Int32 | cfx |
SetExternalAxes(ExternalAxisValues, Boolean)
Sets the ExternalAxisValues of the robtarget.
Declaration
public void SetExternalAxes(ExternalAxisValues value, bool convertFromSIToRapidData)
Parameters
Type | Name | Description |
---|---|---|
ExternalAxisValues | value | The ExternalAxisValues to be set for the robtarget. |
Boolean | convertFromSIToRapidData | Specifies whether the ExternalAxisValues should be converted from the SI to RAPID data format or not. |
SetExternalAxisValue(Int32, Double)
Sets a single external axis value of the robtarget in RAPID units.
Declaration
public void SetExternalAxisValue(int index, double value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | |
Double | value |