@@ -24,11 +24,14 @@ import { PowerSensorService } from '../gen/component/powersensor/v1/powersensor_
2424import { ServoService } from '../gen/component/servo/v1/servo_connect' ;
2525import { RobotService } from '../gen/robot/v1/robot_connect' ;
2626import {
27+ // DiscoveryQuery deprecated, remove on march 10th
2728 DiscoveryQuery ,
29+ GetModelsFromModulesRequest ,
2830 RestartModuleRequest ,
2931 TransformPCDRequest ,
3032 TransformPoseRequest ,
3133} from '../gen/robot/v1/robot_pb' ;
34+ import { DiscoveryService } from '../gen/service/discovery/v1/discovery_connect' ;
3235import { MotionService } from '../gen/service/motion/v1/motion_connect' ;
3336import { NavigationService } from '../gen/service/navigation/v1/navigation_connect' ;
3437import { SLAMService } from '../gen/service/slam/v1/slam_connect' ;
@@ -133,6 +136,10 @@ export class RobotClient extends EventDispatcher implements Robot {
133136 | PromiseClient < typeof NavigationService >
134137 | undefined ;
135138
139+ private discoveryServiceClient :
140+ | PromiseClient < typeof DiscoveryService >
141+ | undefined ;
142+
136143 private motionServiceClient : PromiseClient < typeof MotionService > | undefined ;
137144
138145 private visionServiceClient : PromiseClient < typeof VisionService > | undefined ;
@@ -345,6 +352,13 @@ export class RobotClient extends EventDispatcher implements Robot {
345352 return this . navigationServiceClient ;
346353 }
347354
355+ get discoveryService ( ) {
356+ if ( ! this . discoveryServiceClient ) {
357+ throw new Error ( RobotClient . notConnectedYetStr ) ;
358+ }
359+ return this . discoveryServiceClient ;
360+ }
361+
348362 get motionService ( ) {
349363 if ( ! this . motionServiceClient ) {
350364 throw new Error ( RobotClient . notConnectedYetStr ) ;
@@ -603,6 +617,10 @@ export class RobotClient extends EventDispatcher implements Robot {
603617 SLAMService ,
604618 clientTransport
605619 ) ;
620+ this . discoveryServiceClient = createPromiseClient (
621+ DiscoveryService ,
622+ clientTransport
623+ ) ;
606624
607625 this . emit ( MachineConnectionEvent . CONNECTED , { } ) ;
608626 } catch ( error ) {
@@ -692,15 +710,26 @@ export class RobotClient extends EventDispatcher implements Robot {
692710 return resp . pointCloudPcd ;
693711 }
694712
695- // DISCOVERY
713+ // DISCOVERY - deprecated, remove on march 10th
696714
697715 async discoverComponents ( queries : DiscoveryQuery [ ] ) {
716+ console . warn (
717+ 'RobotClient.discoverComponents is deprecated. It will be removed on March 10 2025. Use the DiscoveryService APIs instead.'
718+ ) ;
698719 const resp = await this . robotService . discoverComponents ( {
699720 queries,
700721 } ) ;
701722 return resp . discovery ;
702723 }
703724
725+ // GET MODELS FROM MODULES
726+
727+ async getModelsFromModules ( ) {
728+ const request = new GetModelsFromModulesRequest ( { } ) ;
729+ const resp = await this . robotService . getModelsFromModules ( request ) ;
730+ return resp . models ;
731+ }
732+
704733 // GET CLOUD METADATA
705734
706735 async getCloudMetadata ( ) {
0 commit comments