RobotStudio event

How to Read value of External Axis (INTERCH)?

Hello ABB Community,

I am a Student from Porto's University - Portugal. 
We've an IRB 2400 with a external "table" IRBc 500kg. 

I am trying to develop a program based in C# for the footwear industry. 

I need to get some help about reading values from external axis (I only can read correctly the robot's axis).

The code that I'm using for the external axis is :

private void button6_Click(object sender, EventArgs e)
        {
                        
            MotionSystem motion = c.MotionSystem;
            MechanicalUnit mech = motion.GetActiveMechanicalUnit();
            JointTarget robb;
            robb = mech.GetPosition();

            MessageBox.Show(robb.ExtAx.Eax_d.ToString());

     }

I've put the reading value returning to a message box, and the value is always "0", even if I move the "table".

Do you have any solution ?

I am thinking that the problem maybe concern in the "GetActiveMechanicalUnite".. but.. how can I select the "INTERCH" unit ?

everything is during Virtual Controller. Further I will test it on the Real controller.

Best Regards,

Nuno Moita


Comments

  • Hi Nuno,

    Maybe u can use a trap routine in your RAPID code for changing active mechanical unit.When u press button6, set a virtual signal to 1 and catch it with a trap routine.

    VAR intnum Ileri;

    IDelete tx;
    CONNECT Ileri WITH IRBc;
    ISignalDO doVirtual,1,tx;

    TRAP IRBc
        ActUnit INTERCH;
    ENDTRAP
      
    And at the end of ur button6_click event reset virtual signal.

    Erdem Karaçeper
  • Hi there,

    Thanks for the help for the tip. But I've already tried that, calling a Rapid program first with ActUnit Interch, and after to tried to read the value, but it gave me always "0".

    Further, I found that, changing on the Virtual FlexPendant to the INTERCH and using the following code (similiar to read robot axis number 1) it gaves me the correct value of the external axis (INTERCH).

    private void button6_Click(object sender, EventArgs e)
            {
                            
                MotionSystem motion = c.MotionSystem;
                MechanicalUnit mech = motion.GetActiveMechanicalUnit();
                JointTarget robb;
                robb = mech.GetPosition();

                MessageBox.Show(robb.RobAx.Rax_1.ToString());

         }

    So my question is.. how can I using programming code C# change the mechanical unit "ROB_1" to "INTERCH" ?

    Best Regards, and thanks,

    Nuno Moita