Skip to content

Commit 7b621fc

Browse files
viambotgithub-actions[bot]
authored andcommitted
[WORKFLOW] AI update based on proto changes from commit 66e9d21
1 parent 369de2e commit 7b621fc

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

src/components/gantry/client.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import {
99
MoveToPositionRequest,
1010
StopRequest,
1111
} from '../../gen/component/gantry/v1/gantry_pb';
12+
import { GetGeometriesRequest, GetGeometriesResponse, GetKinematicsRequest, GetKinematicsResponse, KinematicsFileFormat } from '../../gen/common/v1/common_pb';
1213
import type { RobotClient } from '../../robot';
1314
import type { Options } from '../../types';
1415
import { doCommandFromClient } from '../../utils';
1516
import type { Gantry } from './gantry';
16-
import { GetGeometriesRequest } from '../../gen/common/v1/common_pb';
1717

1818
/**
1919
* A gRPC-web client for the Gantry component.
@@ -130,4 +130,23 @@ export class GantryClient implements Gantry {
130130
callOptions
131131
);
132132
}
133-
}
133+
134+
/**
135+
* Get the kinematics of the gantry.
136+
*
137+
* @param extra - Optional object for additional arguments
138+
* @param callOptions - Optional {@link CallOptions} for custom gRPC headers
139+
* @returns The {@link KinematicsFileFormat} of the gantry.
140+
*/
141+
async getKinematics(extra = {}, callOptions = this.callOptions) {
142+
const request = new GetKinematicsRequest({
143+
name: this.name,
144+
extra: Struct.fromJson(extra),
145+
});
146+
147+
this.options.requestLogger?.(request);
148+
149+
const response = await this.client.getKinematics(request, callOptions);
150+
return response.kinematicsData;
151+
}
152+
}

src/components/gantry/gantry.ts

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

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

0 commit comments

Comments
 (0)