Forum Migration Notice
We're transitioning to a more modern community platform by the end of this year. Learn about the upcoming changes and what to expect.
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;
ENDIFI'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.6K RobotStudio
- 401 UpFeed
- 21 Tutorials
- 15 RobotApps
- 306 PowerPacs
- 407 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.9K Robot Controller
- 364 IRC5
- 83 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 854 RAPID Programming
- 37 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 110 Collaborative Robots
- 5 Job listings