@@ -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;
@@ -48,28 +46,6 @@ using viam::robot::v1::RobotService;
4846// NOLINTNEXTLINE
4947const std::string kStreamRemoved (" Stream removed" );
5048
51- // TODO: add a traits class for proto to type and back conversion
52- DiscoveryQuery to_proto (const RobotClient::discovery_query& query) {
53- DiscoveryQuery proto;
54- *proto.mutable_subtype () = query.subtype ;
55- *proto.mutable_model () = query.model ;
56- return proto;
57- }
58-
59- RobotClient::discovery_query from_proto (const DiscoveryQuery& proto) {
60- RobotClient::discovery_query query;
61- query.subtype = proto.subtype ();
62- query.model = proto.model ();
63- return query;
64- }
65-
66- RobotClient::discovery from_proto (const Discovery& proto) {
67- RobotClient::discovery discovery;
68- discovery.query = from_proto (proto.query ());
69- discovery.results = from_proto (proto.results ());
70- return discovery;
71- }
72-
7349RobotClient::frame_system_config from_proto (const FrameSystemConfig& proto) {
7450 RobotClient::frame_system_config fsconfig;
7551 fsconfig.frame = from_proto (proto.frame ());
@@ -95,15 +71,6 @@ RobotClient::operation from_proto(const Operation& proto) {
9571 return op;
9672}
9773
98- bool operator ==(const RobotClient::discovery_query& lhs, const RobotClient::discovery_query& rhs) {
99- return lhs.subtype == rhs.subtype && lhs.model == rhs.model ;
100- }
101-
102- bool operator ==(const RobotClient::discovery& lhs, const RobotClient::discovery& rhs) {
103- return lhs.query == rhs.query &&
104- to_proto (lhs.results ).SerializeAsString () == to_proto (rhs.results ).SerializeAsString ();
105- }
106-
10774bool operator ==(const RobotClient::frame_system_config& lhs,
10875 const RobotClient::frame_system_config& rhs) {
10976 return lhs.frame == rhs.frame && to_proto (lhs.kinematics ).SerializeAsString () ==
@@ -354,32 +321,6 @@ pose_in_frame RobotClient::transform_pose(
354321 return from_proto (resp.pose ());
355322}
356323
357- std::vector<RobotClient::discovery> RobotClient::discover_components (
358- const std::vector<discovery_query>& queries) {
359- viam::robot::v1::DiscoverComponentsRequest req;
360- viam::robot::v1::DiscoverComponentsResponse resp;
361- ClientContext ctx;
362-
363- RepeatedPtrField<DiscoveryQuery>* req_queries = req.mutable_queries ();
364-
365- for (const discovery_query& query : queries) {
366- *req_queries->Add () = to_proto (query);
367- }
368-
369- const grpc::Status response = impl_->stub_ ->DiscoverComponents (ctx, req, &resp);
370- if (is_error_response (response)) {
371- BOOST_LOG_TRIVIAL (error) << " Error discovering components: " << response.error_message ();
372- }
373-
374- std::vector<discovery> components = std::vector<discovery>();
375-
376- for (const Discovery& d : resp.discovery ()) {
377- components.push_back (from_proto (d));
378- }
379-
380- return components;
381- }
382-
383324std::shared_ptr<Resource> RobotClient::resource_by_name (const Name& name) {
384325 return resource_manager_.resource (name.name ());
385326}
0 commit comments