Skip to content

Commit ff6f904

Browse files
viambotgithub-actions[bot]
authored andcommitted
[WORKFLOW] AI update based on proto changes from commit c7aa582
1 parent 369de2e commit ff6f904

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

src/components/gantry/client.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import {
1010
StopRequest,
1111
} from '../../gen/component/gantry/v1/gantry_pb';
1212
import type { RobotClient } from '../../robot';
13-
import type { Options } from '../../types';
13+
import type { Options, KinematicsFileFormat } from '../../types';
1414
import { doCommandFromClient } from '../../utils';
1515
import type { Gantry } from './gantry';
16-
import { GetGeometriesRequest } from '../../gen/common/v1/common_pb';
16+
import { GetGeometriesRequest, GetKinematicsRequest, GetKinematicsResponse } from '../../gen/common/v1/common_pb';
1717

1818
/**
1919
* A gRPC-web client for the Gantry component.
@@ -118,6 +118,25 @@ export class GantryClient implements Gantry {
118118
return resp.isMoving;
119119
}
120120

121+
/**
122+
* Get the kinematics for the gantry.
123+
*
124+
* @param extra - Any additional parameters to send to the server.
125+
* @param callOptions - Options for the gRPC call.
126+
* @returns The kinematics for the gantry.
127+
*/
128+
async getKinematics(extra: JsonValue = {}, callOptions = this.callOptions): Promise<KinematicsFileFormat> {
129+
const request = new GetKinematicsRequest({
130+
name: this.name,
131+
extra: Struct.fromJson(extra),
132+
});
133+
134+
this.options.requestLogger?.(request);
135+
136+
const resp = await this.client.getKinematics(request, callOptions);
137+
return resp.kinematicsFileFormat!;
138+
}
139+
121140
async doCommand(
122141
command: Struct,
123142
callOptions = this.callOptions

src/components/gantry/gantry.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Struct } from '@bufbuild/protobuf';
2-
import type { Resource } from '../../types';
2+
import type { Resource, KinematicsFileFormat } from '../../types';
33
import type { Geometry } from '../../gen/common/v1/common_pb';
44

55
/** Represents a physical gantry that exists in three-dimensional space. */
@@ -144,4 +144,21 @@ export interface Gantry extends Resource {
144144
* API](https://docs.viam.com/dev/reference/apis/components/gantry/#ismoving).
145145
*/
146146
isMoving: () => Promise<boolean>;
147+
148+
/**
149+
* Get the KinematicFileFormat of the component in its current configuration.
150+
*
151+
* @example
152+
*
153+
* ```ts
154+
* const gantry = new VIAM.GantryClient(machine, 'my_gantry');
155+
*
156+
* // Get the KinematicFileFormat of this component
157+
* const kinematics = await gantry.getKinematics();
158+
* ```
159+
*
160+
* For more information, see [Gantry
161+
* API](https://docs.viam.com/dev/reference/apis/components/gantry/#getkinematics).
162+
*/
163+
getKinematics: (extra?: Struct) => Promise<KinematicsFileFormat>;
147164
}

src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export type GeoGeometry = PlainMessage<commonApi.GeoGeometry>;
3838
export type GeoPoint = PlainMessage<commonApi.GeoPoint>;
3939
export type GeometriesInFrame = PlainMessage<commonApi.GeometriesInFrame>;
4040
export type Geometry = PlainMessage<commonApi.Geometry>;
41+
export type KinematicsFileFormat = PlainMessage<commonApi.KinematicsFileFormat>;
4142
export type Orientation = PlainMessage<commonApi.Orientation>;
4243
export type PointCloud = PlainMessage<commonApi.PointCloud>;
4344
export type Pose = PlainMessage<commonApi.Pose>;
@@ -55,6 +56,7 @@ export const {
5556
GeoPoint,
5657
GeometriesInFrame,
5758
Geometry,
59+
KinematicsFileFormat,
5860
Orientation,
5961
PointCloud,
6062
Pose,

0 commit comments

Comments
 (0)