RobotStudio event

ModPos on SDK

Hi,
I am using the FP sdk 5.14, and I am starting doing my own tests using the C#.


I just want to know if there is a simple way to modify a robtarget.

I read the manual and we have two options: the Modify Position Method and another one that I found more ad hoc to my needs is using the "WriteItem" instruction.

The Modify Position Method looks very simple but it is not helpfull for me because this only works only on MoveL or MoveJ instructions and not on the Data declaration.

 


My robot solution consist in load a module that belongs to a product. When a new product has to run on the line, the robot has to load a new module with the new robtargets. This modules have all declaration of Robtargets.

 

So to solve this I used the writeitem instruction to write directly on the robtarget but this has to be an array, here it is the piece of code:

 

            Task t;
            RobTarget robP;
            Controller c = new Controller();
            RapidData rdRobtarget = c.Rapid.GetRapidData("T_ROB1", "gwMain", sRobTargetEnabled);
            t = c.Rapid.GetTask("T_ROB1");

            try
            {

                MotionSystem ExAxPosition = c.MotionSystem;
                MechanicalUnit mech = ExAxPosition.GetActiveMechanicalUnit();
               
                robP = mech.GetPosition(CoordinateSystemType.Base);
                robP.Extax.Eax_a = GetExternalAxis(t).Eax_a;
                rdRobtarget.WriteItem(robP, 1);
                UpdatePosLb(sRobTargetEnabled);
            }

 

On my rapid data I made a robtarget array to use the code above posted. It also made the modpos for an external axis.

 

Ok my question again is: Is there an easy way to modpos a robtarget?

Am I on the correct way?

 

Thanks in Advance!!!

Big smile

 

 
just gelalo

Answers