Skip to content

Commit d4cf2e7

Browse files
committed
docstrings
1 parent 6631bc0 commit d4cf2e7

File tree

2 files changed

+65
-2
lines changed

2 files changed

+65
-2
lines changed

src/viam/sdk/services/motion.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class Motion : public Service {
247247
/// @param world_state Obstacles to avoid and transforms to add to the robot for the duration of
248248
/// the move.
249249
/// @param constraints Constraints to apply to how the robot will move.
250-
/// @extra Any additional arguments to the method.
250+
/// @param extra Any additional arguments to the method.
251251
/// @return Whether or not the move was successful.
252252
virtual bool move(const pose_in_frame& destination,
253253
const Name& name,

src/viam/sdk/services/navigation.hpp

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,28 @@ namespace sdk {
1515

1616
class Navigation : public Service {
1717
public:
18+
/// @enum Mode
19+
/// @brief Enum affecting this nav service's goal.
20+
/// @ingroup Navigation
1821
enum class Mode : uint8_t {
1922
k_unspecified,
2023
k_manual,
2124
k_waypoint,
2225
k_explore,
2326
};
2427

28+
/// @enum MapType
29+
/// @brief Is the map navigating in GPS or a custom map.
30+
/// @ingroup Navigation
2531
enum class MapType : uint8_t {
2632
k_unspecified,
2733
k_none,
2834
k_gps,
2935
};
3036

37+
/// @struct LocationResponse
38+
/// @brief Location and direction.
39+
/// @ingroup Navigation
3140
struct LocationResponse {
3241
geo_point location;
3342
double compass_heading;
@@ -37,15 +46,24 @@ class Navigation : public Service {
3746
}
3847
};
3948

49+
/// @struct Properties
50+
/// @brief A set of attributes for this nav service.
51+
/// @ingroup Navigation
4052
struct Properties {
4153
MapType map_type;
4254
};
4355

56+
/// @struct Waypoint
57+
/// @brief A location with an `id` handle that can be used to uniquely identify and remove it.
58+
/// @ingroup Navigation
4459
struct Waypoint {
4560
std::string id;
4661
geo_point location;
4762
};
4863

64+
/// @struct Path
65+
/// @brief A user-provided destination and a set of geopoints to get there.
66+
/// @ingroup Navigation
4967
struct Path {
5068
std::string destination_waypoint_id;
5169
std::vector<geo_point> geopoints;
@@ -58,39 +76,84 @@ class Navigation : public Service {
5876

5977
API api() const override;
6078

79+
/// @brief Get the current mode.
80+
/// @param extra Any additional arguments to the method.
81+
/// @return Current mode.
6182
virtual Mode get_mode(const ProtoStruct& extra) = 0;
83+
84+
/// @brief Set the current mode.
85+
/// @param mode Desired mode.
86+
/// @param extra Any additional arguments to the method.
6287
virtual void set_mode(const Mode mode, const ProtoStruct& extra) = 0;
88+
89+
/// @brief Get the current location.
90+
/// @param extra Any additional arguments to the method.
91+
/// @return Current location.
6392
virtual LocationResponse get_location(const ProtoStruct& extra) = 0;
93+
94+
/// @brief Get the waypoints this nav service knows about.
95+
/// @param extra Any additional arguments to the method.
96+
/// @return List of waypoints.
6497
virtual std::unique_ptr<std::vector<Waypoint>> get_waypoints(const ProtoStruct& extra) = 0;
98+
99+
/// @brief Add a waypoint.
100+
/// @param location Coordinate of the new waypoint.
65101
virtual void add_waypoint(const geo_point& location, const ProtoStruct& extra) = 0;
102+
103+
/// @brief Remove a waypoint by ID.
104+
/// @param id The string ID of the waypoint to remove.
105+
/// @param extra Any additional arguments to the method.
66106
virtual void remove_waypoint(const std::string id, const ProtoStruct& extra) = 0;
107+
108+
/// @brief Get the obstacles this nav service knows about.
109+
/// @param extra Any additional arguments to the method.
110+
/// @return List of shapes.
67111
virtual std::unique_ptr<std::vector<geo_geometry>> get_obstacles(const ProtoStruct& extra) = 0;
112+
113+
/// @brief Get the paths this nav service knows about.
114+
/// @param extra Any additional arguments to the method.
115+
/// @return List of paths.
68116
virtual std::unique_ptr<std::vector<Path>> get_paths(const ProtoStruct& extra) = 0;
117+
118+
/// @brief Get this nav service's properties.
119+
/// @return Properties.
69120
virtual Properties get_properties() = 0;
121+
122+
/// @brief Do an arbitrary command.
123+
/// @param command Freeform fields that are service-specific.
124+
/// @return Freeform result of the command.
70125
virtual ProtoStruct do_command(const ProtoStruct& command) = 0;
71126

72-
// overloads without `extra` param.
127+
// overloads without `extra` param:
128+
73129
inline Mode get_mode() {
74130
return get_mode({});
75131
}
132+
76133
inline void set_mode(const Mode mode) {
77134
set_mode(mode, {});
78135
}
136+
79137
inline LocationResponse get_location() {
80138
return get_location({});
81139
}
140+
82141
inline std::unique_ptr<std::vector<Waypoint>> get_waypoints() {
83142
return get_waypoints({});
84143
}
144+
85145
inline void add_waypoint(const geo_point& location) {
86146
add_waypoint(location, {});
87147
}
148+
88149
inline void remove_waypoint(const std::string id) {
89150
remove_waypoint(id, {});
90151
}
152+
91153
inline std::unique_ptr<std::vector<geo_geometry>> get_obstacles() {
92154
return get_obstacles({});
93155
}
156+
94157
inline std::unique_ptr<std::vector<Path>> get_paths() {
95158
return get_paths({});
96159
}

0 commit comments

Comments
 (0)