@@ -35,8 +35,6 @@ namespace sdk {
3535
3636using google::protobuf::RepeatedPtrField;
3737using viam::common::v1::Transform;
38- using viam::robot::v1::Discovery;
39- using viam::robot::v1::DiscoveryQuery;
4038using viam::robot::v1::FrameSystemConfig;
4139using viam::robot::v1::Operation;
4240using viam::robot::v1::RobotService;
@@ -49,28 +47,6 @@ using viam::robot::v1::RobotService;
4947const std::string kStreamRemoved (" Stream removed" );
5048
5149namespace {
52- // TODO: add a traits class for proto to type and back conversion
53- DiscoveryQuery to_proto (const RobotClient::discovery_query& query) {
54- DiscoveryQuery proto;
55- *proto.mutable_subtype () = query.subtype ;
56- *proto.mutable_model () = query.model ;
57- return proto;
58- }
59-
60- RobotClient::discovery_query from_proto (const DiscoveryQuery& proto) {
61- RobotClient::discovery_query query;
62- query.subtype = proto.subtype ();
63- query.model = proto.model ();
64- return query;
65- }
66-
67- RobotClient::discovery from_proto (const Discovery& proto) {
68- RobotClient::discovery discovery;
69- discovery.query = from_proto (proto.query ());
70- discovery.results = v2::from_proto (proto.results ());
71- return discovery;
72- }
73-
7450RobotClient::frame_system_config from_proto (const FrameSystemConfig& proto) {
7551 RobotClient::frame_system_config fsconfig;
7652 fsconfig.frame = v2::from_proto (proto.frame ());
@@ -97,15 +73,6 @@ RobotClient::operation from_proto(const Operation& proto) {
9773}
9874} // namespace
9975
100- bool operator ==(const RobotClient::discovery_query& lhs, const RobotClient::discovery_query& rhs) {
101- return lhs.subtype == rhs.subtype && lhs.model == rhs.model ;
102- }
103-
104- bool operator ==(const RobotClient::discovery& lhs, const RobotClient::discovery& rhs) {
105- return lhs.query == rhs.query && v2::to_proto (lhs.results ).SerializeAsString () ==
106- v2::to_proto (rhs.results ).SerializeAsString ();
107- }
108-
10976bool operator ==(const RobotClient::frame_system_config& lhs,
11077 const RobotClient::frame_system_config& rhs) {
11178 return lhs.frame == rhs.frame && v2::to_proto (lhs.kinematics ).SerializeAsString () ==
@@ -356,32 +323,6 @@ pose_in_frame RobotClient::transform_pose(
356323 return v2::from_proto (resp.pose ());
357324}
358325
359- std::vector<RobotClient::discovery> RobotClient::discover_components (
360- const std::vector<discovery_query>& queries) {
361- viam::robot::v1::DiscoverComponentsRequest req;
362- viam::robot::v1::DiscoverComponentsResponse resp;
363- ClientContext ctx;
364-
365- RepeatedPtrField<DiscoveryQuery>* req_queries = req.mutable_queries ();
366-
367- for (const discovery_query& query : queries) {
368- *req_queries->Add () = to_proto (query);
369- }
370-
371- const grpc::Status response = impl_->stub_ ->DiscoverComponents (ctx, req, &resp);
372- if (is_error_response (response)) {
373- BOOST_LOG_TRIVIAL (error) << " Error discovering components: " << response.error_message ();
374- }
375-
376- std::vector<discovery> components = std::vector<discovery>();
377-
378- for (const Discovery& d : resp.discovery ()) {
379- components.push_back (from_proto (d));
380- }
381-
382- return components;
383- }
384-
385326std::shared_ptr<Resource> RobotClient::resource_by_name (const Name& name) {
386327 return resource_manager_.resource (name.name ());
387328}
0 commit comments