Skip to content

Commit f5c3190

Browse files
viambotlia-viam
andauthored
Automated Protos Update (#486)
Co-authored-by: lia-viam <[email protected]> Co-authored-by: Lia Stratopoulos <[email protected]>
1 parent 0220e23 commit f5c3190

File tree

14 files changed

+4526
-1494
lines changed

14 files changed

+4526
-1494
lines changed

src/viam/api/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ set_target_properties(
417417
)
418418

419419
target_include_directories(viamapi
420+
SYSTEM
420421
PUBLIC
421422
# Unfortunately, the generated protos don't say 'viam/api' at
422423
# the beginning so we need the subdirectory include path so the

src/viam/api/api_proto_tag.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.1.475
1+

src/viam/api/app/v1/billing.pb.cc

Lines changed: 912 additions & 173 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/viam/api/app/v1/billing.pb.h

Lines changed: 887 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/viam/api/buf.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ deps:
88
- remote: buf.build
99
owner: viamrobotics
1010
repository: api
11-
commit: 62132a8359d946918eb4169b339a0f3a
11+
commit: 76735db689f9436182a51cc4f94efd59
1212
- remote: buf.build
1313
owner: viamrobotics
1414
repository: goutils

src/viam/api/service/motion/v1/motion.pb.cc

Lines changed: 1181 additions & 554 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/viam/api/service/motion/v1/motion.pb.h

Lines changed: 1426 additions & 634 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/viam/sdk/services/motion.hpp

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ namespace sdk {
2222
/// @ingroup Motion
2323
struct obstacle_detector {
2424
/// @brief The name of the vision service to be used for obstacle detection.
25-
Name vision_service;
25+
std::string vision_service;
26+
2627
/// @brief The name of the camera component to be used for obstacle detection.
27-
Name camera;
28+
std::string camera;
2829

2930
friend bool operator==(const obstacle_detector& lhs, const obstacle_detector& rhs);
3031
friend std::ostream& operator<<(std::ostream& os, const obstacle_detector& v);
@@ -102,7 +103,7 @@ class Motion : public Service {
102103
std::string plan_id;
103104

104105
/// @brief The component to be moved. Used for tracking and stopping.
105-
Name component_name;
106+
std::string component_name;
106107

107108
/// @brief The unique ID which identifies the plan execution.
108109
std::string execution_id;
@@ -126,7 +127,7 @@ class Motion : public Service {
126127
std::string id;
127128

128129
/// @brief The component requested to be moved. Used for tracking and stopping.
129-
Name component_name;
130+
std::string component_name;
130131

131132
/// @brief The unique ID which identifies the execution.
132133
/// Multiple plans can share the same execution_id if they were generated due to replanning.
@@ -198,7 +199,7 @@ class Motion : public Service {
198199
/// @param constraints Constraints to apply to how the robot will move.
199200
/// @return Whether or not the move was successful.
200201
inline bool move(const pose_in_frame& destination,
201-
const Name& name,
202+
const std::string& name,
202203
const std::shared_ptr<WorldState>& world_state,
203204
const std::shared_ptr<constraints>& constraints) {
204205
return move(destination, name, world_state, constraints, {});
@@ -213,7 +214,7 @@ class Motion : public Service {
213214
/// @param extra Any additional arguments to the method.
214215
/// @return Whether or not the move was successful.
215216
virtual bool move(const pose_in_frame& destination,
216-
const Name& name,
217+
const std::string& name,
217218
const std::shared_ptr<WorldState>& world_state,
218219
const std::shared_ptr<constraints>& constraints,
219220
const ProtoStruct& extra) = 0;
@@ -226,8 +227,8 @@ class Motion : public Service {
226227
/// @return The execution ID of the move_on_map request.
227228
inline std::string move_on_map(
228229
const pose& destination,
229-
const Name& component_name,
230-
const Name& slam_name,
230+
const std::string& component_name,
231+
const std::string& slam_name,
231232
const std::shared_ptr<motion_configuration>& motion_configuration,
232233
const std::vector<GeometryConfig>& obstacles) {
233234
return move_on_map(
@@ -243,8 +244,8 @@ class Motion : public Service {
243244
/// @return The execution ID of the move_on_map request.
244245
virtual std::string move_on_map(
245246
const pose& destination,
246-
const Name& component_name,
247-
const Name& slam_name,
247+
const std::string& component_name,
248+
const std::string& slam_name,
248249
const std::shared_ptr<motion_configuration>& motion_configuration,
249250
const std::vector<GeometryConfig>& obstacles,
250251
const ProtoStruct& extra) = 0;
@@ -262,8 +263,8 @@ class Motion : public Service {
262263
inline std::string move_on_globe(
263264
const geo_point& destination,
264265
const boost::optional<double>& heading,
265-
const Name& component_name,
266-
const Name& movement_sensor_name,
266+
const std::string& component_name,
267+
const std::string& movement_sensor_name,
267268
const std::vector<geo_geometry>& obstacles,
268269
const std::shared_ptr<motion_configuration>& motion_configuration,
269270
const std::vector<geo_geometry>& bounding_regions) {
@@ -291,8 +292,8 @@ class Motion : public Service {
291292
virtual std::string move_on_globe(
292293
const geo_point& destination,
293294
const boost::optional<double>& heading,
294-
const Name& component_name,
295-
const Name& movement_sensor_name,
295+
const std::string& component_name,
296+
const std::string& movement_sensor_name,
296297
const std::vector<geo_geometry>& obstacles,
297298
const std::shared_ptr<motion_configuration>& motion_configuration,
298299
const std::vector<geo_geometry>& bounding_regions,
@@ -306,7 +307,7 @@ class Motion : public Service {
306307
/// needed to compute the component's pose.
307308
/// @return The pose of the component.
308309
inline pose_in_frame get_pose(
309-
const Name& component_name,
310+
const std::string& component_name,
310311
const std::string& destination_frame,
311312
const std::vector<WorldState::transform>& supplemental_transforms) {
312313
return get_pose(component_name, destination_frame, supplemental_transforms, {});
@@ -321,28 +322,28 @@ class Motion : public Service {
321322
/// @param extra Any additional arguments to the method.
322323
/// @return The pose of the component.
323324
virtual pose_in_frame get_pose(
324-
const Name& component_name,
325+
const std::string& component_name,
325326
const std::string& destination_frame,
326327
const std::vector<WorldState::transform>& supplemental_transforms,
327328
const ProtoStruct& extra) = 0;
328329

329330
/// @brief Stop a currently executing motion plan.
330331
/// @param component_name the component of the currently executing plan to stop.
331-
inline void stop_plan(const Name& component_name) {
332+
inline void stop_plan(const std::string& component_name) {
332333
return stop_plan(component_name, {});
333334
}
334335

335336
/// @brief Stop a currently executing motion plan.
336337
/// @param component_name the component of the currently executing plan to stop.
337338
/// @param extra Any additional arguments to the method.
338-
virtual void stop_plan(const Name& component_name, const ProtoStruct& extra) = 0;
339+
virtual void stop_plan(const std::string& component_name, const ProtoStruct& extra) = 0;
339340

340341
/// @brief Returns the plan and state history of the most recent execution to move a component.
341342
/// Returns a result if the last execution is still executing, or changed state within the last
342343
/// 24 hours without an intervening robot reinitialization.
343344
/// @param component_name The name of the component which the MoveOnGlobe request asked to move.
344345
/// @return the plan and status of the most recent execution to move the requested component
345-
inline plan_with_status get_latest_plan(const Name& component_name) {
346+
inline plan_with_status get_latest_plan(const std::string& component_name) {
346347
return get_latest_plan(component_name, {});
347348
}
348349

@@ -352,7 +353,7 @@ class Motion : public Service {
352353
/// @param component_name The name of the component which the MoveOnGlobe request asked to move.
353354
/// @param extra Any additional arguments to the method.
354355
/// @return the plan and status of the most recent execution to move the requested component
355-
virtual plan_with_status get_latest_plan(const Name& component_name,
356+
virtual plan_with_status get_latest_plan(const std::string& component_name,
356357
const ProtoStruct& extra) = 0;
357358

358359
/// @brief Returns the plan, state history, and replan history of the most recent execution to
@@ -362,7 +363,7 @@ class Motion : public Service {
362363
/// @return a pair of (1) the plan and status and (2) the replan history of the most recent
363364
/// execution to move the requested component
364365
inline std::pair<plan_with_status, std::vector<plan_with_status>>
365-
get_latest_plan_with_replan_history(Name component_name) {
366+
get_latest_plan_with_replan_history(const std::string& component_name) {
366367
return get_latest_plan_with_replan_history(component_name, {});
367368
}
368369

@@ -374,15 +375,17 @@ class Motion : public Service {
374375
/// @return a pair of (1) the plan and status and (2) the replan history of the most recent
375376
/// execution to move the requested component
376377
virtual std::pair<plan_with_status, std::vector<plan_with_status>>
377-
get_latest_plan_with_replan_history(const Name& component_name, const ProtoStruct& extra) = 0;
378+
get_latest_plan_with_replan_history(const std::string& component_name,
379+
const ProtoStruct& extra) = 0;
378380

379381
/// @brief Returns the plan and state history of the requested plan. Returns a result
380382
/// if the last execution is still executing, or changed state within the last 24 hours
381383
/// without an intervening robot reinitialization.
382384
/// @param component_name The name of the component which the MoveOnGlobe request asked to move.
383385
/// @param execution_id The execution id of the requested plan.
384386
/// @return the plan and status of the requested execution's move the requested component
385-
inline plan_with_status get_plan(const Name& component_name, const std::string& execution_id) {
387+
inline plan_with_status get_plan(const std::string& component_name,
388+
const std::string& execution_id) {
386389
return get_plan(component_name, execution_id, {});
387390
}
388391

@@ -393,7 +396,7 @@ class Motion : public Service {
393396
/// @param execution_id The execution id of the requested plan.
394397
/// @param extra Any additional arguments to the method.
395398
/// @return the plan and status of the requested execution's move the requested component
396-
virtual plan_with_status get_plan(const Name& component_name,
399+
virtual plan_with_status get_plan(const std::string& component_name,
397400
const std::string& execution_id,
398401
const ProtoStruct& extra) = 0;
399402

@@ -405,7 +408,7 @@ class Motion : public Service {
405408
/// @return a pair of (1) the plan and status and (2) the replan history of the most recent
406409
/// execution to move the requested component
407410
inline std::pair<plan_with_status, std::vector<plan_with_status>> get_plan_with_replan_history(
408-
const Name& component_name, const std::string& execution_id) {
411+
const std::string& component_name, const std::string& execution_id) {
409412
return get_plan_with_replan_history(component_name, execution_id, {});
410413
}
411414

@@ -418,7 +421,9 @@ class Motion : public Service {
418421
/// @return a pair of (1) the plan and status and (2) the replan history of the most recent
419422
/// execution to move the requested component
420423
virtual std::pair<plan_with_status, std::vector<plan_with_status>> get_plan_with_replan_history(
421-
const Name& component_name, const std::string& execution_id, const ProtoStruct& extra) = 0;
424+
const std::string& component_name,
425+
const std::string& execution_id,
426+
const ProtoStruct& extra) = 0;
422427

423428
/// @brief Returns the status of plans created by MoveOnGlobe requests.
424429
/// Includes statuses of plans that are executing, or are part of an executing that changed

src/viam/sdk/services/private/motion_client.cpp

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ using sdk::to_proto;
2222

2323
service::motion::v1::ObstacleDetector to_proto(const obstacle_detector& od) {
2424
service::motion::v1::ObstacleDetector proto;
25-
*proto.mutable_vision_service() = to_proto(od.vision_service);
26-
*proto.mutable_camera() = to_proto(od.camera);
25+
*proto.mutable_vision_service() = od.vision_service;
26+
*proto.mutable_camera() = od.camera;
2727
return proto;
2828
}
2929

@@ -130,7 +130,7 @@ std::vector<Motion::plan_status> from_proto(
130130
Motion::plan_status_with_id from_proto(const service::motion::v1::PlanStatusWithID& proto) {
131131
Motion::plan_status_with_id pswi;
132132
pswi.execution_id = proto.execution_id();
133-
pswi.component_name = from_proto(proto.component_name());
133+
pswi.component_name = proto.component_name();
134134
pswi.plan_id = proto.plan_id();
135135
pswi.status = from_proto(proto.status());
136136

@@ -155,7 +155,7 @@ Motion::plan plan_from_proto(const service::motion::v1::Plan& proto) {
155155
Motion::plan plan;
156156
plan.id = proto.id();
157157
plan.execution_id = proto.execution_id();
158-
plan.component_name = from_proto(proto.component_name());
158+
plan.component_name = proto.component_name();
159159
plan.steps = steps_from_proto(proto.steps());
160160
return plan;
161161
}
@@ -184,14 +184,14 @@ MotionClient::MotionClient(std::string name, std::shared_ptr<grpc::Channel> chan
184184
channel_(std::move(channel)) {}
185185

186186
bool MotionClient::move(const pose_in_frame& destination,
187-
const Name& component_name,
187+
const std::string& component_name,
188188
const std::shared_ptr<WorldState>& world_state,
189189
const std::shared_ptr<Motion::constraints>& constraints,
190190
const ProtoStruct& extra) {
191191
return make_client_helper(this, *stub_, &StubType::Move)
192192
.with(extra,
193193
[&](auto& request) {
194-
*request.mutable_component_name() = to_proto(component_name);
194+
*request.mutable_component_name() = component_name;
195195
*request.mutable_destination() = to_proto(destination);
196196
if (constraints) {
197197
*request.mutable_constraints() = to_proto(*constraints);
@@ -205,17 +205,17 @@ bool MotionClient::move(const pose_in_frame& destination,
205205

206206
std::string MotionClient::move_on_map(
207207
const pose& destination,
208-
const Name& component_name,
209-
const Name& slam_name,
208+
const std::string& component_name,
209+
const std::string& slam_name,
210210
const std::shared_ptr<motion_configuration>& motion_configuration,
211211
const std::vector<GeometryConfig>& obstacles,
212212
const ProtoStruct& extra) {
213213
return make_client_helper(this, *stub_, &StubType::MoveOnMap)
214214
.with(extra,
215215
[&](auto& request) {
216216
*request.mutable_destination() = to_proto(destination);
217-
*request.mutable_component_name() = to_proto(component_name);
218-
*request.mutable_slam_service_name() = to_proto(slam_name);
217+
*request.mutable_component_name() = component_name;
218+
*request.mutable_slam_service_name() = slam_name;
219219

220220
for (const auto& obstacle : obstacles) {
221221
*request.mutable_obstacles()->Add() = to_proto(obstacle);
@@ -231,8 +231,8 @@ std::string MotionClient::move_on_map(
231231
std::string MotionClient::move_on_globe(
232232
const geo_point& destination,
233233
const boost::optional<double>& heading,
234-
const Name& component_name,
235-
const Name& movement_sensor_name,
234+
const std::string& component_name,
235+
const std::string& movement_sensor_name,
236236
const std::vector<geo_geometry>& obstacles,
237237
const std::shared_ptr<motion_configuration>& motion_configuration,
238238
const std::vector<geo_geometry>& bounding_regions,
@@ -241,8 +241,8 @@ std::string MotionClient::move_on_globe(
241241
.with(extra,
242242
[&](auto& request) {
243243
*request.mutable_destination() = to_proto(destination);
244-
*request.mutable_component_name() = to_proto(component_name);
245-
*request.mutable_movement_sensor_name() = to_proto(movement_sensor_name);
244+
*request.mutable_component_name() = component_name;
245+
*request.mutable_movement_sensor_name() = movement_sensor_name;
246246

247247
if (heading && !isnan(*heading)) {
248248
request.set_heading(*heading);
@@ -260,36 +260,36 @@ std::string MotionClient::move_on_globe(
260260
}
261261

262262
pose_in_frame MotionClient::get_pose(
263-
const Name& component_name,
263+
const std::string& component_name,
264264
const std::string& destination_frame,
265265
const std::vector<WorldState::transform>& supplemental_transforms,
266266
const ProtoStruct& extra) {
267267
return make_client_helper(this, *stub_, &StubType::GetPose)
268268
.with(extra,
269269
[&](auto& request) {
270-
*request.mutable_component_name() = to_proto(component_name);
270+
*request.mutable_component_name() = component_name;
271271
*request.mutable_destination_frame() = destination_frame;
272272
*request.mutable_supplemental_transforms() =
273273
impl::to_repeated_field(supplemental_transforms);
274274
})
275275
.invoke([](auto& response) { return from_proto(response.pose()); });
276276
}
277277

278-
void MotionClient::stop_plan(const Name& name, const ProtoStruct& extra) {
278+
void MotionClient::stop_plan(const std::string& name, const ProtoStruct& extra) {
279279
return make_client_helper(this, *stub_, &StubType::StopPlan)
280-
.with(extra, [&](auto& request) { *request.mutable_component_name() = to_proto(name); })
280+
.with(extra, [&](auto& request) { *request.mutable_component_name() = name; })
281281
.invoke();
282282
}
283283

284284
std::pair<Motion::plan_with_status, std::vector<Motion::plan_with_status>> MotionClient::get_plan_(
285-
const Name& component_name,
285+
const std::string& component_name,
286286
boost::optional<std::string> execution_id,
287287
bool last_plan_only,
288288
const ProtoStruct& extra) {
289289
return make_client_helper(this, *stub_, &StubType::GetPlan)
290290
.with(extra,
291291
[&](auto& request) {
292-
*request.mutable_component_name() = to_proto(component_name);
292+
*request.mutable_component_name() = component_name;
293293
request.set_last_plan_only(last_plan_only);
294294
if (execution_id) {
295295
*request.mutable_execution_id() = *execution_id;
@@ -302,25 +302,27 @@ std::pair<Motion::plan_with_status, std::vector<Motion::plan_with_status>> Motio
302302
});
303303
}
304304

305-
Motion::plan_with_status MotionClient::get_plan(const Name& name,
305+
Motion::plan_with_status MotionClient::get_plan(const std::string& name,
306306
const std::string& execution_id,
307307
const ProtoStruct& extra) {
308308
return get_plan_(name, execution_id, true, extra).first;
309309
}
310310

311-
Motion::plan_with_status MotionClient::get_latest_plan(const Name& name, const ProtoStruct& extra) {
311+
Motion::plan_with_status MotionClient::get_latest_plan(const std::string& name,
312+
const ProtoStruct& extra) {
312313
return get_plan_(name, {}, true, extra).first;
313314
}
314315

315316
std::pair<Motion::plan_with_status, std::vector<Motion::plan_with_status>>
316-
MotionClient::get_plan_with_replan_history(const Name& name,
317+
MotionClient::get_plan_with_replan_history(const std::string& name,
317318
const std::string& execution_id,
318319
const ProtoStruct& extra) {
319320
return get_plan_(name, execution_id, false, extra);
320321
}
321322

322323
std::pair<Motion::plan_with_status, std::vector<Motion::plan_with_status>>
323-
MotionClient::get_latest_plan_with_replan_history(const Name& name, const ProtoStruct& extra) {
324+
MotionClient::get_latest_plan_with_replan_history(const std::string& name,
325+
const ProtoStruct& extra) {
324326
return get_plan_(name, {}, false, extra);
325327
}
326328

0 commit comments

Comments
 (0)