RobotStudio event

Passing a mecunit as a parameter to a PROC

I have a few robots with external servos on the gripper and I want to write a PROC that all the robots can use, so I'm trying to pass a Mecunit as a parameter into a routine.  I'm presented with a fault saying that a mecunit is not a value.  Is there a clean way of passing a mecunit? 

Comments

  • How about using a switch, then use function Present?
    Lee Justice
  • I thought about that but I some robots have one external axis and some have 4 so I want to write a routine that I just feed the parameters and no matter how many axis it will be the same code. 
  • The switch is optional, you a.) don't pass any at all, b.) pass one or more or, c.) use them all if appropriate.
    Lee Justice
  • lemster68
    lemster68 ✭✭✭
    edited November 2019
    IF Present(swMecUnit1) THEN
        ActUnit MecUnit1;
        Do whatever;
    either another IF or ELSEIF
       blah blah
    ENDIF
    Lee Justice
  • Is there a way to read which mechanical unit is configured on the robot?
  • Maybe, but I am almost done here for today.  I can look tomorrow if you have not found out.
    Lee Justice
  • I think I got it.  I had to put a VAR in front of the data type 

    PROC EOATServo(var mecunit Servo,robtarget pTarget,num Speed)
  • Yup that's what it was