RobotStudio event

Rotating a trunnion

I have a trunnion in my workcell that is NOT controlled by the robot; I created it using the kinematic modeler. I am trying to determine how to rotate the trunnion during certain points while running my program (i.e. Run through a couple paths, rotate the trunnion 90 degrees, run through a couple paths, rotate another 90 degrees, etc.)

Does anyone have an idea how to do this? Or perhaps I could pause the program and rotate the trunnion manually but this is not optimal. Any suggestions? Thanks.

Stacey

SBalamucki38685,9500578704

Comments

  • Hi Stacey,

    You can control your trunnion with a VBA Macro, that you trigg with a event int he EventTable (See the Online Help how to use the EventTable). Here is an example of a VBA macro that rotates the attached TurnTable 90 degrees each time. Paste the code in the VBA-editor that you find in the menu: Tools - Macro -  Visual basic Editor. VBA code:

    Sub RotateTable()
        Dim Value As Variant
        Dim TurnTable As Mechanism
        Dim dblDeg As Double
        Dim TurnValue As Variant
        Dim Pi As Double
       
        Pi = 4 * Atn(1)
        dblDeg = Pi / 180
        Set TurnTable = ActiveStation.Mechanisms("TurnTable")
        TurnValue = TurnTable.JointValues
        If RotateValue > 360 Then
            RotateValue = 0
        End If
        TurnValue(0) = RotateValue * dblDeg
        TurnTable.JointValues = TurnValue
        ActiveStation.Refresh
        RotateValue = RotateValue + 90
    End Sub

    TurnTable.ZIP

    Anders S38686,4680092593
    Best regards,
    Anders Spaak
    ABB Robotics
  • Hi Anders,

    Thanks for the help, I figured I might have to use VBA. I'm somewhat familiar with it so I think I will be okay it that area. I'm having some trouble setting up the event table the way it should be.

    My program doesn't have a set number of procedures it runs through before it needs to turn the trunnion. Sometimes it runs through 3, sometimes 4, etc. I also have multiple pounce positions to where the robot returns to before the trunnion turns. What do you suggest to do to trigger the event at exact locations in the code(i.e. after procedure a308, turn the trunnion, then continue, etc.)? Is this possible? Thanks.

    Stacey

  • Hi Stacey,

    I suggest that you use a I/O-signal to trigg the event.
    So if you use the rapid instruction SetDO to set the I/O (SetDO doRotate,1;), can you reset the same I/O from the VBA macro:

    Sub RotateTable()
        Dim Value As Variant
        Dim TurnTable As Mechanism
        Dim dblDeg As Double
        Dim TurnValue As Variant
        Dim Pi As Double
        Dim VC As Controller

        Set VC = ActiveStation.ActiveMechanism.Controller
        Pi = 4 * Atn(1)
        dblDeg = Pi / 180
        Set TurnTable = ActiveStation.Mechanisms("TurnTable")
        TurnValue = TurnTable.JointValues
        If RotateValue > 360 Then
            RotateValue = 0
        End If
        TurnValue(0) = RotateValue * dblDeg
        TurnTable.JointValues = TurnValue
        ActiveStation.Refresh
        RotateValue = RotateValue + 90
        VC.IOs.Item("doRotate").Value = 0
    End Sub

     

    Best regards,
    Anders Spaak
    ABB Robotics
  • Anders,

    Thanks for all the help. I got everything running as planned. In case anyone wanted to see my final code I added it at the bottom; I tweaked it a bit from yours. Thanks again.

    Stacey

    Sub RotateTable()
        Dim Value As Variant
        Dim Trunnion As Mechanism
        Dim dblDeg As Double
        Dim TurnValue As Variant
        Dim Pi As Double
        Dim VC As Controller

        Set VC = ActiveStation.ActiveMechanism.Controller
        Pi = 4 * Atn(1)
        dblDeg = Pi / 180
        Set Trunnion = ActiveStation.Mechanisms("trunnion")
        TurnValue = Trunnion.JointValues
        RotateValue = 90
        TurnValue(0) = TurnValue(0) + (RotateValue * dblDeg)
        If TurnValue(0) > 7 Then
            TurnValue(0) = 0
        End If
        Trunnion.JointValues = TurnValue
        ActiveStation.Refresh
        VC.IOs.Item("doRotate").Value = 0
    End Sub

  • Hi Again,

    I have one more question, more for curiosity sake than anything. If the device (i.e. Trunnion) was controlled by the ABB controller, how would that work? I know that only RS5.0 with the IRC5 Controller can control multiple robots, but can RS3.2 with the S4 controller control both a  robot and, for example, a trunnion at the same time? Thanks.

    Stacey

  • Hi Stacey,

    Yes the Trunnion can be controlled by the robot. A S4 controller can control up to six external axes (coordinated or uncoordinated).

    But you have to configure your system for the external axis.

    Together with RobotStudio is the program ConfigEdit installed. This program can you use to create configuration files for external axes. But be aware of that you have to know what type of drive units and so on you should use for the external axes.

    If you control a external axis by the robot, you have to add the external axis value to your robtarget data.

     

    Anders S38688,6815162037
    Best regards,
    Anders Spaak
    ABB Robotics