RobotStudio event

Activation status of a mechanical unit

Options
Hello,

I use FPSDK 5.10, and I would like to know if I can get (and set) the activation status of a mechanical unit. Otherwise, does this feature is planned for a future release of FPSDK?

With the DataChanged event of the class MechanicalUnit, I can know when the activation status change, but I can't get the current status.

I want to do this :

MechanicalUnit abbMechUnit = abbController.MotionSystem.GetActiveMechanicalUnit();
abbMechUnit.Tool = "t_MyTool";
abbMechUnit.WorkObjectName = "w_MyWorkObject";

// VAR WObjData w_MyWorkObject := [FALSE,FALSE,"STN1",[...],[...]];

RobTarget abbRobT = abbMechUnit.GetPosition(CoordinateSystemType.WorkObject);

But if my mechanical unit "STN1" (used in w_MyWorkObject) isn't activated, the method GetPosition raise an error on the FlexPendant, even if I use a try/catch around the call of GetPosition.

I would like to activate the mechanical unit or at least get the activation status in order to give a message to the user.

Thanks,
Herv?


Comments

  • RussD
    Options

    What error/exception are you getting?

    Russell Drown
  • Herve
    Options
    Hy Russell,

    The error is :

    "Attempt to coordinate motion or calculate position of deactivated single unit STN1.
    Actions
    Activate unit via Motion Unit key, then Jogging window or program. Check work object and program."

    So I activate the unit "STN1" in the jogging window and after it works.

    Herv?.

  • RussD
    Options

    I think that, for jogging purposes, you can only have one mechanical unit active at a time, so by definition whatever is returned by GetActiveMechanicalUnit implies that every other unit is inactive.

    Have you tried setting:

    abbController.MotionSystem.ActiveMechanicalUnit = "STN1"

    before checking the position?

    Russell Drown
  • Herve
    Options
    Hy Russel,
    Activation status of a unit and active unit aren't the same thing.

    In my example (I forgot a line in my last post) :

    MechanicalUnit abbMechUnit = abbController.MotionSystem.GetActiveMechanicalUnit();
    abbMechUnit.CoordinateSystem = CoordinateSystemType.WorkObject; // The line I forgot
    abbMechUnit.Tool = "t_MyTool";
    abbMechUnit.WorkObjectName = "w_MyWorkObject";

    // VAR WObjData w_MyWorkObject := [FALSE,FALSE,"STN1",[...],[...]];

    RobTarget abbRobT = abbMechUnit.GetPosition(CoordinateSystemType.WorkObject);

    abbMechUnit must be the robot (unit "ROB_1"), otherwise I can't define abbMechUnit.CoordinateSystem = CoordinateSystemType.WorkObject (and I need this to get the robtarget in the good frame).

    I can define my Active Unit to "STN1" :
    image
    but I get the same error.

    I can change the activation status in Jogging window / Menu "Activate..." :
    image
    Here, I can activate several units. If "ROB_1" and "STN1" are activated, it works fine, but "STN1" isn't always activated (due to our process) and in this case the GetPosition method fails.
    This is this "Activation Status" I can't get or set via FPSDK 5.10.

    Herv?.