How do I adjust velocity with program data during program execution?
nezzreth
✭
in RobotStudio
How I tried to accomplish this:
PERS num vSpraySpeed:=500;
PERS speeddata vSpray_Fast:=[vSpraySpeed,500,5000,1000];
MoveL Spray_pos10, vSpray_Fast, fine, t_spray;
But, this doesn't work.
Is there another way to accomplish this?
Tagged:
0
Best Answer
-
MODULE aModule(SYSMODULE)
PERS speeddata vSpray_Fast;
PERS num vSpraySpeed:=500;
PROC aProcedure()
vSpray_Fast:=[vSpraySpeed,500,5000,1000];
MoveL Spray_pos10, vSpray_Fast, fine, t_spray;
ENDPROC
ENDMODULE
5
Answers
-
It works perfectly! Thank you so much!0
-
In case you would like to reduce speed globally (via percentage override) you can use "SpeedRefresh" instruction... Like this:
----------------------------------------------------------<i>VAR intnum time_int;</i><br><i> </i><p><i>VAR num override;</i></p><i> </i><p><i>...</i></p><i> </i><p><i>PROC main()</i></p><i> </i><div><i> </i><p><i>CONNECT time_int WITH speed_refresh;</i></p><i> </i><p><i>ITimer 0.1, time_int;</i></p><i> </i><p><i>ISleep time_int;</i></p><i> </i><p><i>...</i></p><i> </i><p><i>MoveL p1, v100, fine, tool2;</i></p><i> </i><p><i>! Read current speed override set from FlexPendant</i></p><i> </i><p><i>override := CSpeedOverride (\CTask);</i></p><i> </i><p><i>IWatch time_int;</i></p><i> </i><p><i>MoveL p2, v100, fine, tool2;</i></p><i> </i><p><i>IDelete time_int;</i></p><i> </i><p><i>! Reset to FlexPendant old speed override</i></p><i> </i><p><i>WaitTime 0.5;</i></p><i> </i><p><i>SpeedRefresh override;</i></p><i> </i><p><i>...</i></p></div><i> </i><p><i>TRAP speed_refresh</i></p><i> </i><div><i> </i><p><i>VAR speed_corr;</i></p></div><i> </i><div><i> </i><p><i>! Analog input signal value from sensor, value 0 ... 10</i></p><i> </i><p><i>speed_corr := (ai_sensor * 10);</i></p></div><i> </i><div><i> </i><p><i>SpeedRefresh speed_corr;</i></p><i> </i><p><i>ERROR</i></p><i> </i><div><i> </i><p><i>IF ERRNO = ERR_SPEED_REFRESH_LIM THEN</i></p><i> </i><div><i> </i><p><i>IF speed_corr > 100 speed_corr := 100;</i></p><i> </i><p><i>IF speed_corr < 0 speed_corr := 0;</i></p><i> </i><p><i>RETRY;</i></p></div><i> </i><p><i>ENDIF</i></p></div></div><i> </i><p><i>ENDTRAP</i></p>
----------------------------------------------------------
For speed reducing to the exact value there is probably the best way using LimitSpeed SYS_DI and TRAP routine with SpeedLimCheckPoint instruction. Like this:
----------------------------------------------------------VAR num limit_speed:=200;
SpeedLimCheckPoint limit_speed;
This will limit the speed to 200 mm/s for the TCP robot when system input LimitSpeed is set to 1.
----------------------------------------------------------
BR
0 -
In case you would like to reduce speed globally (via percentage override) you can use "SpeedRefresh" instruction... Like this:
----------------------------------------------------------<i>VAR intnum time_int;</i><br><i> </i><p><i>VAR num override;</i></p><i> </i><p><i>...</i></p><i> </i><p><i>PROC main()</i></p><i> </i><div><i> </i><p><i>CONNECT time_int WITH speed_refresh;</i></p><i> </i><p><i>ITimer 0.1, time_int;</i></p><i> </i><p><i>ISleep time_int;</i></p><i> </i><p><i>...</i></p><i> </i><p><i>MoveL p1, v100, fine, tool2;</i></p><i> </i><p><i>! Read current speed override set from FlexPendant</i></p><i> </i><p><i>override := CSpeedOverride (\CTask);</i></p><i> </i><p><i>IWatch time_int;</i></p><i> </i><p><i>MoveL p2, v100, fine, tool2;</i></p><i> </i><p><i>IDelete time_int;</i></p><i> </i><p><i>! Reset to FlexPendant old speed override</i></p><i> </i><p><i>WaitTime 0.5;</i></p><i> </i><p><i>SpeedRefresh override;</i></p><i> </i><p><i>...</i></p></div><i> </i><p><i>TRAP speed_refresh</i></p><i> </i><div><i> </i><p><i>VAR speed_corr;</i></p></div><i> </i><div><i> </i><p><i>! Analog input signal value from sensor, value 0 ... 10</i></p><i> </i><p><i>speed_corr := (ai_sensor * 10);</i></p></div><i> </i><div><i> </i><p><i>SpeedRefresh speed_corr;</i></p><i> </i><p><i>ERROR</i></p><i> </i><div><i> </i><p><i>IF ERRNO = ERR_SPEED_REFRESH_LIM THEN</i></p><i> </i><div><i> </i><p><i>IF speed_corr > 100 speed_corr := 100;</i></p><i> </i><p><i>IF speed_corr < 0 speed_corr := 0;</i></p><i> </i><p><i>RETRY;</i></p></div><i> </i><p><i>ENDIF</i></p></div></div><i> </i><p><i>ENDTRAP</i></p>
----------------------------------------------------------
For speed reducing to the exact value there is probably the best way using LimitSpeed SYS_DI and TRAP routine with SpeedLimCheckPoint instruction. Like this:
----------------------------------------------------------VAR num limit_speed:=200;
SpeedLimCheckPoint limit_speed;
This will limit the speed to 200 mm/s for the TCP robot when system input LimitSpeed is set to 1.
----------------------------------------------------------
BR
0
Categories
- All Categories
- 5.5K RobotStudio
- 390 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 304 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 3 RobotStudio AR Viewer
- 772 RAPID Programming
- 17 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings