├── .gitignore ├── API.md ├── LICENSE ├── README.md ├── examples ├── webjoystick.htm ├── webpanel.htm ├── webpanel430ia.htm └── webtouchpad.htm ├── karel ├── webabort.kl ├── webcheck.kl ├── webcontrol.kl ├── webkeep.kl ├── weblimit.kl ├── webmonitor.kl ├── webprogram.kl ├── webreset.kl ├── webstart.kl └── webstop.kl ├── preview.png ├── preview2.png ├── register.md └── tpe └── webmotion.ls /.gitignore: -------------------------------------------------------------------------------- 1 | *.tp 2 | *.pc 3 | -------------------------------------------------------------------------------- /API.md: -------------------------------------------------------------------------------- 1 | # fanuc-webcontrol API 2 | ____ 3 | 4 | ## Send coordinates to the robot 5 | 6 | * **URL** 7 | 8 | `/KAREL/webcontrol?str_mtn_mod=${mtn_mod}&str_coord1=${coord1}&str_coord2=${coord2}&str_coord3=${coord3}&str_coord4=${coord4}&str_coord5=${coord5}&str_coord6=${coord6}` 9 | 10 | * **Method:** 11 | 12 | `GET` 13 | 14 | * **URL Params** 15 | 16 | **Required:** 17 | 18 | `mtn_mod=[INTEGER]` 19 | 20 | `coord1=[REAL]` 21 | 22 | `coord2=[REAL]` 23 | 24 | `coord3=[REAL]` 25 | 26 | `coord4=[REAL]` 27 | 28 | `coord5=[REAL]` 29 | 30 | `coord6=[REAL]` 31 | 32 | * **Data Params** 33 | 34 | mtn_mod value is valid from `1` to `6`: 35 | 36 | `1`: Absolute motion in joint space with joint interpolation 37 | 38 | `2`: Relative motion in joint space with joint interpolation 39 | 40 | `3`: Absolute motion in Chartesian space with linear interpolation 41 | 42 | `4`: Absolute motion in Chartesian space with joint interpolation 43 | 44 | `5`: Relative motion in Chartesian space with linear interpolation 45 | 46 | `6`: Relative motion in Chartesian space with joint interpolation 47 | 48 | * **Success Response:** 49 | 50 | * Code: 204 51 | 52 | ## Get data from the controller 53 | 54 | * **URL** 55 | 56 | `/KAREL/webmonitor` 57 | 58 | * **Method:** 59 | 60 | `GET` 61 | 62 | * **Success Response:** 63 | 64 | * JSON object: 65 | 66 | { 67 | 68 | "robotid": [ "id " ], 69 | 70 | "joint": [ J1, J2, J3, J4, J5, J6 ], 71 | 72 | "pose": [ X, Y, Z, W, P, R ], 73 | 74 | "limit": [ xMax, yMax, zMax, xMin, yMin, zMin, j1Max, j2Max, j3Max, j4Max, j5Max, j6Max, j1Min, j2Min, j3Min, j4Min, j5Min, j6Min ] , 75 | 76 | "status": [ 0, 1 ] , 77 | 78 | "message": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], 79 | 80 | "timestamp": ["time " ], 81 | 82 | "error": [ 0,"R E S E T " ] 83 | 84 | } 85 | 86 | **id**: [ Get the robot controller ID from `$FNO` `[STRING]` ] 87 | 88 | `J1, J2, J3, J4, J5, J6=[REAL]` 89 | 90 | `X, Y, Z, W, P, R=[REAL]` 91 | 92 | `xMax, yMax, zMax, xMin, yMin, zMin=[REAL]` 93 | 94 | **status**: [ a task running (true(`1`)/false(`0`)) `[INTEGER]`, webmotion running (true(`1`)/false(`0`)) `[INTEGER]`] 95 | 96 | **message**: [ position reachable or not (true(`1`)/false(`0`)) `[INTEGER]`, x limit stop (max(`3`)/min(`6`)) `[INTEGER]`, y limit stop (max(`3`)/min(`6`)) `[INTEGER]`, z limit stop (max(`3`)/min(`6`)) `[INTEGER]`, j1 limit stop (max(`3`)/min(`6`)) `[INTEGER]`, j2 limit stop (max(`3`)/min(`6`)) `[INTEGER]`, j3 limit stop (max(`3`)/min(`6`)) `[INTEGER]`, j4 limit stop (max(`3`)/min(`6`)) `[INTEGER]`, j5 limit stop (max(`3`)/min(`6`)) `[INTEGER]`, j6 limit stop (max(`3`)/min(`6`)) `[INTEGER]` ] 97 | 98 | **timestamp**: [ The current time from within the KAREL system `[STRING]` ] 99 | 100 | **error**: [ error code `[INTEGER]`, error string `[STRING]` ] 101 | 102 | ## Set the motion limits 103 | 104 | * **URL** 105 | 106 | `/KAREL/weblimit?str_limit_id=${limit_id}&str_limit_vl=${limit_vl}` 107 | 108 | * **Method:** 109 | 110 | `GET` 111 | 112 | * **URL Params** 113 | 114 | **Required:** 115 | 116 | `limit_id=[INTEGER]` 117 | 118 | `limit_vl=[REAL]` 119 | 120 | * **Data Params** 121 | 122 | `limit_id` is valid from `1` to `6`, `11` to `16` and `21` to `26` : 123 | 124 | `1`: x max, 125 | 126 | `2`: y max, 127 | 128 | `3`: z max, 129 | 130 | `4`: x min, 131 | 132 | `5`: y min, 133 | 134 | `6`: z min, 135 | 136 | `11`: j1 max, 137 | 138 | `12`: j2 max, 139 | 140 | `13`: j3 max, 141 | 142 | `14`: j4 max, 143 | 144 | `15`: j5 max, 145 | 146 | `16`: j6 max, 147 | 148 | `21`: j1 min, 149 | 150 | `22`: j2 min, 151 | 152 | `23`: j3 min, 153 | 154 | `24`: j4 min, 155 | 156 | `25`: j5 min, 157 | 158 | `26`: j6 min, 159 | 160 | * **Success Response:** 161 | 162 | * Code: 204 163 | 164 | ## Run a KAREL program on the controller 165 | 166 | * **URL** 167 | 168 | `/KAREL/karel_program_name` 169 | 170 | * **Method:** 171 | 172 | `GET` 173 | 174 | * **URL Params** 175 | 176 | Default KAREL programs: 177 | 178 | `webabort`: 179 | * Abort all task to run on the controller (except the tasks that have the `ignore abort request` attribute set), 180 | * Set the current positions in PR[40] (joint) and PR[41] (Chartesian), 181 | * Set flags OFF from 1 to 8, 182 | * Set the R[42] (safety motion register) to 999, 183 | * Clear webmonitor KAREL program from the memory 184 | 185 | `webcheck`: 186 | * Check the position is reachable 187 | * Check the position is in the limits 188 | * Check the safety motion register value 189 | 190 | `webcontrol`: 191 | * Set the required position to the proper position register 192 | * Set the proper motion mode flag ON 193 | 194 | `webkeep` 195 | * Reset the safety motion register value 196 | 197 | `weblimit` 198 | * Set the XYZ limits 199 | 200 | `webmonitor` 201 | * Get current coordinates (joint and Chartesian), limit, status, message and error 202 | 203 | `webprogram` 204 | * Get the program list from the controller 205 | 206 | `webreset` 207 | * Reset the robot controller and abort all task on the controller (except the tasks that have the `ignore abort request` attribute set) 208 | 209 | `webstart` 210 | * Run the specified task 211 | 212 | `webstop` 213 | * Stop the webmotion program 214 | 215 | * **Success Response:** 216 | 217 | * Code: 204 218 | 219 | ## Run a TP program on the controller 220 | 221 | * **URL** 222 | 223 | `/KAREL/webstart?str_task=${task}` 224 | 225 | * **Method:** 226 | 227 | `GET` 228 | 229 | * **URL Params** 230 | 231 | **Required:** 232 | 233 | `task=[STRING]` 234 | 235 | * **Data Params** 236 | 237 | The `task` is the TP program name. The default TP program: 238 | 239 | `webmotion` 240 | 241 | * **Success Response:** 242 | 243 | * Code: 204 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Antal Bejczy Center for Intelligent Robotics 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fanuc-webcontrol 2 | 3 | ## Overview 4 | Simple software to control FANUC six degree of freedom robotic arms through a web browser. 5 | This version is used to robot controller software 7.30x or above. 6 | If the robot controller version is 7.20x then use the [FANUC WEBCONTROL LEGACY](https://github.com/ABC-iRobotics/fanuc-webcontrol-legacy) version 7 | 8 | ![Image of fanuc-webcontrol](preview.png) 9 | 10 | **NOTE**: It is an experimental software. Do not use this in production systems! 11 | 12 | THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY. IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 13 | 14 | ## TOC 15 | 1. [Requirements](#requirements) 16 | 2. [Installation](#installation) 17 | 3. [Configuration](#configuration) 18 | 4. [Example usage](#example-usage) 19 | 5. [Notes](#notes) 20 | 6. [Acknowledgement](#acknowledgement) 21 | 7. [Bugs, feature requests, etc](#bugs-feature-requests-etc) 22 | 23 | ## Requirements 24 | This is written in FANUC KAREL language, TP code and JavaScript. It is tested on a FANUC M-430iA2P robot with R-J3iC controller v7.40 25 | 26 | The following registers [R], position registers[PR] and FLAGs are used: 27 | - [R]: [See Register page](register.md), 28 | - [PR]: 40, 41, 29 | - FLAG: 1 - 8, 30 | 31 | If these (position) registers and/or flags are not free, than you can choose anothers, but you have to update these numbers in the karel programs and the `webmotion.tp` file. 32 | 33 | Internet connection is also required because the Bootstrap, PEP and JQuery libraries are loaded from CDNs. 34 | 35 | ## Installation 36 | 37 | 1. Build the `*.kl` files in the `karel` folder with Roboguide and copy them to the robot `MD:` folder 38 | 2. Copy the `*.htm` file from the `examples` folder to the robot `MD:` folder 39 | 3. Copy the `webmotion.ls` file from the `tpe` folder to the robot `MD:` folder 40 | 41 | ## Configuration 42 | Set UNLOCK to HTTP authentication of KAREL: 43 | 1. On the Teach Pendant select `Menu -> Setup -> Host Comm` 44 | 2. Set the cursor on `HTTP` 45 | 3. Push `F3[DETAIL]` 46 | 4. Set the cursor on `A` left side of KAREL. Select `F3[UNLOCK]` 47 | 48 | ## Example usage 49 | 50 | Run the WEBMOTION TP program on the controller or open a browser and type: http://robotIP/md/webpanel.htm and click on the `Start` button (`Reset` may be needed before it) 51 | - SET: 52 | * Set the axis limits. The default values are 0, thus you have to change these to make possible any movement. 53 | * Move the TCP to a predefined position (Click on a button, and wait until the robot completes the movement.) **Important: SEE NOTE No.2** 54 | - JOG: Jogging the robot (Push and hold down a button, but only use just one at the same time!) 55 | - CART: Move the TCP +/-xyz direction and/or rotate it in the currently selected tool coordinate system. (Push and hold down a button, but only use just one at the same time!) 56 | - Webjoystick: http://robotIP/md/webjoystick.htm 57 | - Webtouchpad: http://robotIP/md/webtouchpad.htm 58 | 59 | ## Notes 60 | 1. You can change the default steps (1 degree, 3 mm) in the JavaScript part of the `webpanel.htm`. In this case you may also have to update the `setInt` variable in this file. 61 | 2. The predefined positions are zero. However there is example for FANUC M-430iA2P. If you have an other type of FANUC robot, you should change these positions' coordinates. 62 | 3. The PR[40] and PR[41] contain the movements coordinates. In these the UF:F and UT:F. This means that the coordinate system of the tool coordinate system number currently selected is used. 63 | 64 | ## API 65 | [See API page](API.md) 66 | 67 | ## Acknowledgement 68 | We acknowledge the financial support of this work by the Hungarian State and the European Union under the EFOP-3.6.1-16-2016-00010 project. 69 | 70 | ## Bugs, feature requests, etc 71 | Please use the [GitHub issue tracker][]. 72 | 73 | [GitHub issue tracker]: https://github.com/ABC-iRobotics/fanuc-webcontrol/issues -------------------------------------------------------------------------------- /examples/webjoystick.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | WEBJOYSTICK 4 | 5 | 6 | 7 | 8 | 9 | 36 | 37 | 38 | 39 |
40 |
41 | 42 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /examples/webpanel.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WEBPANEL 5 | 6 | 7 | 8 | 9 | 10 | 11 | 49 | 50 | 51 | 52 |
53 |
54 |
55 |
56 |

load...

57 |
58 |
59 |

load...

60 |
61 |
62 |
63 |
64 |

load...

65 |
66 |
67 |
68 | 69 |
70 |
71 |
72 |
73 |

load...

74 |
75 |
76 |

load...

77 |
78 |
79 |

load...

80 |
81 |
82 |
83 |
84 |

load...

85 |
86 |
87 |

load...

88 |
89 |
90 |

load...

91 |
92 |
93 |
94 | 95 |
96 |
97 |
98 |

load...

99 |
100 |
101 |

load...

102 |
103 |
104 |

load...

105 |
106 |
107 |
108 |
109 |

load...

110 |
111 |
112 |

load...

113 |
114 |
115 |

load...

116 |
117 |
118 |
119 | 120 |
121 |
122 |
123 |
124 | 125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 | 133 |
134 |
135 | 136 |
137 |
138 | 139 |
140 |
141 |
142 |
143 | 144 |
145 |
146 |
147 |
148 | 149 |
150 |
151 | 152 |
153 |
154 |
155 |
156 | 157 |
158 |
159 |
160 | 161 |
162 |
163 | 164 |
165 |
166 | 167 |
168 |
169 |
170 |
171 |
172 | 173 |
174 |
175 |
176 | 177 |
178 |
179 |

load...

180 |
181 |
182 | 183 |
184 |
185 |
186 |
187 | 188 |
189 |
190 |

load...

191 |
192 |
193 | 194 |
195 |
196 |
197 |
198 | 199 |
200 |
201 |

load...

202 |
203 |
204 | 205 |
206 |
207 |
208 |
209 | 210 |
211 |
212 |

load...

213 |
214 |
215 | 216 |
217 |
218 |
219 |
220 | 221 |
222 |
223 |

load...

224 |
225 |
226 | 227 |
228 |
229 |
230 |
231 | 232 |
233 |
234 |

load...

235 |
236 |
237 | 238 |
239 |
240 |
241 | 242 |
243 |
244 |
245 | 246 |
247 |
248 |

load...

249 |
250 |
251 | 252 |
253 |
254 |
255 |
256 | 257 |
258 |
259 |

load...

260 |
261 |
262 | 263 |
264 |
265 |
266 |
267 | 268 |
269 |
270 |

load...

271 |
272 |
273 | 274 |
275 |
276 |
277 |
278 | 279 |
280 |
281 |

load...

282 |
283 |
284 | 285 |
286 |
287 |
288 |
289 | 290 |
291 |
292 |

load...

293 |
294 |
295 | 296 |
297 |
298 |
299 |
300 | 301 |
302 |
303 |

load...

304 |
305 |
306 | 307 |
308 |
309 |
310 | 311 |
312 |
313 |
314 |

load...

315 |
316 |
317 | 318 |
319 |
320 |

load...

321 |
322 |
323 |
324 |
325 |

load...

326 |
327 |
328 | 329 |
330 |
331 |

load...

332 |
333 |
334 |
335 |
336 |

load...

337 |
338 |
339 | 340 |
341 |
342 |

load...

343 |
344 |
345 |
346 |
347 |

load...

348 |
349 |
350 | 351 |
352 |
353 |

load...

354 |
355 |
356 |
357 |
358 |

load...

359 |
360 |
361 | 362 |
363 |
364 |

load...

365 |
366 |
367 |
368 |
369 |

load...

370 |
371 |
372 | 373 |
374 |
375 |

load...

376 |
377 |
378 |
379 | 380 |
381 |
382 |
383 |

Load...

384 |
385 |
386 |

Load...

387 |
388 |
389 |

Load...

390 |
391 |
392 |
393 |
394 | 395 |
396 |
397 | 398 |
399 |
400 | 401 |
402 |
403 |
404 |
405 |

Load...

406 |
407 |
408 |

Load...

409 |
410 |
411 |

Load...

412 |
413 |
414 |
415 |
416 | 417 |
418 |
419 | 420 |
421 |
422 | 423 |
424 |
425 |
426 |
427 |

Load...

428 |
429 |
430 |

Load...

431 |
432 |
433 |

Load...

434 |
435 |
436 |
437 |
438 | 439 |
440 |
441 | 442 |
443 |
444 | 445 |
446 |
447 |
448 |
449 |

Load...

450 |
451 |
452 |

Load...

453 |
454 |
455 |

Load...

456 |
457 |
458 |
459 |
460 | 461 |
462 |
463 | 464 |
465 |
466 | 467 |
468 |
469 |
470 |
471 |

Load...

472 |
473 |
474 |

Load...

475 |
476 |
477 |

Load...

478 |
479 |
480 |
481 |
482 | 483 |
484 |
485 | 486 |
487 |
488 | 489 |
490 |
491 |
492 |
493 |

Load...

494 |
495 |
496 |

Load...

497 |
498 |
499 |

Load...

500 |
501 |
502 |
503 |
504 | 505 |
506 |
507 | 508 |
509 |
510 | 511 |
512 |
513 |
514 |
515 |
516 | 517 |
518 |
519 |
520 |
521 | 522 |
523 |
524 |
525 |
526 | 527 |
528 |
529 | 530 |
531 |
532 | 533 |
534 |
535 |
536 |
537 | 538 | 541 | 542 | 543 | 544 | 564 | 565 | 585 | 586 | 606 | 607 | 627 | 628 | 648 | 649 | 669 | 670 | 690 | 691 | 711 | 712 | 732 | 733 | 753 | 754 | 774 | 775 | 795 | 796 | 816 | 817 | 837 | 838 | 858 | 859 | 879 | 880 | 900 | 901 | 921 | 922 | 2584 | 2585 | 2586 | -------------------------------------------------------------------------------- /examples/webtouchpad.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | WEBTOUCHPAD 4 | 5 | 6 | 7 | 8 | 9 | 36 | 37 | 38 | 39 |
40 |
41 | 42 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /karel/webabort.kl: -------------------------------------------------------------------------------- 1 | PROGRAM webabort 2 | %COMMENT = 'v3' 3 | %NOLOCKGROUP 4 | %NOPAUSE=ERROR+COMMAND+TPENABLE 5 | %NOBUSYLAMP 6 | 7 | CONST 8 | 9 | PR_WEBJOINTS = 40 10 | PR_WEBXYZWPR = 41 11 | 12 | R_WEBKEEP = 42 13 | 14 | VAR 15 | 16 | STATUS: INTEGER 17 | return_code: INTEGER 18 | 19 | cur_jpos: JOINTPOS 20 | cur_pos: XYZWPR 21 | 22 | BEGIN 23 | 24 | WRITE (CHR(128),CHR(137)) 25 | 26 | ABORT_TASK('*ALL*', TRUE, TRUE, STATUS) 27 | 28 | IF (STATUS <> 0 ) THEN 29 | WRITE ('ABORT_TASK built-IN failed WITH STATUS = ', STATUS, CR) 30 | ENDIF 31 | 32 | cur_jpos = CURJPOS(0,0) 33 | cur_pos = CURPOS(0,0) 34 | 35 | SET_JPOS_REG(PR_WEBJOINTS, cur_jpos, STATUS) 36 | 37 | IF (STATUS <> 0 ) THEN 38 | WRITE ('SET_JPOS_REG built-IN failed in ABORT task WITH STATUS = ', STATUS, CR) 39 | ENDIF 40 | 41 | SET_POS_REG(PR_WEBXYZWPR, cur_pos, STATUS) 42 | 43 | IF (STATUS <> 0 ) THEN 44 | WRITE ('SET_POS_REG built-IN failed in ABORT task WITH STATUS = ', STATUS, CR) 45 | ENDIF 46 | 47 | FLG[1] = OFF 48 | FLG[2] = OFF 49 | FLG[3] = OFF 50 | FLG[4] = OFF 51 | FLG[5] = OFF 52 | FLG[6] = OFF 53 | FLG[7] = OFF 54 | FLG[8] = OFF 55 | 56 | SET_REAL_REG(R_WEBKEEP, 999, STATUS) 57 | 58 | IF (STATUS <> 0 ) THEN 59 | WRITE ('SET_REL_REG built-IN 3 failed: ', STATUS, CR) 60 | ENDIF 61 | 62 | CLEAR('webmonitor.pc', STATUS) 63 | 64 | IF (STATUS <> 0 ) THEN 65 | WRITE ('CLEAR built-IN failed: ', STATUS, CR) 66 | ENDIF 67 | 68 | return_code = 204 69 | 70 | END webabort 71 | -------------------------------------------------------------------------------- /karel/webcheck.kl: -------------------------------------------------------------------------------- 1 | PROGRAM webcheck 2 | %COMMENT = 'v4' 3 | %NOLOCKGROUP 4 | %NOPAUSE=ERROR+COMMAND+TPENABLE 5 | %NOBUSYLAMP 6 | 7 | CONST 8 | 9 | PR_WEBJOINTS = 40 10 | PR_WEBXYZWPR = 41 11 | 12 | R_WEBKEEP = 42 13 | 14 | R_WEBXMAX = 43 15 | R_WEBYMAX = 44 16 | R_WEBZMAX = 45 17 | 18 | R_WEBXMIN = 46 19 | R_WEBYMIN = 47 20 | R_WEBZMIN = 48 21 | 22 | R_WEBCOORD1 = 51 23 | R_WEBCOORD2 = 52 24 | R_WEBCOORD3 = 53 25 | R_WEBCOORD4 = 54 26 | R_WEBCOORD5 = 55 27 | R_WEBCOORD6 = 56 28 | 29 | R_WEBJ1MAX = 61 30 | R_WEBJ2MAX = 62 31 | R_WEBJ3MAX = 63 32 | R_WEBJ4MAX = 64 33 | R_WEBJ5MAX = 65 34 | R_WEBJ6MAX = 66 35 | 36 | R_WEBJ1MIN = 71 37 | R_WEBJ2MIN = 72 38 | R_WEBJ3MIN = 73 39 | R_WEBJ4MIN = 74 40 | R_WEBJ5MIN = 75 41 | R_WEBJ6MIN = 76 42 | 43 | VAR 44 | 45 | STATUS: INTEGER 46 | 47 | cur_jpos: JOINTPOS 48 | cur_pos: XYZWPR 49 | 50 | new_jpos: JOINTPOS 51 | new_pos: XYZWPREXT 52 | 53 | val_new_jpos: ARRAY[6] OF REAL 54 | 55 | reach_ab: INTEGER 56 | 57 | limit_x: INTEGER 58 | limit_y: INTEGER 59 | limit_z: INTEGER 60 | 61 | limit_j1: INTEGER 62 | limit_j2: INTEGER 63 | limit_j3: INTEGER 64 | limit_j4: INTEGER 65 | limit_j5: INTEGER 66 | limit_j6: INTEGER 67 | 68 | config_ref: INTEGER 69 | out_pos: POSITION 70 | wjnt_cfg: CONFIG 71 | ext_ang: ARRAY[3] OF REAL 72 | 73 | keep_flag: BOOLEAN 74 | 75 | keep_int: INTEGER 76 | 77 | keep_real: REAL 78 | 79 | xmax_flag: BOOLEAN 80 | ymax_flag: BOOLEAN 81 | zmax_flag: BOOLEAN 82 | 83 | xmin_flag: BOOLEAN 84 | ymin_flag: BOOLEAN 85 | zmin_flag: BOOLEAN 86 | 87 | j1max_flag: BOOLEAN 88 | j2max_flag: BOOLEAN 89 | j3max_flag: BOOLEAN 90 | j4max_flag: BOOLEAN 91 | j5max_flag: BOOLEAN 92 | j6max_flag: BOOLEAN 93 | 94 | j1min_flag: BOOLEAN 95 | j2min_flag: BOOLEAN 96 | j3min_flag: BOOLEAN 97 | j4min_flag: BOOLEAN 98 | j5min_flag: BOOLEAN 99 | j6min_flag: BOOLEAN 100 | 101 | xmax_int: INTEGER 102 | ymax_int: INTEGER 103 | zmax_int: INTEGER 104 | 105 | xmin_int: INTEGER 106 | ymin_int: INTEGER 107 | zmin_int: INTEGER 108 | 109 | j1max_int: INTEGER 110 | j2max_int: INTEGER 111 | j3max_int: INTEGER 112 | j4max_int: INTEGER 113 | j5max_int: INTEGER 114 | j6max_int: INTEGER 115 | 116 | j1min_int: INTEGER 117 | j2min_int: INTEGER 118 | j3min_int: INTEGER 119 | j4min_int: INTEGER 120 | j5min_int: INTEGER 121 | j6min_int: INTEGER 122 | 123 | xmax_real: REAL 124 | ymax_real: REAL 125 | zmax_real: REAL 126 | 127 | xmin_real: REAL 128 | ymin_real: REAL 129 | zmin_real: REAL 130 | 131 | j1max_real: REAL 132 | j2max_real: REAL 133 | j3max_real: REAL 134 | j4max_real: REAL 135 | j5max_real: REAL 136 | j6max_real: REAL 137 | 138 | j1min_real: REAL 139 | j2min_real: REAL 140 | j3min_real: REAL 141 | j4min_real: REAL 142 | j5min_real: REAL 143 | j6min_real: REAL 144 | 145 | ROUTINE checkLimit 146 | 147 | BEGIN 148 | 149 | --limit the XYZ direction 150 | 151 | IF xmin_flag THEN 152 | IF new_pos.x <= xmin_real THEN 153 | FLG[8] = ON 154 | limit_x = 6 155 | ENDIF 156 | ELSE 157 | IF new_pos.x <= xmin_int THEN 158 | FLG[8] = ON 159 | limit_x = 6 160 | ENDIF 161 | ENDIF 162 | 163 | IF xmax_flag THEN 164 | IF new_pos.x >= xmax_real THEN 165 | FLG[8] = ON 166 | limit_x = 3 167 | ENDIF 168 | ELSE 169 | IF new_pos.x >= xmax_int THEN 170 | FLG[8] = ON 171 | limit_x = 3 172 | ENDIF 173 | ENDIF 174 | 175 | IF ymin_flag THEN 176 | IF new_pos.y <= ymin_real THEN 177 | FLG[8] = ON 178 | limit_y = 6 179 | ENDIF 180 | ELSE 181 | IF new_pos.y <= ymin_int THEN 182 | FLG[8] = ON 183 | limit_y = 6 184 | ENDIF 185 | ENDIF 186 | 187 | IF ymax_flag THEN 188 | IF new_pos.y >= ymax_real THEN 189 | FLG[8] = ON 190 | limit_y = 3 191 | ENDIF 192 | ELSE 193 | IF new_pos.y >= ymax_int THEN 194 | FLG[8] = ON 195 | limit_y = 3 196 | ENDIF 197 | ENDIF 198 | 199 | IF zmin_flag THEN 200 | IF new_pos.z <= zmin_real THEN 201 | FLG[8] = ON 202 | limit_z = 6 203 | ENDIF 204 | ELSE 205 | IF new_pos.z <= zmin_int THEN 206 | FLG[8] = ON 207 | limit_z = 6 208 | ENDIF 209 | ENDIF 210 | 211 | IF zmax_flag THEN 212 | IF new_pos.z >= zmax_real THEN 213 | FLG[8] = ON 214 | limit_z = 3 215 | ENDIF 216 | ELSE 217 | IF new_pos.z >= zmax_int THEN 218 | FLG[8] = ON 219 | limit_z = 3 220 | ENDIF 221 | ENDIF 222 | 223 | --limit the joints 224 | 225 | IF UNINIT( val_new_jpos[1] ) THEN 226 | val_new_jpos[1] = 0 227 | ELSE 228 | IF j1min_flag THEN 229 | IF val_new_jpos[1] <= j1min_real THEN 230 | FLG[8] = ON 231 | limit_j1 = 6 232 | ENDIF 233 | ELSE 234 | IF val_new_jpos[1] <= j1min_int THEN 235 | FLG[8] = ON 236 | limit_j1 = 6 237 | ENDIF 238 | ENDIF 239 | IF j1max_flag THEN 240 | IF val_new_jpos[1] >= j1max_real THEN 241 | FLG[8] = ON 242 | limit_j1 = 3 243 | ENDIF 244 | ELSE 245 | IF val_new_jpos[1] >= j1max_int THEN 246 | FLG[8] = ON 247 | limit_j1 = 3 248 | ENDIF 249 | ENDIF 250 | ENDIF 251 | 252 | IF UNINIT( val_new_jpos[2] ) THEN 253 | val_new_jpos[2] = 0 254 | ELSE 255 | IF j2min_flag THEN 256 | IF val_new_jpos[2] <= j2min_real THEN 257 | FLG[8] = ON 258 | limit_j2 = 6 259 | ENDIF 260 | ELSE 261 | IF val_new_jpos[2] <= j2min_int THEN 262 | FLG[8] = ON 263 | limit_j2 = 6 264 | ENDIF 265 | ENDIF 266 | IF j2max_flag THEN 267 | IF val_new_jpos[2] >= j2max_real THEN 268 | FLG[8] = ON 269 | limit_j2 = 3 270 | ENDIF 271 | ELSE 272 | IF val_new_jpos[2] >= j2max_int THEN 273 | FLG[8] = ON 274 | limit_j2 = 3 275 | ENDIF 276 | ENDIF 277 | ENDIF 278 | 279 | IF UNINIT( val_new_jpos[3] ) THEN 280 | val_new_jpos[3] = 0 281 | ELSE 282 | IF j3min_flag THEN 283 | IF val_new_jpos[3] <= j3min_real THEN 284 | FLG[8] = ON 285 | limit_j3 = 6 286 | ENDIF 287 | ELSE 288 | IF val_new_jpos[3] <= j3min_int THEN 289 | FLG[8] = ON 290 | limit_j3 = 6 291 | ENDIF 292 | ENDIF 293 | IF j3max_flag THEN 294 | IF val_new_jpos[3] >= j3max_real THEN 295 | FLG[8] = ON 296 | limit_j3 = 3 297 | ENDIF 298 | ELSE 299 | IF val_new_jpos[3] >= j3max_int THEN 300 | FLG[8] = ON 301 | limit_j3 = 3 302 | ENDIF 303 | ENDIF 304 | ENDIF 305 | 306 | IF UNINIT( val_new_jpos[4] ) THEN 307 | val_new_jpos[4] = 0 308 | ELSE 309 | IF j4min_flag THEN 310 | IF val_new_jpos[4] <= j4min_real THEN 311 | FLG[8] = ON 312 | limit_j4 = 6 313 | ENDIF 314 | ELSE 315 | IF val_new_jpos[4] <= j4min_int THEN 316 | FLG[8] = ON 317 | limit_j4 = 6 318 | ENDIF 319 | ENDIF 320 | IF j4max_flag THEN 321 | IF val_new_jpos[4] >= j4max_real THEN 322 | FLG[8] = ON 323 | limit_j4 = 3 324 | ENDIF 325 | ELSE 326 | IF val_new_jpos[4] >= j4max_int THEN 327 | FLG[8] = ON 328 | limit_j4 = 3 329 | ENDIF 330 | ENDIF 331 | ENDIF 332 | 333 | IF UNINIT( val_new_jpos[5] ) THEN 334 | val_new_jpos[5] = 0 335 | ELSE 336 | IF j5min_flag THEN 337 | IF val_new_jpos[5] <= j5min_real THEN 338 | FLG[8] = ON 339 | limit_j5 = 6 340 | ENDIF 341 | ELSE 342 | IF val_new_jpos[5] <= j5min_int THEN 343 | FLG[8] = ON 344 | limit_j5 = 6 345 | ENDIF 346 | ENDIF 347 | IF j5max_flag THEN 348 | IF val_new_jpos[5] >= j5max_real THEN 349 | FLG[8] = ON 350 | limit_j5 = 3 351 | ENDIF 352 | ELSE 353 | IF val_new_jpos[5] >= j5max_int THEN 354 | FLG[8] = ON 355 | limit_j5 = 3 356 | ENDIF 357 | ENDIF 358 | ENDIF 359 | 360 | IF UNINIT( val_new_jpos[6] ) THEN 361 | val_new_jpos[6] = 0 362 | ELSE 363 | IF j6min_flag THEN 364 | IF val_new_jpos[6] <= j6min_real THEN 365 | FLG[8] = ON 366 | limit_j6 = 6 367 | ENDIF 368 | ELSE 369 | IF val_new_jpos[6] <= j6min_int THEN 370 | FLG[8] = ON 371 | limit_j6 = 6 372 | ENDIF 373 | ENDIF 374 | IF j6max_flag THEN 375 | IF val_new_jpos[6] >= j6max_real THEN 376 | FLG[8] = ON 377 | limit_j6 = 3 378 | ENDIF 379 | ELSE 380 | IF val_new_jpos[6] >= j6max_int THEN 381 | FLG[8] = ON 382 | limit_j6 = 3 383 | ENDIF 384 | ENDIF 385 | ENDIF 386 | 387 | END checkLimit 388 | 389 | BEGIN 390 | 391 | GET_REG(R_WEBKEEP, keep_flag, keep_int, keep_real, STATUS ) 392 | 393 | GET_REG(R_WEBXMAX, xmax_flag, xmax_int, xmax_real, STATUS) 394 | GET_REG(R_WEBYMAX, ymax_flag, ymax_int, ymax_real, STATUS) 395 | GET_REG(R_WEBZMAX, zmax_flag, zmax_int, zmax_real, STATUS) 396 | 397 | GET_REG(R_WEBXMIN, xmin_flag, xmin_int, xmin_real, STATUS) 398 | GET_REG(R_WEBYMIN, ymin_flag, ymin_int, ymin_real, STATUS) 399 | GET_REG(R_WEBZMIN, zmin_flag, zmin_int, zmin_real, STATUS) 400 | 401 | GET_REG(R_WEBJ1MAX, j1max_flag, j1max_int, j1max_real, STATUS) 402 | GET_REG(R_WEBJ2MAX, j2max_flag, j2max_int, j2max_real, STATUS) 403 | GET_REG(R_WEBJ3MAX, j3max_flag, j3max_int, j3max_real, STATUS) 404 | GET_REG(R_WEBJ4MAX, j4max_flag, j4max_int, j4max_real, STATUS) 405 | GET_REG(R_WEBJ5MAX, j5max_flag, j5max_int, j5max_real, STATUS) 406 | GET_REG(R_WEBJ6MAX, j6max_flag, j6max_int, j6max_real, STATUS) 407 | 408 | GET_REG(R_WEBJ1MIN, j1min_flag, j1min_int, j1min_real, STATUS) 409 | GET_REG(R_WEBJ2MIN, j2min_flag, j2min_int, j2min_real, STATUS) 410 | GET_REG(R_WEBJ3MIN, j3min_flag, j3min_int, j3min_real, STATUS) 411 | GET_REG(R_WEBJ4MIN, j4min_flag, j4min_int, j4min_real, STATUS) 412 | GET_REG(R_WEBJ5MIN, j5min_flag, j5min_int, j5min_real, STATUS) 413 | GET_REG(R_WEBJ6MIN, j6min_flag, j6min_int, j6min_real, STATUS) 414 | 415 | reach_ab = 0 416 | 417 | limit_x = 0 418 | limit_y = 0 419 | limit_z = 0 420 | 421 | limit_j1 = 0 422 | limit_j2 = 0 423 | limit_j3 = 0 424 | limit_j4 = 0 425 | limit_j5 = 0 426 | limit_j6 = 0 427 | 428 | cur_jpos = CURJPOS(0,0) 429 | cur_pos = CURPOS(0,0) 430 | 431 | --check the new jpos is in range 432 | 433 | IF FLG[1] OR FLG[2] THEN 434 | 435 | new_jpos = GET_JPOS_REG(PR_WEBJOINTS, STATUS) 436 | 437 | IF (STATUS <> 0 ) THEN 438 | 439 | WRITE ('GET_JPOS_REG built-IN failed WITH STATUS = ', STATUS, CR) 440 | 441 | ELSE 442 | 443 | IF NOT J_IN_RANGE(new_jpos) THEN 444 | FLG[8] = ON 445 | reach_ab = 1 446 | ELSE 447 | reach_ab = 0 448 | ENDIF 449 | 450 | --limit check 451 | 452 | config_ref = HALF_SOLN 453 | 454 | JOINT2POS (new_jpos, $UFRAME, $UTOOL, config_ref, out_pos, wjnt_cfg, ext_ang, STATUS) 455 | 456 | new_pos = out_pos --Convert out_pos (POSITION) to XYZWPREXT 457 | 458 | CNV_JPOS_REL( new_jpos, val_new_jpos, STATUS ) 459 | 460 | checkLimit 461 | 462 | ENDIF 463 | 464 | ENDIF 465 | 466 | --check the new pos is in range 467 | 468 | IF FLG[3] OR FLG[4] OR FLG[5] OR FLG[6] THEN 469 | 470 | new_pos = GET_POS_REG(PR_WEBXYZWPR, STATUS) 471 | 472 | IF (STATUS <> 0 ) THEN 473 | 474 | WRITE ('GET_POS_REG built-IN failed WITH STATUS = ', STATUS, CR) 475 | 476 | ELSE 477 | 478 | IF NOT IN_RANGE(new_pos) THEN 479 | FLG[8] = ON 480 | reach_ab = 1 481 | ELSE 482 | reach_ab = 0 483 | ENDIF 484 | 485 | --limit check 486 | 487 | config_ref = FULL_SOLN 488 | 489 | POS2JOINT (cur_jpos, new_pos, $UFRAME, $UTOOL, config_ref, wjnt_cfg, ext_ang, new_jpos, STATUS) 490 | 491 | CNV_JPOS_REL( new_jpos, val_new_jpos, STATUS ) 492 | 493 | checkLimit 494 | 495 | ENDIF 496 | 497 | ENDIF 498 | 499 | IF keep_flag THEN 500 | IF keep_real > 5 THEN 501 | FLG[8] = ON 502 | ENDIF 503 | ELSE 504 | IF keep_int > 5 THEN 505 | FLG[8] = ON 506 | ENDIF 507 | ENDIF 508 | 509 | END webcheck -------------------------------------------------------------------------------- /karel/webcontrol.kl: -------------------------------------------------------------------------------- 1 | PROGRAM webcontrol 2 | %COMMENT = 'v4' 3 | %NOLOCKGROUP 4 | %NOPAUSE=ERROR+COMMAND+TPENABLE 5 | %NOBUSYLAMP 6 | 7 | CONST 8 | 9 | PR_WEBJOINTS = 40 10 | PR_WEBXYZWPR = 41 11 | 12 | R_WEBJNUM = 49 13 | 14 | R_WEBCOORD1 = 51 15 | R_WEBCOORD2 = 52 16 | R_WEBCOORD3 = 53 17 | R_WEBCOORD4 = 54 18 | R_WEBCOORD5 = 55 19 | R_WEBCOORD6 = 56 20 | 21 | VAR 22 | 23 | STATUS: INTEGER 24 | return_code: INTEGER 25 | 26 | str_mtn_mod: STRING[127] 27 | int_mtn_mod: INTEGER 28 | 29 | str_coord1: STRING[127] 30 | str_coord2: STRING[127] 31 | str_coord3: STRING[127] 32 | str_coord4: STRING[127] 33 | str_coord5: STRING[127] 34 | str_coord6: STRING[127] 35 | 36 | coord: ARRAY[9] OF REAL 37 | cur_jpos_val: ARRAY[9] OF REAL 38 | 39 | cur_jpos: JOINTPOS 40 | cur_pos: XYZWPR 41 | 42 | new_jpos: JOINTPOS 43 | new_pos: XYZWPR 44 | 45 | cur_joint: INTEGER 46 | count: INTEGER 47 | 48 | ROUTINE setreg 49 | 50 | BEGIN 51 | 52 | SET_REAL_REG( R_WEBCOORD1, coord[1], STATUS) 53 | IF (STATUS <> 0 ) THEN 54 | WRITE ('WEBCONTROL SET_REAL_REG coord1 failed = ', STATUS, CR) 55 | ENDIF 56 | 57 | SET_REAL_REG( R_WEBCOORD2, coord[2], STATUS) 58 | IF (STATUS <> 0 ) THEN 59 | WRITE ('WEBCONTROL SET_REAL_REG coord2 failed = ', STATUS, CR) 60 | ENDIF 61 | 62 | SET_REAL_REG( R_WEBCOORD3, coord[3], STATUS) 63 | IF (STATUS <> 0 ) THEN 64 | WRITE ('WEBCONTROL SET_REAL_REG coord3 failed = ', STATUS, CR) 65 | ENDIF 66 | 67 | SET_REAL_REG( R_WEBCOORD4, coord[4], STATUS) 68 | IF (STATUS <> 0 ) THEN 69 | WRITE ('WEBCONTROL SET_REAL_REG coord4 failed = ', STATUS, CR) 70 | ENDIF 71 | 72 | SET_REAL_REG( R_WEBCOORD5, coord[5], STATUS) 73 | IF (STATUS <> 0 ) THEN 74 | WRITE ('WEBCONTROL SET_REAL_REG coord5 failed = ', STATUS, CR) 75 | ENDIF 76 | 77 | SET_REAL_REG( R_WEBCOORD6, coord[6], STATUS) 78 | IF (STATUS <> 0 ) THEN 79 | WRITE ('WEBCONTROL SET_REAL_REG coord6 failed = ', STATUS, CR) 80 | ENDIF 81 | 82 | END setreg 83 | 84 | BEGIN 85 | 86 | WRITE (CHR(128),CHR(137)) 87 | 88 | cur_jpos = CURJPOS(0,0) 89 | cur_pos = CURPOS(0,0) 90 | 91 | CNV_JPOS_REL(cur_jpos, cur_jpos_val, STATUS) 92 | 93 | cur_joint = 9 94 | 95 | FOR count = 9 DOWNTO 1 DO 96 | IF UNINIT ( cur_jpos_val[count] ) THEN cur_joint = cur_joint - 1; ENDIF 97 | ENDFOR 98 | 99 | SET_INT_REG(R_WEBJNUM, cur_joint, STATUS) 100 | IF (STATUS <> 0 ) THEN 101 | WRITE ('SET the NUMBER OF JOINTS is failed = ', STATUS, CR) 102 | ENDIF 103 | 104 | CNV_STR_INT(str_mtn_mod, int_mtn_mod) 105 | 106 | CNV_STR_REAL(str_coord1, coord[1]) 107 | CNV_STR_REAL(str_coord2, coord[2]) 108 | CNV_STR_REAL(str_coord3, coord[3]) 109 | CNV_STR_REAL(str_coord4, coord[4]) 110 | CNV_STR_REAL(str_coord5, coord[5]) 111 | CNV_STR_REAL(str_coord6, coord[6]) 112 | coord[7] = 0 113 | coord[8] = 0 114 | coord[9] = 0 115 | 116 | SELECT int_mtn_mod OF 117 | 118 | CASE(1): --Absolute motion in Joint space - joint interpolation 119 | 120 | CNV_REL_JPOS(coord, new_jpos, STATUS) 121 | IF (STATUS <> 0 ) THEN 122 | WRITE ('WEBCONTROL CNV_REL_JPOS failed = ', STATUS, CR) 123 | ELSE 124 | SET_JPOS_REG(PR_WEBJOINTS, new_jpos, STATUS) 125 | IF (STATUS <> 0 ) THEN 126 | WRITE ('WEBCONTROL SET_JPOS_REG failed = ', STATUS, CR) 127 | ELSE 128 | FLG[1] = ON 129 | FLG[7] = ON 130 | ENDIF 131 | ENDIF 132 | 133 | return_code = 204 134 | 135 | CASE(2): --Relative motion in Joint space - joint interpolation 136 | 137 | setreg 138 | 139 | SET_JPOS_REG(PR_WEBJOINTS, cur_jpos, STATUS) 140 | IF (STATUS <> 0 ) THEN 141 | WRITE ('WEBCONTROL SET_JPOS_REG failed = ', STATUS, CR) 142 | ELSE 143 | FLG[2] = ON 144 | FLG[7] = ON 145 | ENDIF 146 | 147 | return_code = 204 148 | 149 | CASE(3): --Absolute motion in Cartesion space - linear interpolation 150 | 151 | new_pos = cur_pos --Keep the current configuration 152 | 153 | new_pos.x = coord[1] 154 | new_pos.y = coord[2] 155 | new_pos.z = coord[3] 156 | new_pos.w = coord[4] 157 | new_pos.p = coord[5] 158 | new_pos.r = coord[6] 159 | 160 | SET_POS_REG(PR_WEBXYZWPR, new_pos, STATUS) 161 | IF (STATUS <> 0 ) THEN 162 | WRITE ('WEBCONTROL SET_POS_REG failed = ', STATUS, CR) 163 | ELSE 164 | FLG[3] = ON 165 | FLG[7] = ON 166 | ENDIF 167 | 168 | return_code = 204 169 | 170 | CASE(4): --Absolute motion in Cartesion space - joint interpolation 171 | 172 | new_pos = cur_pos --Keep the current configuration 173 | 174 | new_pos.x = coord[1] 175 | new_pos.y = coord[2] 176 | new_pos.z = coord[3] 177 | new_pos.w = coord[4] 178 | new_pos.p = coord[5] 179 | new_pos.r = coord[6] 180 | 181 | SET_POS_REG(PR_WEBXYZWPR, new_pos, STATUS) 182 | IF (STATUS <> 0 ) THEN 183 | WRITE ('WEBCONTROL SET_POS_REG failed = ', STATUS, CR) 184 | ELSE 185 | FLG[4] = ON 186 | FLG[7] = ON 187 | ENDIF 188 | 189 | return_code = 204 190 | 191 | CASE(5): --Relative motion in Cartesion space - linear interpolation 192 | 193 | setreg 194 | 195 | SET_POS_REG(PR_WEBXYZWPR, cur_pos, STATUS) 196 | IF (STATUS <> 0 ) THEN 197 | WRITE ('WEBCONTROL SET_POS_REG failed = ', STATUS, CR) 198 | ELSE 199 | FLG[5] = ON 200 | FLG[7] = ON 201 | ENDIF 202 | 203 | return_code = 204 204 | 205 | CASE(6): --Relative motion in Cartesion space - joint interpolation 206 | 207 | setreg 208 | 209 | SET_POS_REG(PR_WEBXYZWPR, cur_pos, STATUS) 210 | IF (STATUS <> 0 ) THEN 211 | WRITE ('WEBCONTROL SET_POS_REG failed = ', STATUS, CR) 212 | ELSE 213 | FLG[6] = ON 214 | FLG[7] = ON 215 | ENDIF 216 | 217 | return_code = 204 218 | 219 | ELSE: 220 | 221 | WRITE('WEBCONTROL ERROR',CR) 222 | 223 | return_code = 204 224 | 225 | ENDSELECT 226 | 227 | END webcontrol -------------------------------------------------------------------------------- /karel/webkeep.kl: -------------------------------------------------------------------------------- 1 | PROGRAM webkeep 2 | %COMMENT = 'v2' 3 | %NOLOCKGROUP 4 | %NOPAUSE=ERROR+COMMAND+TPENABLE 5 | %NOBUSYLAMP 6 | 7 | CONST 8 | 9 | R_WEBKEEP = 42 10 | 11 | VAR 12 | 13 | STATUS: INTEGER 14 | return_code: INTEGER 15 | 16 | BEGIN 17 | 18 | SET_REAL_REG(R_WEBKEEP, 0, STATUS) 19 | return_code = 204 20 | 21 | END webkeep -------------------------------------------------------------------------------- /karel/weblimit.kl: -------------------------------------------------------------------------------- 1 | PROGRAM weblimit 2 | %COMMENT = 'v1' 3 | %NOLOCKGROUP 4 | %NOPAUSE=ERROR+COMMAND+TPENABLE 5 | %NOBUSYLAMP 6 | 7 | CONST 8 | 9 | R_WEBXMAX = 43 10 | R_WEBYMAX = 44 11 | R_WEBZMAX = 45 12 | 13 | R_WEBXMIN = 46 14 | R_WEBYMIN = 47 15 | R_WEBZMIN = 48 16 | 17 | R_WEBJ1MAX = 61 18 | R_WEBJ2MAX = 62 19 | R_WEBJ3MAX = 63 20 | R_WEBJ4MAX = 64 21 | R_WEBJ5MAX = 65 22 | R_WEBJ6MAX = 66 23 | 24 | R_WEBJ1MIN = 71 25 | R_WEBJ2MIN = 72 26 | R_WEBJ3MIN = 73 27 | R_WEBJ4MIN = 74 28 | R_WEBJ5MIN = 75 29 | R_WEBJ6MIN = 76 30 | 31 | VAR 32 | 33 | STATUS: INTEGER 34 | return_code: INTEGER 35 | 36 | str_limit_id: STRING[127] 37 | str_limit_vl: STRING[127] 38 | 39 | limit_id: REAL 40 | limit_vl: REAL 41 | limit_no: REAL 42 | 43 | BEGIN 44 | 45 | limit_no = 1 46 | 47 | CNV_STR_REAL(str_limit_id, limit_id) 48 | CNV_STR_REAL(str_limit_vl, limit_vl) 49 | 50 | IF UNINIT( limit_vl ) THEN limit_vl = 10000; limit_no = -1; ENDIF 51 | 52 | IF (limit_id = 1) THEN 53 | SET_REAL_REG(R_WEBXMAX, limit_vl, STATUS) 54 | IF (STATUS <> 0 ) THEN 55 | WRITE ('SET_REAL_REG built-IN failed in limit_id 1 task: ', STATUS, CR) 56 | ENDIF 57 | ENDIF 58 | 59 | IF (limit_id = 2) THEN 60 | SET_REAL_REG(R_WEBYMAX, limit_vl, STATUS) 61 | IF (STATUS <> 0 ) THEN 62 | WRITE ('SET_REAL_REG built-IN failed in limit_id 2 task: ', STATUS, CR) 63 | ENDIF 64 | ENDIF 65 | 66 | IF (limit_id = 3) THEN 67 | SET_REAL_REG(R_WEBZMAX, limit_vl, STATUS) 68 | IF (STATUS <> 0 ) THEN 69 | WRITE ('SET_REAL_REG built-IN failed in limit_id 3 task: ', STATUS, CR) 70 | ENDIF 71 | ENDIF 72 | 73 | IF (limit_id = 4) THEN 74 | SET_REAL_REG(R_WEBXMIN, (limit_no * limit_vl), STATUS) 75 | IF (STATUS <> 0 ) THEN 76 | WRITE ('SET_REAL_REG built-IN failed in limit_id 4 task: ', STATUS, CR) 77 | ENDIF 78 | ENDIF 79 | 80 | IF (limit_id = 5) THEN 81 | SET_REAL_REG(R_WEBYMIN, (limit_no * limit_vl), STATUS) 82 | IF (STATUS <> 0 ) THEN 83 | WRITE ('SET_REAL_REG built-IN failed in limit_id 5 task: ', STATUS, CR) 84 | ENDIF 85 | ENDIF 86 | 87 | IF (limit_id = 6) THEN 88 | SET_REAL_REG(R_WEBZMIN, (limit_no * limit_vl), STATUS) 89 | IF (STATUS <> 0 ) THEN 90 | WRITE ('SET_REAL_REG built-IN failed in limit_id 6 task: ', STATUS, CR) 91 | ENDIF 92 | ENDIF 93 | 94 | IF (limit_id = 11) THEN 95 | SET_REAL_REG(R_WEBJ1MAX, limit_vl, STATUS) 96 | IF (STATUS <> 0 ) THEN 97 | WRITE ('SET_REAL_REG built-IN failed in limit_id 11 task: ', STATUS, CR) 98 | ENDIF 99 | ENDIF 100 | 101 | IF (limit_id = 12) THEN 102 | SET_REAL_REG(R_WEBJ2MAX, limit_vl, STATUS) 103 | IF (STATUS <> 0 ) THEN 104 | WRITE ('SET_REAL_REG built-IN failed in limit_id 12 task: ', STATUS, CR) 105 | ENDIF 106 | ENDIF 107 | 108 | IF (limit_id = 13) THEN 109 | SET_REAL_REG(R_WEBJ3MAX, limit_vl, STATUS) 110 | IF (STATUS <> 0 ) THEN 111 | WRITE ('SET_REAL_REG built-IN failed in limit_id 13 task: ', STATUS, CR) 112 | ENDIF 113 | ENDIF 114 | 115 | IF (limit_id = 14) THEN 116 | SET_REAL_REG(R_WEBJ4MAX, limit_vl, STATUS) 117 | IF (STATUS <> 0 ) THEN 118 | WRITE ('SET_REAL_REG built-IN failed in limit_id 14 task: ', STATUS, CR) 119 | ENDIF 120 | ENDIF 121 | 122 | IF (limit_id = 15) THEN 123 | SET_REAL_REG(R_WEBJ5MAX, limit_vl, STATUS) 124 | IF (STATUS <> 0 ) THEN 125 | WRITE ('SET_REAL_REG built-IN failed in limit_id 15 task: ', STATUS, CR) 126 | ENDIF 127 | ENDIF 128 | 129 | IF (limit_id = 16) THEN 130 | SET_REAL_REG(R_WEBJ6MAX, limit_vl, STATUS) 131 | IF (STATUS <> 0 ) THEN 132 | WRITE ('SET_REAL_REG built-IN failed in limit_id 16 task: ', STATUS, CR) 133 | ENDIF 134 | ENDIF 135 | 136 | IF (limit_id = 21) THEN 137 | SET_REAL_REG(R_WEBJ1MIN, (limit_no * limit_vl), STATUS) 138 | IF (STATUS <> 0 ) THEN 139 | WRITE ('SET_REAL_REG built-IN failed in limit_id 21 task: ', STATUS, CR) 140 | ENDIF 141 | ENDIF 142 | 143 | IF (limit_id = 22) THEN 144 | SET_REAL_REG(R_WEBJ2MIN, (limit_no * limit_vl), STATUS) 145 | IF (STATUS <> 0 ) THEN 146 | WRITE ('SET_REAL_REG built-IN failed in limit_id 22 task: ', STATUS, CR) 147 | ENDIF 148 | ENDIF 149 | 150 | IF (limit_id = 23) THEN 151 | SET_REAL_REG(R_WEBJ3MIN,(limit_no * limit_vl), STATUS) 152 | IF (STATUS <> 0 ) THEN 153 | WRITE ('SET_REAL_REG built-IN failed in limit_id 23 task: ', STATUS, CR) 154 | ENDIF 155 | ENDIF 156 | 157 | IF (limit_id = 24) THEN 158 | SET_REAL_REG(R_WEBJ4MIN,(limit_no * limit_vl), STATUS) 159 | IF (STATUS <> 0 ) THEN 160 | WRITE ('SET_REAL_REG built-IN failed in limit_id 24 task: ', STATUS, CR) 161 | ENDIF 162 | ENDIF 163 | 164 | IF (limit_id = 25) THEN 165 | SET_REAL_REG(R_WEBJ5MIN, (limit_no * limit_vl), STATUS) 166 | IF (STATUS <> 0 ) THEN 167 | WRITE ('SET_REAL_REG built-IN failed in limit_id 25 task: ', STATUS, CR) 168 | ENDIF 169 | ENDIF 170 | 171 | IF (limit_id = 26) THEN 172 | SET_REAL_REG(R_WEBJ6MIN, (limit_no * limit_vl), STATUS) 173 | IF (STATUS <> 0 ) THEN 174 | WRITE ('SET_REAL_REG built-IN failed in limit_id 26 task: ', STATUS, CR) 175 | ENDIF 176 | ENDIF 177 | 178 | return_code = 204 179 | 180 | END weblimit -------------------------------------------------------------------------------- /karel/webmonitor.kl: -------------------------------------------------------------------------------- 1 | PROGRAM webmonitor 2 | %COMMENT = 'v6' 3 | %NOLOCKGROUP 4 | %NOPAUSE=ERROR+COMMAND+TPENABLE 5 | %NOBUSYLAMP 6 | 7 | CONST 8 | 9 | R_WEBXMAX = 43 10 | R_WEBYMAX = 44 11 | R_WEBZMAX = 45 12 | 13 | R_WEBXMIN = 46 14 | R_WEBYMIN = 47 15 | R_WEBZMIN = 48 16 | 17 | R_WEBJ1MAX = 61 18 | R_WEBJ2MAX = 62 19 | R_WEBJ3MAX = 63 20 | R_WEBJ4MAX = 64 21 | R_WEBJ5MAX = 65 22 | R_WEBJ6MAX = 66 23 | 24 | R_WEBJ1MIN = 71 25 | R_WEBJ2MIN = 72 26 | R_WEBJ3MIN = 73 27 | R_WEBJ4MIN = 74 28 | R_WEBJ5MIN = 75 29 | R_WEBJ6MIN = 76 30 | 31 | VAR 32 | 33 | STATUS: INTEGER 34 | responseFile: FILE 35 | 36 | xmax_flag: BOOLEAN 37 | ymax_flag: BOOLEAN 38 | zmax_flag: BOOLEAN 39 | 40 | xmin_flag: BOOLEAN 41 | ymin_flag: BOOLEAN 42 | zmin_flag: BOOLEAN 43 | 44 | j1max_flag: BOOLEAN 45 | j2max_flag: BOOLEAN 46 | j3max_flag: BOOLEAN 47 | j4max_flag: BOOLEAN 48 | j5max_flag: BOOLEAN 49 | j6max_flag: BOOLEAN 50 | 51 | j1min_flag: BOOLEAN 52 | j2min_flag: BOOLEAN 53 | j3min_flag: BOOLEAN 54 | j4min_flag: BOOLEAN 55 | j5min_flag: BOOLEAN 56 | j6min_flag: BOOLEAN 57 | 58 | xmax_int: INTEGER 59 | ymax_int: INTEGER 60 | zmax_int: INTEGER 61 | 62 | xmin_int: INTEGER 63 | ymin_int: INTEGER 64 | zmin_int: INTEGER 65 | 66 | j1max_int: INTEGER 67 | j2max_int: INTEGER 68 | j3max_int: INTEGER 69 | j4max_int: INTEGER 70 | j5max_int: INTEGER 71 | j6max_int: INTEGER 72 | 73 | j1min_int: INTEGER 74 | j2min_int: INTEGER 75 | j3min_int: INTEGER 76 | j4min_int: INTEGER 77 | j5min_int: INTEGER 78 | j6min_int: INTEGER 79 | 80 | xmax_real: REAL 81 | ymax_real: REAL 82 | zmax_real: REAL 83 | 84 | xmin_real: REAL 85 | ymin_real: REAL 86 | zmin_real: REAL 87 | 88 | j1max_real: REAL 89 | j2max_real: REAL 90 | j3max_real: REAL 91 | j4max_real: REAL 92 | j5max_real: REAL 93 | j6max_real: REAL 94 | 95 | j1min_real: REAL 96 | j2min_real: REAL 97 | j3min_real: REAL 98 | j4min_real: REAL 99 | j5min_real: REAL 100 | j6min_real: REAL 101 | 102 | error_code: INTEGER 103 | error_string: STRING[127] 104 | cause_code: INTEGER 105 | cause_string: STRING[127] 106 | time_int: INTEGER 107 | severity: INTEGER 108 | prog_nam: STRING[127] 109 | 110 | str_task IN DRAM FROM webstart: STRING[127] 111 | task_att: INTEGER 112 | task_dum: STRING[127] 113 | running: INTEGER 114 | webmotion: INTEGER 115 | 116 | currentPos: XYZWPREXT 117 | currentPosJ: JOINTPOS 118 | valuePosJ: ARRAY[6] OF REAL 119 | 120 | reach_ab IN DRAM FROM webcheck: INTEGER 121 | 122 | limit_x IN DRAM FROM webcheck: INTEGER 123 | limit_y IN DRAM FROM webcheck: INTEGER 124 | limit_z IN DRAM FROM webcheck: INTEGER 125 | 126 | limit_j1 IN DRAM FROM webcheck: INTEGER 127 | limit_j2 IN DRAM FROM webcheck: INTEGER 128 | limit_j3 IN DRAM FROM webcheck: INTEGER 129 | limit_j4 IN DRAM FROM webcheck: INTEGER 130 | limit_j5 IN DRAM FROM webcheck: INTEGER 131 | limit_j6 IN DRAM FROM webcheck: INTEGER 132 | 133 | currentTime: INTEGER 134 | timeStamp: STRING[127] 135 | 136 | fnoentry: INTEGER 137 | fnovalue: STRING[127] 138 | 139 | BEGIN 140 | 141 | IF UNINIT( str_task ) THEN str_task = '@@@###@@@'; ENDIF 142 | 143 | IF UNINIT( reach_ab ) THEN reach_ab = 0; ENDIF 144 | 145 | IF UNINIT( limit_x ) THEN limit_x = 0; ENDIF 146 | IF UNINIT( limit_y ) THEN limit_y = 0; ENDIF 147 | IF UNINIT( limit_z ) THEN limit_z = 0; ENDIF 148 | 149 | IF UNINIT( limit_j1 ) THEN limit_j1 = 0; ENDIF 150 | IF UNINIT( limit_j2 ) THEN limit_j2 = 0; ENDIF 151 | IF UNINIT( limit_j3 ) THEN limit_j3 = 0; ENDIF 152 | IF UNINIT( limit_j4 ) THEN limit_j4 = 0; ENDIF 153 | IF UNINIT( limit_j5 ) THEN limit_j5 = 0; ENDIF 154 | IF UNINIT( limit_j6 ) THEN limit_j6 = 0; ENDIF 155 | 156 | IF UNINIT( valuePosJ[1] ) THEN valuePosJ[1] = 10000; ENDIF 157 | IF UNINIT( valuePosJ[2] ) THEN valuePosJ[2] = 10000; ENDIF 158 | IF UNINIT( valuePosJ[3] ) THEN valuePosJ[3] = 10000; ENDIF 159 | IF UNINIT( valuePosJ[4] ) THEN valuePosJ[4] = 10000; ENDIF 160 | IF UNINIT( valuePosJ[5] ) THEN valuePosJ[5] = 10000; ENDIF 161 | IF UNINIT( valuePosJ[6] ) THEN valuePosJ[6] = 10000; ENDIF 162 | 163 | GET_REG(R_WEBXMAX, xmax_flag, xmax_int, xmax_real, STATUS) 164 | GET_REG(R_WEBYMAX, ymax_flag, ymax_int, ymax_real, STATUS) 165 | GET_REG(R_WEBZMAX, zmax_flag, zmax_int, zmax_real, STATUS) 166 | 167 | GET_REG(R_WEBXMIN, xmin_flag, xmin_int, xmin_real, STATUS) 168 | GET_REG(R_WEBYMIN, ymin_flag, ymin_int, ymin_real, STATUS) 169 | GET_REG(R_WEBZMIN, zmin_flag, zmin_int, zmin_real, STATUS) 170 | 171 | GET_REG(R_WEBJ1MAX, j1max_flag, j1max_int, j1max_real, STATUS) 172 | GET_REG(R_WEBJ2MAX, j2max_flag, j2max_int, j2max_real, STATUS) 173 | GET_REG(R_WEBJ3MAX, j3max_flag, j3max_int, j3max_real, STATUS) 174 | GET_REG(R_WEBJ4MAX, j4max_flag, j4max_int, j4max_real, STATUS) 175 | GET_REG(R_WEBJ5MAX, j5max_flag, j5max_int, j5max_real, STATUS) 176 | GET_REG(R_WEBJ6MAX, j6max_flag, j6max_int, j6max_real, STATUS) 177 | 178 | GET_REG(R_WEBJ1MIN, j1min_flag, j1min_int, j1min_real, STATUS) 179 | GET_REG(R_WEBJ2MIN, j2min_flag, j2min_int, j2min_real, STATUS) 180 | GET_REG(R_WEBJ3MIN, j3min_flag, j3min_int, j3min_real, STATUS) 181 | GET_REG(R_WEBJ4MIN, j4min_flag, j4min_int, j4min_real, STATUS) 182 | GET_REG(R_WEBJ5MIN, j5min_flag, j5min_int, j5min_real, STATUS) 183 | GET_REG(R_WEBJ6MIN, j6min_flag, j6min_int, j6min_real, STATUS) 184 | 185 | ERR_DATA(MAXINT, error_code, error_string, cause_code, cause_string, time_int, severity, prog_nam) 186 | 187 | running = 0 188 | webmotion = 0 189 | 190 | GET_TSK_INFO(str_task, 0, TSK_STATUS, task_att, task_dum, STATUS) 191 | IF (STATUS <> 0 ) THEN 192 | WRITE ('GET_TSK_INFO is failed, STATUS = ', STATUS, CR) 193 | ELSE 194 | IF ( task_att = PG_RUNNING ) THEN 195 | running = 1 196 | ELSE 197 | running = 0 198 | ENDIF 199 | ENDIF 200 | 201 | IF (str_task = 'WEBMOTION') THEN 202 | webmotion = 1 203 | ELSE 204 | webmotion = 0 205 | ENDIF 206 | 207 | currentPos = CURPOS(0,0) 208 | 209 | currentPosJ = CURJPOS(0,0) 210 | 211 | CNV_JPOS_REL( currentPosJ, valuePosJ, STATUS ) 212 | IF (STATUS <> 0 ) THEN 213 | WRITE ('CNV_JPOS_REL is failed, STATUS = ', STATUS, CR) 214 | ENDIF 215 | 216 | GET_TIME(currentTime) 217 | CNV_TIME_STR(currentTime, timeStamp) 218 | 219 | GET_VAR(fnoentry, '*SYSTEM*', '$FNO', fnovalue, STATUS) 220 | 221 | OPEN FILE responseFile ('RW', 'RD:RESPONSE.HTM') 222 | 223 | WRITE responseFile( '{', CR ) 224 | WRITE responseFile( '"robotid": [' ) 225 | WRITE responseFile( '"',fnovalue,'"') 226 | WRITE responseFile( ' ],', CR ) 227 | WRITE responseFile( '"joint": [' ) 228 | WRITE responseFile( valuePosJ[1],',') 229 | WRITE responseFile( valuePosJ[2],',') 230 | WRITE responseFile( valuePosJ[3],',') 231 | WRITE responseFile( valuePosJ[4],',') 232 | WRITE responseFile( valuePosJ[5],',') 233 | WRITE responseFile( valuePosJ[6] ) 234 | WRITE responseFile( ' ],', CR ) 235 | WRITE responseFile( '"pose": [' ) 236 | WRITE responseFile( currentPos.x,',') 237 | WRITE responseFile( currentPos.y,',') 238 | WRITE responseFile( currentPos.z,',') 239 | WRITE responseFile( currentPos.w,',') 240 | WRITE responseFile( currentPos.p,',') 241 | WRITE responseFile( currentPos.r ) 242 | WRITE responseFile( ' ],', CR ) 243 | WRITE responseFile( '"limit": [' ) 244 | IF xmax_flag THEN 245 | WRITE responseFile( xmax_real,',') 246 | ELSE 247 | WRITE responseFile( xmax_int,',') 248 | ENDIF 249 | IF ymax_flag THEN 250 | WRITE responseFile( ymax_real,',') 251 | ELSE 252 | WRITE responseFile( ymax_int,',') 253 | ENDIF 254 | IF zmax_flag THEN 255 | WRITE responseFile( zmax_real,',') 256 | ELSE 257 | WRITE responseFile( zmax_int,',') 258 | ENDIF 259 | IF xmin_flag THEN 260 | WRITE responseFile( xmin_real,',') 261 | ELSE 262 | WRITE responseFile( xmin_int,',') 263 | ENDIF 264 | IF ymin_flag THEN 265 | WRITE responseFile( ymin_real,',') 266 | ELSE 267 | WRITE responseFile( ymin_int,',') 268 | ENDIF 269 | IF zmin_flag THEN 270 | WRITE responseFile( zmin_real,',') 271 | ELSE 272 | WRITE responseFile( zmin_int,',') 273 | ENDIF 274 | IF j1max_flag THEN 275 | WRITE responseFile( j1max_real,',') 276 | ELSE 277 | WRITE responseFile( j1max_int,',') 278 | ENDIF 279 | IF j2max_flag THEN 280 | WRITE responseFile( j2max_real,',') 281 | ELSE 282 | WRITE responseFile( j2max_int,',') 283 | ENDIF 284 | IF j3max_flag THEN 285 | WRITE responseFile( j3max_real,',') 286 | ELSE 287 | WRITE responseFile( j3max_int,',') 288 | ENDIF 289 | IF j4max_flag THEN 290 | WRITE responseFile( j4max_real,',') 291 | ELSE 292 | WRITE responseFile( j4max_int,',') 293 | ENDIF 294 | IF j5max_flag THEN 295 | WRITE responseFile( j5max_real,',') 296 | ELSE 297 | WRITE responseFile( j5max_int,',') 298 | ENDIF 299 | IF j6max_flag THEN 300 | WRITE responseFile( j6max_real,',') 301 | ELSE 302 | WRITE responseFile( j6max_int,',') 303 | ENDIF 304 | IF j1min_flag THEN 305 | WRITE responseFile( j1min_real,',') 306 | ELSE 307 | WRITE responseFile( j1min_int,',') 308 | ENDIF 309 | IF j2min_flag THEN 310 | WRITE responseFile( j2min_real,',') 311 | ELSE 312 | WRITE responseFile( j2min_int,',') 313 | ENDIF 314 | IF j3min_flag THEN 315 | WRITE responseFile( j3min_real,',') 316 | ELSE 317 | WRITE responseFile( j3min_int,',') 318 | ENDIF 319 | IF j4min_flag THEN 320 | WRITE responseFile( j4min_real,',') 321 | ELSE 322 | WRITE responseFile( j4min_int,',') 323 | ENDIF 324 | IF j5min_flag THEN 325 | WRITE responseFile( j5min_real,',') 326 | ELSE 327 | WRITE responseFile( j5min_int,',') 328 | ENDIF 329 | IF j6min_flag THEN 330 | WRITE responseFile( j6min_real) 331 | ELSE 332 | WRITE responseFile( j6min_int) 333 | ENDIF 334 | WRITE responseFile( ' ],', CR ) 335 | WRITE responseFile( '"status": [' ) 336 | WRITE responseFile( running,',') 337 | WRITE responseFile( webmotion) 338 | WRITE responseFile( ' ],', CR ) 339 | WRITE responseFile( '"message": [' ) 340 | WRITE responseFile( reach_ab,',') 341 | WRITE responseFile( limit_x,',') 342 | WRITE responseFile( limit_y,',') 343 | WRITE responseFile( limit_z,',') 344 | WRITE responseFile( limit_j1,',') 345 | WRITE responseFile( limit_j2,',') 346 | WRITE responseFile( limit_j3,',') 347 | WRITE responseFile( limit_j4,',') 348 | WRITE responseFile( limit_j5,',') 349 | WRITE responseFile( limit_j6) 350 | WRITE responseFile( ' ],', CR ) 351 | WRITE responseFile( '"timestamp": [' ) 352 | WRITE responseFile( '"',timeStamp,'"',',') 353 | WRITE responseFile( currentTime ) 354 | WRITE responseFile( ' ],', CR ) 355 | WRITE responseFile( '"error": [' ) 356 | WRITE responseFile( error_code,',' ) 357 | WRITE responseFile( '"',error_string,'"' ) 358 | WRITE responseFile( ' ]', CR ) 359 | WRITE responseFile( '}') 360 | 361 | CLOSE FILE responseFile 362 | 363 | END webmonitor -------------------------------------------------------------------------------- /karel/webprogram.kl: -------------------------------------------------------------------------------- 1 | PROGRAM webprogram 2 | %COMMENT = 'v1' 3 | %NOLOCKGROUP 4 | %NOPAUSE=ERROR+COMMAND+TPENABLE 5 | %NOBUSYLAMP 6 | 7 | VAR 8 | 9 | STATUS: INTEGER 10 | responseFile: FILE 11 | 12 | proga: ARRAY[100] OF STRING[16] 13 | progc: INTEGER 14 | progn: INTEGER 15 | 16 | BEGIN 17 | 18 | FOR progc = 1 TO ARRAY_LEN(proga) DO 19 | IF UNINIT( proga[progc] ) THEN proga[progc] = '######'; ENDIF 20 | ENDFOR 21 | 22 | PROG_LIST('*', 8, 0, 2, proga, ARRAY_LEN(proga), STATUS) 23 | IF (STATUS <> 0 ) THEN 24 | WRITE ('PROG_LIST built-IN failed WITH STATUS = ', STATUS, CR) 25 | ENDIF 26 | 27 | OPEN FILE responseFile ('RW', 'RD:RESPONSE.HTM') 28 | 29 | WRITE responseFile( '{', CR ) 30 | WRITE responseFile( '"progs": [' ) 31 | FOR progn = 1 TO ARRAY_LEN(proga) - 1 DO 32 | WRITE responseFile('"' ,proga[progn],'"',',' ) 33 | ENDFOR 34 | WRITE responseFile( '"',proga[ARRAY_LEN(proga)],'"' ) 35 | WRITE responseFile( ' ] ', CR ) 36 | WRITE responseFile( '}') 37 | 38 | CLOSE FILE responseFile 39 | 40 | END webprogram -------------------------------------------------------------------------------- /karel/webreset.kl: -------------------------------------------------------------------------------- 1 | PROGRAM webreset 2 | %COMMENT = 'v1' 3 | %NOLOCKGROUP 4 | %NOPAUSE=ERROR+COMMAND+TPENABLE 5 | %NOBUSYLAMP 6 | 7 | VAR 8 | 9 | successful: BOOLEAN 10 | prog_index: INTEGER 11 | 12 | BEGIN 13 | 14 | RESET(successful) 15 | 16 | IF successful <> TRUE THEN 17 | WRITE('RESET is NOT sucessful',CR) 18 | ENDIF 19 | 20 | CALL_PROG('webabort', prog_index) 21 | 22 | END webreset -------------------------------------------------------------------------------- /karel/webstart.kl: -------------------------------------------------------------------------------- 1 | PROGRAM webstart 2 | %COMMENT = 'v1' 3 | %NOLOCKGROUP 4 | %NOPAUSE=ERROR+COMMAND+TPENABLE 5 | %NOBUSYLAMP 6 | 7 | VAR 8 | 9 | STATUS: INTEGER 10 | return_code: INTEGER 11 | 12 | prog_index: INTEGER 13 | 14 | str_task: STRING[127] 15 | 16 | BEGIN 17 | WRITE (CHR(128),CHR(137)) 18 | 19 | IF UNINIT( str_task ) THEN str_task = '###@@@###'; ENDIF 20 | 21 | CALL_PROG('webcheck', prog_index) 22 | 23 | RUN_TASK( str_task, 0, FALSE, FALSE, 1, STATUS ) 24 | 25 | IF (STATUS <> 0 ) THEN 26 | WRITE ('RUN_TASK built-IN failed = ', STATUS, CR) 27 | ELSE 28 | return_code = 204 29 | ENDIF 30 | 31 | END webstart 32 | -------------------------------------------------------------------------------- /karel/webstop.kl: -------------------------------------------------------------------------------- 1 | PROGRAM webstop 2 | %COMMENT = 'v3' 3 | %NOLOCKGROUP 4 | %NOPAUSE=ERROR+COMMAND+TPENABLE 5 | %NOBUSYLAMP 6 | 7 | VAR 8 | 9 | STATUS: INTEGER 10 | return_code: INTEGER 11 | 12 | BEGIN 13 | 14 | WRITE (CHR(128),CHR(137)) 15 | 16 | SET_REAL_REG(42, 999, STATUS) 17 | IF (STATUS <> 0 ) THEN 18 | WRITE ('WEBSTOP SET R42 failed: ', STATUS, CR) 19 | ENDIF 20 | 21 | SET_REAL_REG(51, 0, STATUS) 22 | IF (STATUS <> 0 ) THEN 23 | WRITE ('WEBSTOP SET R51 failed: ', STATUS, CR) 24 | ENDIF 25 | 26 | SET_REAL_REG(52, 0, STATUS) 27 | IF (STATUS <> 0 ) THEN 28 | WRITE ('WEBSTOP SET R52 failed: ', STATUS, CR) 29 | ENDIF 30 | 31 | SET_REAL_REG(53, 0, STATUS) 32 | IF (STATUS <> 0 ) THEN 33 | WRITE ('WEBSTOP SET R53 failed: ', STATUS, CR) 34 | ENDIF 35 | 36 | SET_REAL_REG(54, 0, STATUS) 37 | IF (STATUS <> 0 ) THEN 38 | WRITE ('WEBSTOP SET R54 failed: ', STATUS, CR) 39 | ENDIF 40 | 41 | SET_REAL_REG(55, 0, STATUS) 42 | IF (STATUS <> 0 ) THEN 43 | WRITE ('WEBSTOP SET R55 failed: ', STATUS, CR) 44 | ENDIF 45 | 46 | SET_REAL_REG(56, 0, STATUS) 47 | IF (STATUS <> 0 ) THEN 48 | WRITE ('WEBSTOP SET R56 failed: ', STATUS, CR) 49 | ENDIF 50 | 51 | return_code = 204 52 | 53 | END webstop -------------------------------------------------------------------------------- /preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ABC-iRobotics/fanuc-webcontrol/f7f2c671ee51dd17ca7431df8e167cdc8a2b1717/preview.png -------------------------------------------------------------------------------- /preview2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ABC-iRobotics/fanuc-webcontrol/f7f2c671ee51dd17ca7431df8e167cdc8a2b1717/preview2.png -------------------------------------------------------------------------------- /register.md: -------------------------------------------------------------------------------- 1 | ## Used Registers [R] 2 | 3 | - R_WEBKEEP = 42 moving while this is smaller than 5 4 | 5 | - R_WEBXMAX = 43 X axis maximum limit 6 | - R_WEBYMAX = 44 Y axis maximum limit 7 | - R_WEBZMAX = 45 Z axis maximum limit 8 | - R_WEBXMIN = 46 X axis minimum limit 9 | - R_WEBYMIN = 47 Y axis minimum limit 10 | - R_WEBZMIN = 48 Z axis minimum limit 11 | 12 | - R_WEBJNUM = 49 number of joints 13 | 14 | - R_WEBJNUM = 50 counter 15 | 16 | - R_WEBCOORD1 = 51 temporary saved coordinate (X or J1) 17 | - R_WEBCOORD2 = 52 temporary saved coordinate (Y or J2) 18 | - R_WEBCOORD3 = 53 temporary saved coordinate (Z or J3) 19 | - R_WEBCOORD4 = 54 temporary saved coordinate (W or J4) 20 | - R_WEBCOORD5 = 55 temporary saved coordinate (P or J5) 21 | - R_WEBCOORD6 = 56 temporary saved coordinate (R or J6) 22 | 23 | - R_WEBJNUM = 60 counter with offset 50 (the WEBCOORD registers number) 24 | 25 | - R_WEBJ1MAX = 61 joint 1 maximum limit 26 | - R_WEBJ2MAX = 62 joint 2 maximum limit 27 | - R_WEBJ3MAX = 63 joint 3 maximum limit 28 | - R_WEBJ4MAX = 64 joint 4 maximum limit 29 | - R_WEBJ5MAX = 65 joint 5 maximum limit 30 | - R_WEBJ6MAX = 66 joint 6 maximum limit 31 | 32 | - R_WEBJ1MIN = 71 joint 1 minimum limit 33 | - R_WEBJ2MIN = 72 joint 2 minimum limit 34 | - R_WEBJ3MIN = 73 joint 3 minimum limit 35 | - R_WEBJ4MIN = 74 joint 4 minimum limit 36 | - R_WEBJ5MIN = 75 joint 5 minimum limit 37 | - R_WEBJ6MIN = 76 joint 6 minimum limit 38 | -------------------------------------------------------------------------------- /tpe/webmotion.ls: -------------------------------------------------------------------------------- 1 | /PROG WEBMOTION 2 | /ATTR 3 | OWNER = MNEDITOR; 4 | COMMENT = "v2"; 5 | PROG_SIZE = 1766; 6 | CREATE = DATE 17-06-26 TIME 17:33:34; 7 | MODIFIED = DATE 17-11-07 TIME 14:01:42; 8 | FILE_NAME = ; 9 | VERSION = 0; 10 | LINE_COUNT = 91; 11 | MEMORY_SIZE = 2166; 12 | PROTECT = READ_WRITE; 13 | TCD: STACK_SIZE = 0, 14 | TASK_PRIORITY = 50, 15 | TIME_SLICE = 0, 16 | BUSY_LAMP_OFF = 0, 17 | ABORT_REQUEST = 0, 18 | PAUSE_REQUEST = 0; 19 | DEFAULT_GROUP = 1,*,*,*,*; 20 | CONTROL_CODE = 00000000 00000000; 21 | /MN 22 | 1: JMP LBL[999] ; 23 | 2: ; 24 | 3: LBL[7] ; 25 | 4: WAIT (F[7]) ; 26 | 5: R[42]=0 ; 27 | 6: IF (F[1]),JMP LBL[1] ; 28 | 7: IF (F[2]),JMP LBL[2] ; 29 | 8: IF (F[3]),JMP LBL[3] ; 30 | 9: IF (F[4]),JMP LBL[4] ; 31 | 10: IF (F[5]),JMP LBL[5] ; 32 | 11: IF (F[6]),JMP LBL[6] ; 33 | 12: ; 34 | 13: LBL[1] ; 35 | 14: CALL WEBCHECK ; 36 | 15: IF (F[8]),JMP LBL[999] ; 37 | 16:J PR[40] 10% CNT100 ; 38 | 17: R[42]=R[42]+1 ; 39 | 18: JMP LBL[1] ; 40 | 19: ; 41 | 20: LBL[2] ; 42 | 21: R[50]=0 ; 43 | 22: LBL[21] ; 44 | 23: IF R[50]=R[49],JMP LBL[22] ; 45 | 24: R[50]=R[50]+1 ; 46 | 25: R[60]=50+R[50] ; 47 | 26: PR[40,R[50]]=PR[40,R[50]]+R[R[60]] ; 48 | 27: JMP LBL[21] ; 49 | 28: LBL[22] ; 50 | 29: CALL WEBCHECK ; 51 | 30: IF (F[8]),JMP LBL[999] ; 52 | 31:J PR[40] 5% CNT100 ; 53 | 32: R[42]=R[42]+1 ; 54 | 33: JMP LBL[2] ; 55 | 34: ; 56 | 35: LBL[3] ; 57 | 36: CALL WEBCHECK ; 58 | 37: IF (F[8]),JMP LBL[999] ; 59 | 38:L PR[41] 50mm/sec CNT100 ; 60 | 39: R[42]=R[42]+1 ; 61 | 40: JMP LBL[3] ; 62 | 41: ; 63 | 42: LBL[4] ; 64 | 43: CALL WEBCHECK ; 65 | 44: IF (F[8]),JMP LBL[999] ; 66 | 45:J PR[41] 5% CNT100 ; 67 | 46: R[42]=R[42]+1 ; 68 | 47: JMP LBL[4] ; 69 | 48: ; 70 | 49: LBL[5] ; 71 | 50: PR[41,1]=PR[41,1]+R[51] ; 72 | 51: PR[41,2]=PR[41,2]+R[52] ; 73 | 52: PR[41,3]=PR[41,3]+R[53] ; 74 | 53: PR[41,4]=PR[41,4]+R[54] ; 75 | 54: PR[41,5]=PR[41,5]+R[55] ; 76 | 55: PR[41,6]=PR[41,6]+R[56] ; 77 | 56: CALL WEBCHECK ; 78 | 57: IF (F[8]),JMP LBL[999] ; 79 | 58:L PR[41] 50mm/sec CNT100 ; 80 | 59: R[42]=R[42]+1 ; 81 | 60: JMP LBL[5] ; 82 | 61: ; 83 | 62: LBL[6] ; 84 | 63: PR[41,1]=PR[41,1]+R[51] ; 85 | 64: PR[41,2]=PR[41,2]+R[52] ; 86 | 65: PR[41,3]=PR[41,3]+R[53] ; 87 | 66: PR[41,4]=PR[41,4]+R[54] ; 88 | 67: PR[41,5]=PR[41,5]+R[55] ; 89 | 68: PR[41,6]=PR[41,6]+R[56] ; 90 | 69: CALL WEBCHECK ; 91 | 70: IF (F[8]),JMP LBL[999] ; 92 | 71:J PR[41] 5% CNT100 ; 93 | 72: R[42]=R[42]+1 ; 94 | 73: JMP LBL[6] ; 95 | 74: ; 96 | 75: LBL[999] ; 97 | 76: F[1]=(OFF) ; 98 | 77: F[2]=(OFF) ; 99 | 78: F[3]=(OFF) ; 100 | 79: F[4]=(OFF) ; 101 | 80: F[5]=(OFF) ; 102 | 81: F[6]=(OFF) ; 103 | 82: F[7]=(OFF) ; 104 | 83: F[8]=(OFF) ; 105 | 84: R[42]=999 ; 106 | 85: R[51]=0 ; 107 | 86: R[52]=0 ; 108 | 87: R[53]=0 ; 109 | 88: R[54]=0 ; 110 | 89: R[55]=0 ; 111 | 90: R[56]=0 ; 112 | 91: JMP LBL[7] ; 113 | /POS 114 | /END 115 | --------------------------------------------------------------------------------