-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Update jogging panel to API v2 #404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wandeljan
wants to merge
4
commits into
main
Choose a base branch
from
feat/upgrade-jogging-to-v2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| ## JoggerConnection | ||
|
|
||
| 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. | ||
|
|
||
| ```ts | ||
| import { NovaClient, JoggerConnection } from "@wandelbots/nova-js/v2" | ||
|
|
||
| const nova = new NovaClient({ instanceUrl: "nova-instance-url" }) | ||
| const jogger = await JoggerConnection.open(nova, `some-motion-group-id`) // or to set options | ||
| // const jogger = await JoggerConnection.open(nova, `some-motion-group-id`), options) | ||
| ``` | ||
|
|
||
| The jogger's mode is set to "off" first. You'll need to set it to "jogging" or "trajectory" to be able to | ||
| send movement commands | ||
|
|
||
| ```ts | ||
| // Set jogger to "jogging" mode and sends InitializeJoggingRequest to API | ||
| await jogger.setJoggingMode("jogging") | ||
|
|
||
| // You can update options ater initializing like this: | ||
| await jogger.setOptions({ | ||
| tcp: "Flange", // TCP id | ||
| timeout: 3000 // How long the promise should wait when server does not respond to init request | ||
| orientation: "tool", | ||
| }) | ||
|
|
||
| // For planned motions, use "trajectory" mode | ||
| await jogger.setJoggingMode("trajectory") | ||
| await jogger.rotateTCP({...}) // Error: Continuous jogging websocket not connected; ... | ||
| await jogger.runIncrementalCartesianMotion({...}) // Plan and run trajectory | ||
| ``` | ||
|
|
||
| ### Stopping the jogger | ||
|
|
||
| For safety purposes, let's first consider how to stop the jogger. Calling stop will stop all motion types regardless of mode: | ||
|
|
||
| ```ts | ||
| await jogger.stop() | ||
| ``` | ||
|
|
||
| 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. | ||
|
|
||
| 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! | ||
|
|
||
| ### Jogging: Rotating a joint `rotateJoints` | ||
|
|
||
| This example starts joint 0 of the robot rotating in a positive direction at 1 radian per second: | ||
|
|
||
| ```ts | ||
| await jogger.rotateJoints({ | ||
| joint: 0, | ||
| direction: "+", | ||
| velocityRadsPerSec: 1, | ||
| }) | ||
| ``` | ||
|
|
||
| ### Jogging: Moving a TCP `translateTCP` | ||
|
|
||
| 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: | ||
|
|
||
| ```ts | ||
| await jogger.translateTCP({ | ||
| axis: "x", | ||
| direction: "+", | ||
| velocityMmPerSec: 10, | ||
| }) | ||
| ``` | ||
|
|
||
| ### Jogging: Rotating a TCP `rotateTCP` | ||
|
|
||
| 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: | ||
|
|
||
| ```ts | ||
| await jogger.rotateTCP({ | ||
| axis: "x", | ||
| direction: "+", | ||
| velocityRadsPerSec: 1, | ||
| }) | ||
| ``` | ||
|
|
||
| ### Trajectory: Plan and run incremental motion `runIncrementalCartesianMotion` | ||
|
|
||
| ```ts | ||
| await jogger.runIncrementalCartesianMotion({...}) | ||
| ``` | ||
|
|
||
| ### Post-jogging cleanup | ||
|
|
||
| When you are done with a jogger, make sure to call dispose: | ||
|
|
||
| ```ts | ||
| await jogger.dispose() | ||
| ``` | ||
|
|
||
| This will close any open websockets and ensure things are left in a good state. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| ## Connect to a motion group | ||
|
|
||
| The library provides an easy to use way to access properties of a motion group. | ||
|
|
||
| ```ts | ||
| import { NovaClient, ConnectedMotionGroup } from "@wandelbots/nova-js/v2" | ||
|
|
||
| const nova = new NovaClient({ instanceUrl: "nova-instance-url" }) | ||
| const activeRobot = await ConnectedMotionGroup.connect(nova, "motion-group-id") | ||
| ``` | ||
|
|
||
| This connected motion group opens a websocket and listens to changes of the current joints and the TCP pose. You can read out those values by using the `rapidlyChangingMotionState` of the object. Along other properties it also provides the current `safetySetup` and `tcps`. | ||
|
|
||
| ```ts | ||
| const newJoints = activeRobot.rapidlyChangingMotionState.joint_position | ||
| ``` | ||
|
|
||
| **Api V2 change:** Please not that joints are now directly accessible in `rapidlyChangingMotionState.joint_position`, previously there were nested in `.rapidlyChangingMotionState.state.joint_position.joints`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.