@viamrobotics/sdk 0.0.24 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/arm/Arm.d.ts +22 -14
- package/dist/components/arm/Client.d.ts +16 -8
- package/dist/main.es.js +24 -12
- package/dist/main.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,28 +1,36 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WorldState } from '../../gen/common/v1/common_pb.esm';
|
|
2
2
|
import type { JointPositions } from '../../gen/component/arm/v1/arm_pb.esm';
|
|
3
|
-
import type { Extra } from '../../types';
|
|
3
|
+
import type { Extra, Pose } from '../../types';
|
|
4
4
|
/** Represents a physical robot arm that exists in three-dimensional space. */
|
|
5
5
|
export interface Arm {
|
|
6
6
|
/** Get the position of the end of the arm expressed as a pose */
|
|
7
|
-
|
|
7
|
+
getEndPosition: (extra?: Extra) => Promise<Pose>;
|
|
8
8
|
/**
|
|
9
|
-
* Move the end of the arm to the pose, avoiding obstacles in the worldstate
|
|
9
|
+
* Move the end of the arm to the pose, avoiding obstacles in the worldstate.
|
|
10
10
|
*
|
|
11
11
|
* @param pose - The destination pose for the arm
|
|
12
12
|
* @param world - The obstacles for the arm to avoid
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
moveToPosition: (pose: Pose, world?: WorldState, extra?: Extra) => Promise<void>;
|
|
15
15
|
/**
|
|
16
|
-
* Move each joint of the arm based on the angles on the joint poisitons
|
|
16
|
+
* Move each joint of the arm based on the angles on the joint poisitons.
|
|
17
17
|
* parameter
|
|
18
18
|
*
|
|
19
|
-
* @param
|
|
19
|
+
* @param jointPositionsList - List of angles (0-360) to move each joint to.
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
moveToJointPositions: (jointPositionsList: number[], extra?: Extra) => Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
*Gets the current position of each joint.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
getJointPositions: (extra: Extra) => Promise<JointPositions>;
|
|
27
|
+
/**
|
|
28
|
+
* Stops the motion of the arm.
|
|
29
|
+
* */
|
|
30
|
+
stop: (extra: Extra) => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* Get if the arm is currently moving.
|
|
34
|
+
*/
|
|
35
|
+
isMoving: () => Promise<boolean>;
|
|
28
36
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Pose, WorldState } from '../../gen/common/v1/common_pb.esm';
|
|
2
1
|
import type Client from '../../Client';
|
|
3
2
|
import pb from '../../gen/component/arm/v1/arm_pb.esm';
|
|
4
|
-
import type { Options } from '../../types';
|
|
3
|
+
import type { Options, Pose } from '../../types';
|
|
5
4
|
import type { Arm } from './Arm';
|
|
5
|
+
import commonPB from '../../gen/common/v1/common_pb.esm';
|
|
6
6
|
/** A gRPC-web client for the Arm component. */
|
|
7
7
|
export declare class ArmClient implements Arm {
|
|
8
8
|
private client;
|
|
@@ -10,10 +10,18 @@ export declare class ArmClient implements Arm {
|
|
|
10
10
|
private readonly options;
|
|
11
11
|
constructor(client: Client, name: string, options?: Options);
|
|
12
12
|
private get ArmService();
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
getEndPosition(extra?: {}): Promise<{
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
z: number;
|
|
17
|
+
ox: number;
|
|
18
|
+
oy: number;
|
|
19
|
+
oz: number;
|
|
20
|
+
theta: number;
|
|
21
|
+
}>;
|
|
22
|
+
moveToPosition(pose: Pose, world?: commonPB.WorldState, extra?: {}): Promise<void>;
|
|
23
|
+
moveToJointPositions(jointPositionsList: number[], extra?: {}): Promise<void>;
|
|
24
|
+
getJointPositions(extra?: {}): Promise<pb.JointPositions>;
|
|
25
|
+
stop(extra?: {}): Promise<void>;
|
|
26
|
+
isMoving(): Promise<boolean>;
|
|
19
27
|
}
|
package/dist/main.es.js
CHANGED
|
@@ -419093,26 +419093,38 @@ class ArmClient {
|
|
|
419093
419093
|
get ArmService() {
|
|
419094
419094
|
return this.client;
|
|
419095
419095
|
}
|
|
419096
|
-
async
|
|
419096
|
+
async getEndPosition(e = {}) {
|
|
419097
419097
|
const r = this.ArmService, p = new arm_pb.GetEndPositionRequest();
|
|
419098
419098
|
p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p);
|
|
419099
419099
|
const n = (await promisify(r.getEndPosition.bind(r), p)).getPose();
|
|
419100
419100
|
if (!n)
|
|
419101
419101
|
throw new Error("no pose");
|
|
419102
|
-
return
|
|
419102
|
+
return {
|
|
419103
|
+
x: n.getX(),
|
|
419104
|
+
y: n.getY(),
|
|
419105
|
+
z: n.getZ(),
|
|
419106
|
+
ox: n.getOX(),
|
|
419107
|
+
oy: n.getOY(),
|
|
419108
|
+
oz: n.getOZ(),
|
|
419109
|
+
theta: n.getTheta()
|
|
419110
|
+
};
|
|
419103
419111
|
}
|
|
419104
|
-
async
|
|
419105
|
-
const t = this.ArmService, n = new
|
|
419106
|
-
n.
|
|
419112
|
+
async moveToPosition(e, r, p = {}) {
|
|
419113
|
+
const t = this.ArmService, n = new common_pb$e.Pose();
|
|
419114
|
+
n.setX(e.x), n.setY(e.y), n.setZ(e.z), n.setOX(e.ox), n.setOY(e.oy), n.setOZ(e.oz), n.setTheta(e.theta);
|
|
419115
|
+
const i = new arm_pb.MoveToPositionRequest();
|
|
419116
|
+
i.setName(this.name), i.setTo(n), i.setWorldState(r), i.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(i), await promisify(
|
|
419107
419117
|
t.moveToPosition.bind(t),
|
|
419108
|
-
|
|
419118
|
+
i
|
|
419109
419119
|
);
|
|
419110
419120
|
}
|
|
419111
|
-
async
|
|
419112
|
-
const p = this.ArmService, t = new arm_pb.
|
|
419113
|
-
t.
|
|
419121
|
+
async moveToJointPositions(e, r = {}) {
|
|
419122
|
+
const p = this.ArmService, t = new arm_pb.JointPositions();
|
|
419123
|
+
t.setValuesList(e);
|
|
419124
|
+
const n = new arm_pb.MoveToJointPositionsRequest();
|
|
419125
|
+
n.setName(this.name), n.setPositions(t), n.setExtra(struct_pb$2.Struct.fromJavaScript(r)), this.options.requestLogger?.(n), await promisify(p.moveToJointPositions.bind(p), n);
|
|
419114
419126
|
}
|
|
419115
|
-
async
|
|
419127
|
+
async getJointPositions(e = {}) {
|
|
419116
419128
|
const r = this.ArmService, p = new arm_pb.GetJointPositionsRequest();
|
|
419117
419129
|
p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p);
|
|
419118
419130
|
const n = (await promisify(r.getJointPositions.bind(r), p)).getPositions();
|
|
@@ -419120,14 +419132,14 @@ class ArmClient {
|
|
|
419120
419132
|
throw new Error("no pose");
|
|
419121
419133
|
return n;
|
|
419122
419134
|
}
|
|
419123
|
-
async
|
|
419135
|
+
async stop(e = {}) {
|
|
419124
419136
|
const r = this.ArmService, p = new arm_pb.StopRequest();
|
|
419125
419137
|
p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p), await promisify(
|
|
419126
419138
|
r.getJointPositions.bind(r),
|
|
419127
419139
|
p
|
|
419128
419140
|
);
|
|
419129
419141
|
}
|
|
419130
|
-
async
|
|
419142
|
+
async isMoving() {
|
|
419131
419143
|
const e = this.ArmService, r = new arm_pb.IsMovingRequest();
|
|
419132
419144
|
return this.options.requestLogger?.(r), (await promisify(
|
|
419133
419145
|
e.isMoving.bind(e),
|