Click or drag to resize
RsRobTarget Class
A RsRobTarget corresponds to a robtarget declaration in RAPID. A robtarget is used to define the position of a robot and external axes.
Inheritance Hierarchy

Namespace:  ABB.Robotics.RobotStudio.Stations
Assembly:  ABB.Robotics.RobotStudio.Stations (in ABB.Robotics.RobotStudio.Stations.dll) Version: 7.0.8747.636
Syntax
C#
public sealed class RsRobTarget : RsDataDeclaration

The RsRobTarget type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleRsRobTarget
Creates and initializes a new RsRobTarget object.
Top
Properties
  NameDescription
Public propertyAttributes
Returns a collection of dynamic attributes attached to the object
(Inherited from ProjectObject.)
Public propertyChildren
Enumerates all child objects.
(Inherited from ProjectObject.)
Public propertyCode exampleConfigurationData
Gets or sets the ConfigurationData of the robtarget.
Public propertyCode exampleConfigurationStatus
Gets or sets the ConfigurationStatus of the robtarget.
Public propertyContainingProject
Returns the Project that this object is a part of, or null if it is not part of a Project.
(Inherited from ProjectObject.)
Public propertyCode exampleDataType
Gets the RAPID data type of the Data Declaration.
(Inherited from RsDataDeclaration.)
Public propertyDisplayName (Inherited from RsDataDeclaration.)
Public propertyCode exampleFrame
Gets the Transform that defines the position of the robtarget relative to a RsWorkObject.
Public propertyCode exampleIsInline
Gets or sets whether the robtarget will be decalared inline in the RAPID when synchronized.
Public propertyLocal
Gets or sets if the DataDeclaration is declared local in a module. (Corresponds to the LOCAL keyword in RAPID).
(Inherited from RsDataDeclaration.)
Public propertyModuleName
Gets or sets the name of the RAPID module that the DataDeclaration will be synchronized to.
(Inherited from RsDataDeclaration.)
Public propertyName
Gets or sets the name of the DataDeclaration
(Inherited from RsDataDeclaration.)
Public propertyParent
Returns the objects parent, if it has one.
(Inherited from ProjectObject.)
Public propertyStorageType
Gets or sets the RapidStorageType of the DataDeclaration
(Inherited from RsDataDeclaration.)
Public propertySynchronize
Gets or sets whether the DataDeclaration should be synchronized to the VC when the referencing RsPathProcedure is.
(Inherited from RsDataDeclaration.)
Public propertyTypeDisplayName
Gets a localized name for the type of this object.
(Inherited from ProjectObject.)
Public propertyUIVisible
Gets or sets a value that indicates if this object should be displayed in GUI such as an object browser.
(Inherited from ProjectObject.)
Public propertyUniqueId
Gets a persisted, globally unique identifier for this object, that can be used to find the object using the GetObjectFromUniqueId(String) method.
(Inherited from ProjectObject.)
Top
Methods
  NameDescription
Public methodCopy (Overrides RsDataDeclarationCopy.)
Public methodEquals (Inherited from Object.)
Public methodFindObjects
Recursively finds object that satisfy a condition.
(Inherited from ProjectObject.)
Public methodGetExternalAxes
Gets the ExternalAxisValues of the robtarget.
Public methodGetHashCode (Inherited from Object.)
Public methodGetReferencingInstructions
Returns all RsInstructions that are referencing this DataDeclaration.
(Inherited from RsDataDeclaration.)
Public methodGetType (Inherited from Object.)
Public methodSetConfiguration
Sets the configuration values of the robtarget.
Public methodSetExternalAxes
Sets the ExternalAxisValues of the robtarget.
Public methodSetExternalAxisValue
Sets a single external axis value of the robtarget in RAPID units.
Public methodToString (Inherited from ProjectObject.)
Top
Examples
RsRobTarget Example.
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();
}
Version Information

Supported in: 1.0.0.0
See Also