@@ -24,11 +24,14 @@ import { PowerSensorService } from '../gen/component/powersensor/v1/powersensor_
24
24
import { ServoService } from '../gen/component/servo/v1/servo_connect' ;
25
25
import { RobotService } from '../gen/robot/v1/robot_connect' ;
26
26
import {
27
+ // DiscoveryQuery deprecated, remove on march 10th
27
28
DiscoveryQuery ,
29
+ GetModelsFromModulesRequest ,
28
30
RestartModuleRequest ,
29
31
TransformPCDRequest ,
30
32
TransformPoseRequest ,
31
33
} from '../gen/robot/v1/robot_pb' ;
34
+ import { DiscoveryService } from '../gen/service/discovery/v1/discovery_connect' ;
32
35
import { MotionService } from '../gen/service/motion/v1/motion_connect' ;
33
36
import { NavigationService } from '../gen/service/navigation/v1/navigation_connect' ;
34
37
import { SLAMService } from '../gen/service/slam/v1/slam_connect' ;
@@ -133,6 +136,10 @@ export class RobotClient extends EventDispatcher implements Robot {
133
136
| PromiseClient < typeof NavigationService >
134
137
| undefined ;
135
138
139
+ private discoveryServiceClient :
140
+ | PromiseClient < typeof DiscoveryService >
141
+ | undefined ;
142
+
136
143
private motionServiceClient : PromiseClient < typeof MotionService > | undefined ;
137
144
138
145
private visionServiceClient : PromiseClient < typeof VisionService > | undefined ;
@@ -345,6 +352,13 @@ export class RobotClient extends EventDispatcher implements Robot {
345
352
return this . navigationServiceClient ;
346
353
}
347
354
355
+ get discoveryService ( ) {
356
+ if ( ! this . discoveryServiceClient ) {
357
+ throw new Error ( RobotClient . notConnectedYetStr ) ;
358
+ }
359
+ return this . discoveryServiceClient ;
360
+ }
361
+
348
362
get motionService ( ) {
349
363
if ( ! this . motionServiceClient ) {
350
364
throw new Error ( RobotClient . notConnectedYetStr ) ;
@@ -603,6 +617,10 @@ export class RobotClient extends EventDispatcher implements Robot {
603
617
SLAMService ,
604
618
clientTransport
605
619
) ;
620
+ this . discoveryServiceClient = createPromiseClient (
621
+ DiscoveryService ,
622
+ clientTransport
623
+ ) ;
606
624
607
625
this . emit ( MachineConnectionEvent . CONNECTED , { } ) ;
608
626
} catch ( error ) {
@@ -692,15 +710,26 @@ export class RobotClient extends EventDispatcher implements Robot {
692
710
return resp . pointCloudPcd ;
693
711
}
694
712
695
- // DISCOVERY
713
+ // DISCOVERY - deprecated, remove on march 10th
696
714
697
715
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
+ ) ;
698
719
const resp = await this . robotService . discoverComponents ( {
699
720
queries,
700
721
} ) ;
701
722
return resp . discovery ;
702
723
}
703
724
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
+
704
733
// GET CLOUD METADATA
705
734
706
735
async getCloudMetadata ( ) {
0 commit comments