From 434712afb96923653b4d719941dad23dad0020c2 Mon Sep 17 00:00:00 2001 From: Matthew MacFarquhar Date: Thu, 6 Nov 2025 11:02:47 -0500 Subject: [PATCH] feat: add get3DModels api for arm client --- api_version.lock | 2 +- src/components/arm/arm.ts | 15 ++++++++++++++- src/components/arm/client.ts | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/api_version.lock b/api_version.lock index 7728a9f96..9af2160ec 100644 --- a/api_version.lock +++ b/api_version.lock @@ -1 +1 @@ -v0.1.484 +v0.1.485 diff --git a/src/components/arm/arm.ts b/src/components/arm/arm.ts index b3e54f710..6efb2ca14 100644 --- a/src/components/arm/arm.ts +++ b/src/components/arm/arm.ts @@ -2,7 +2,7 @@ import type { PlainMessage, Struct } from '@bufbuild/protobuf'; import type { Pose, Resource, Vector3 } from '../../types'; import * as armApi from '../../gen/component/arm/v1/arm_pb'; -import type { Geometry } from '../../gen/common/v1/common_pb'; +import type { Geometry, Mesh } from '../../gen/common/v1/common_pb'; import type { Frame } from '../../gen/app/v1/robot_pb'; export type ArmJointPositions = PlainMessage; @@ -42,6 +42,19 @@ export interface Arm extends Resource { */ getGeometries: (extra?: Struct) => Promise; + /** + * Get the 3D models of the component + * + * @example + * + * ```ts + * const arm = new VIAM.ArmClient(machine, 'my_arm'); + * const models = await arm.get3DModels(); + * console.log(models); + * ``` + */ + get3DModels: (extra?: Struct) => Promise>; + /** * Get the kinematics information associated with the arm. * diff --git a/src/components/arm/client.ts b/src/components/arm/client.ts index ebf3872e7..d48d11829 100644 --- a/src/components/arm/client.ts +++ b/src/components/arm/client.ts @@ -17,6 +17,8 @@ import type { Arm } from './arm'; import { GetGeometriesRequest, GetKinematicsRequest, + Get3DModelsRequest, + Mesh, } from '../../gen/common/v1/common_pb'; /** @@ -62,6 +64,19 @@ export class ArmClient implements Arm { return response.geometries; } + async get3DModels( + extra = {}, + callOptions = this.callOptions + ): Promise> { + const request = new Get3DModelsRequest({ + name: this.name, + extra: Struct.fromJson(extra), + }); + + const response = await this.client.get3DModels(request, callOptions); + return response.models; + } + async getKinematics(extra = {}, callOptions = this.callOptions) { const request = new GetKinematicsRequest({ name: this.name,