|
| 1 | +## JoggerConnection |
| 2 | + |
| 3 | +Jogging in a robotics context generally refers to the manual movement of the robot via direct human input. The Wandelbots platform provides websocket-based jogging methods which can be used to build similar jogging interfaces to those found on teach pendants. |
| 4 | + |
| 5 | +```ts |
| 6 | +const jogger = await nova.connectJogger(`some-motion-group-id`) // or to set options |
| 7 | +// const jogger = await nova.connectJogger(`some-motion-group-id`, { options }) |
| 8 | +``` |
| 9 | + |
| 10 | +The jogger's mode is set to "off" first. You'll need to set it to "jogging" or "trajectory" to be able to |
| 11 | +send movement commands |
| 12 | + |
| 13 | +```ts |
| 14 | +// Set jogger to "jogging" mode and sends InitializeJoggingRequest to API |
| 15 | +await jogger.setJoggingMode("jogging") |
| 16 | + |
| 17 | +// You can update options ater initializing like this: |
| 18 | +await jogger.setOptions({ |
| 19 | + tcp: "Flange", // TCP id |
| 20 | + timeout: 3000 // How long the promise should wait when server does not respond to init request |
| 21 | + orientation: "tool", |
| 22 | +}) |
| 23 | + |
| 24 | +// For planned motions, use "trajectory" mode |
| 25 | +await jogger.setJoggingMode("trajectory") |
| 26 | +await jogger.rotateTCP({...}) // Error: Continuous jogging websocket not connected; ... |
| 27 | +await jogger.runIncrementalCartesianMotion({...}) // Plan and run trajectory |
| 28 | +``` |
| 29 | + |
| 30 | +### Stopping the jogger |
| 31 | + |
| 32 | +For safety purposes, let's first consider how to stop the jogger. Calling stop will stop all motion types regardless of mode: |
| 33 | + |
| 34 | +```ts |
| 35 | +await jogger.stop() |
| 36 | +``` |
| 37 | + |
| 38 | +As a failsafe, the server will also stop any jogging motions when it detects the relevant websocket has been closed. This means that if e.g. the network connection drops out or the browser tab is closed in the middle of a motion, it will stop automatically. |
| 39 | + |
| 40 | +However, you should never totally rely on any software being able to stop the robot: always have the hardware emergency stop button within reach just in case! |
| 41 | + |
| 42 | +### Jogging: Rotating a joint `rotateJoints` |
| 43 | + |
| 44 | +This example starts joint 0 of the robot rotating in a positive direction at 1 radian per second: |
| 45 | + |
| 46 | +```ts |
| 47 | +await jogger.rotateJoints({ |
| 48 | + joint: 0, |
| 49 | + direction: "+", |
| 50 | + velocityRadsPerSec: 1, |
| 51 | +}) |
| 52 | +``` |
| 53 | + |
| 54 | +### Jogging: Moving a TCP `translateTCP` |
| 55 | + |
| 56 | +This example starts moving a TCP in a positive direction along the X axis of the specified coordinate system, at a velocity of 10 millimeters per second: |
| 57 | + |
| 58 | +```ts |
| 59 | +await jogger.translateTCP({ |
| 60 | + axis: "x", |
| 61 | + direction: "+", |
| 62 | + velocityMmPerSec: 10, |
| 63 | +}) |
| 64 | +``` |
| 65 | + |
| 66 | +### Jogging: Rotating a TCP `rotateTCP` |
| 67 | + |
| 68 | +This example starts rotating the TCP in a positive direction around the X axis of the specified coordinate system, at a velocity of 1 radians per second: |
| 69 | + |
| 70 | +```ts |
| 71 | +await jogger.rotateTCP({ |
| 72 | + axis: "x", |
| 73 | + direction: "+", |
| 74 | + velocityRadsPerSec: 1, |
| 75 | +}) |
| 76 | +``` |
| 77 | + |
| 78 | +### Trajectory: Plan and run incremental motion `runIncrementalCartesianMotion` |
| 79 | + |
| 80 | +```ts |
| 81 | +await jogger.runIncrementalCartesianMotion({...}) |
| 82 | +``` |
| 83 | + |
| 84 | +### Post-jogging cleanup |
| 85 | + |
| 86 | +When you are done with a jogger, make sure to call dispose: |
| 87 | + |
| 88 | +```ts |
| 89 | +await jogger.dispose() |
| 90 | +``` |
| 91 | + |
| 92 | +This will close any open websockets and ensure things are left in a good state. |
0 commit comments