RobotStudio event

RS 5.15 Add-In GetExternalAxisJointValues()

Hi,

The following rar files contain a RS Station and an AddIn to reproduce a problem  that I'm facing  when trying to read the external axis values using the method GetExternalAxisJointValues()


 

In the RS AddIn developer documentation the example code is like this:

    // Activate the first mechanical unit.
    station.Irc5Controllers[0].MechanicalUnits[0].ActivationMode = MechanicalUnitActivationMode.Active;

    // Get the JointTypes of the external axes in the task.
    JointType[] myJT = myTask.GetExternalAxisJointTypes();

    // Get the joint values of the external axes in the task.
    double[] eaValues = myTask.GetExternalAxisJointValues();

In the attached Add-In this code is executed when the user clicks on the menu  that says Test 5.15

When we run this code the mechanicalUnit corresponding to the robotic arm is set to Active (I don't really understand why at the begining is Unactive), and then the GetExternalAxisJointValues() throws an exeption with the following message:

   ex = {"Index was outside the bounds of the array."}
  
If we comment this line:
station.Irc5Controllers[0].MechanicalUnits[0].ActivationMode = MechanicalUnitActivationMode.Active;

Then the ActivationMode of the robot stays Unactive and no error is thrown which to me, seems the opposite to the expected behaviour.

If instead of a linear axis a rotational axis is used the behaviour seems even weirder because when I comment that line, the first time the command is executed it works, but after that if the

GetExternalAxisJointValues(); is called again it throws the exeption.

 

I'm a little lost and with this issue, I'm out of ideas about what might be happening so any sugestion or help  will be highly apreciated.

 

Thanks

Comments