IF ELSE & Smart Component
Armbross
✭
in RobotStudio
Hello, I want to use an if else statement in my Rapid for sch project,
IF cablecollision=1 THEN SetDO PickCable,1; MoveL outUsbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea; PulseDO PowSync; WaitTime 1; MoveL LiftusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea; WaitTime 1; MoveL PickusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea; SetDO PickCable,0; PulseDO ResetPow; WaitTime 1; MoveL PressusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea; SetDO jerkoffB,1; WaitTime 1; PulseDO gripperopen; SetDO jerkoffB,0; WaitTime 2; MoveL LiftusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea; SetDO Failure,1; ELSEIF rj45collision=1 THEN dthRJ45; SetDO PickCable,1; MoveL outUsbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea; PulseDO PowSync; WaitTime 1; MoveL LiftusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea; WaitTime 1; MoveL PickusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea; SetDO PickCable,0; PulseDO ResetPow; WaitTime 1; MoveL PressusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea; SetDO jerkoffB,1; WaitTime 1; PulseDO gripperopen; SetDO jerkoffB,0; WaitTime 2; MoveL LiftusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea; SetDO Failure,1; ELSE RJ45; dthRJ45; dthusbB; ENDIF
I'm trying to get the simulation to run the part where cablecollision=1 or rj45collision=1. But have been unable to change the value.
The two signals would also run posemover I made in smart component using collision sensor and latching. https://gofile.io/d/Kt7vIU (Thnks for help in adv)
0
Comments
-
For testing purposes if these are num variables you can set them to 1 in the code before the IF statement as below:
cablecollision:=1;
0 -
they are digital inputs signals0
-
Either use the inputs/Outputs button on the controller tab to display all I/O and change its value there.
Or you can create a cross connection from a virtual output signal (have to create this first) to the input signal, then you can set the output signal in the code.0 -
I connected each of those to output signals here: https://gofile.io/d/Kt7vIU but still doesn't change?0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 798 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings