How to simulate moving objects
Martin
✭
Here is an example how to simulate moving objects, for instances, parts on a conveyor.
This is a VBA example that was used in a project. A timer (ccrpTmr6.dll) is also required. 818_Ccrptmr6.zip
This code defines a timer that calls a routine (that moves bottles) every 10th millisec:
Public WithEvents waitTime1 As ccrpTimer
Sub EnableBottlefeed()
Set waitTime1 = New ccrpTimer
waitTime1.Enabled = True
End Sub
Private Sub waitTime1_Timer(ByVal Milliseconds As Long)
waitTime1.Interval = 10
'Move the bottles
BottleFeedIncrease
End Sub
This code moves some bottles (along Y-axis) until it reaches an end-point. Then a signal is set and the timer is disabled:
Sub BottleFeedIncrease()
Dim VC As Controller
Dim dblBottlesYcord1 As Double
Dim dblBottlesYcord2 As Double
Dim dblBottlesYcord3 As Double
Set VC = ActiveStation.Controllers("IRB640_M2000")
dblBottlesYcord1 = bottles1.Transform.y
dblBottlesYcord2 = bottles2.Transform.y
dblBottlesYcord3 = attachBottles.Transform.y
'DoEvents
dblBottlesYcord1 = dblBottlesYcord1 - 0.05
bottles1.Transform.y = dblBottlesYcord1
If bottles2.Transform.y > 1.36 Then
dblBottlesYcord2 = dblBottlesYcord2 - 0.05
bottles2.Transform.y = dblBottlesYcord2
Else
bottles2.Transform.y = 1.36
End If
If attachBottles.Transform.y > 2.325 Then
dblBottlesYcord3 = dblBottlesYcord3 - 0.05
attachBottles.Transform.y = dblBottlesYcord3
Else
attachBottles.Transform.y = 2.325
End If
ActiveStation.Refresh
If bottles1.Transform.y < 0.05 Then
bottles1.Transform.y = 0
ActiveStation.Refresh
ThisStation.waitTime1.Enabled = False
VC.IOs.Item("doBottleFeed").Value = 0
VC.IOs.Item("doCCfull").Value = 1
End If
End Sub Martin37965,3598611111
/Martin Lundh
Product manager
ABB Robotics
Product manager
ABB Robotics
0
Comments
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings