|
| 1 | +#pragma once |
| 2 | + |
| 3 | +// #include <viam/sdk/common/pose.hpp> |
| 4 | +// #include <viam/sdk/common/proto_value.hpp> |
| 5 | +// #include <viam/sdk/resource/resource_api.hpp> |
| 6 | +// #include <viam/sdk/services/motion.hpp> |
| 7 | +#include <viam/sdk/services/navigation.hpp> |
| 8 | +// #include <viam/sdk/spatialmath/geometry.hpp> |
| 9 | + |
| 10 | +namespace viam { |
| 11 | +namespace sdktests { |
| 12 | +namespace navigation { |
| 13 | + |
| 14 | +using namespace sdk; |
| 15 | + |
| 16 | +class MockNav : public sdk::Navigation { |
| 17 | + public: |
| 18 | + Mode get_mode(const ProtoStruct& extra) override; |
| 19 | + void set_mode(const Mode mode, const ProtoStruct& extra) override; |
| 20 | + LocationResponse get_location(const ProtoStruct& extra) override; |
| 21 | + std::unique_ptr<std::vector<Waypoint>> get_waypoints(const ProtoStruct& extra) override; |
| 22 | + void add_waypoint(const geo_point& location, const ProtoStruct& extra) override; |
| 23 | + void remove_waypoint(const std::string id, const ProtoStruct& extra) override; |
| 24 | + std::unique_ptr<std::vector<geo_geometry>> get_obstacles(const ProtoStruct& extra) override; |
| 25 | + std::unique_ptr<std::vector<Path>> get_paths(const ProtoStruct& extra) override; |
| 26 | + Properties get_properties() override; |
| 27 | + ProtoStruct do_command(const ProtoStruct& command) override; |
| 28 | + |
| 29 | + Mode mode; |
| 30 | + LocationResponse loc; |
| 31 | + std::vector<Waypoint> waypoints; |
| 32 | + int next_waypoint_id = 0; |
| 33 | + std::vector<geo_geometry> obstacles; |
| 34 | + std::vector<Path> paths; |
| 35 | + MapType map_type; |
| 36 | +}; |
| 37 | + |
| 38 | +// sdk::pose_in_frame init_fake_pose(); |
| 39 | +// sdk::pose_in_frame fake_pose(); |
| 40 | + |
| 41 | +// sdk::Name fake_component_name(); |
| 42 | +// sdk::Name fake_slam_name(); |
| 43 | +// sdk::Name fake_movement_sensor_name(); |
| 44 | +// sdk::geo_point fake_geo_point(); |
| 45 | +// std::vector<sdk::geo_geometry> fake_obstacles(); |
| 46 | +// std::shared_ptr<sdk::motion_configuration> fake_motion_configuration(); |
| 47 | +// std::vector<sdk::geo_geometry> fake_bounding_regions(); |
| 48 | + |
| 49 | +// class MockMotion : public sdk::Motion { |
| 50 | +// public: |
| 51 | +// bool move(const sdk::pose_in_frame& destination, |
| 52 | +// const sdk::Name& component_name, |
| 53 | +// const std::shared_ptr<sdk::WorldState>& world_state, |
| 54 | +// const std::shared_ptr<constraints>& constraints, |
| 55 | +// const sdk::ProtoStruct& extra) override; |
| 56 | + |
| 57 | +// std::string move_on_map(const sdk::pose& destination, |
| 58 | +// const sdk::Name& component_name, |
| 59 | +// const sdk::Name& slam_name, |
| 60 | +// const std::shared_ptr<sdk::motion_configuration>& |
| 61 | +// motion_configuration, const std::vector<sdk::GeometryConfig>& |
| 62 | +// obstacles, const sdk::ProtoStruct& extra) override; |
| 63 | + |
| 64 | +// std::string move_on_globe( |
| 65 | +// const sdk::geo_point& destination, |
| 66 | +// const boost::optional<double>& heading, |
| 67 | +// const sdk::Name& component_name, |
| 68 | +// const sdk::Name& movement_sensor_name, |
| 69 | +// const std::vector<sdk::geo_geometry>& obstacles, |
| 70 | +// const std::shared_ptr<sdk::motion_configuration>& motion_configuration, |
| 71 | +// const std::vector<sdk::geo_geometry>& bounding_regions, |
| 72 | +// const sdk::ProtoStruct& extra) override; |
| 73 | + |
| 74 | +// sdk::pose_in_frame get_pose( |
| 75 | +// const sdk::Name& component_name, |
| 76 | +// const std::string& destination_frame, |
| 77 | +// const std::vector<sdk::WorldState::transform>& supplemental_transforms, |
| 78 | +// const sdk::ProtoStruct& extra) override; |
| 79 | + |
| 80 | +// plan_with_status get_plan(const sdk::Name& component_name, |
| 81 | +// const std::string& execution_id, |
| 82 | +// const sdk::ProtoStruct& extra) override; |
| 83 | + |
| 84 | +// std::pair<plan_with_status, std::vector<plan_with_status>> get_plan_with_replan_history( |
| 85 | +// const sdk::Name& component_name, |
| 86 | +// const std::string& execution_id, |
| 87 | +// const sdk::ProtoStruct& extra) override; |
| 88 | + |
| 89 | +// plan_with_status get_latest_plan(const sdk::Name& component_name, |
| 90 | +// const sdk::ProtoStruct& extra) override; |
| 91 | + |
| 92 | +// std::pair<plan_with_status, std::vector<plan_with_status>> |
| 93 | +// get_latest_plan_with_replan_history( |
| 94 | +// const sdk::Name& component_name, const sdk::ProtoStruct& extra) override; |
| 95 | + |
| 96 | +// std::vector<plan_status_with_id> list_plan_statuses(const sdk::ProtoStruct& extra) override; |
| 97 | + |
| 98 | +// std::vector<plan_status_with_id> list_active_plan_statuses( |
| 99 | +// const sdk::ProtoStruct& extra) override; |
| 100 | + |
| 101 | +// void stop_plan(const sdk::Name& name, const sdk::ProtoStruct& extra) override; |
| 102 | + |
| 103 | +// sdk::ProtoStruct do_command(const sdk::ProtoStruct& command) override; |
| 104 | +// static std::shared_ptr<MockMotion> get_mock_motion(); |
| 105 | +// static plan_status fake_plan_status(); |
| 106 | +// static plan_with_status fake_plan_with_status(); |
| 107 | +// static plan_status_with_id fake_plan_status_with_id(); |
| 108 | + |
| 109 | +// // These variables allow the testing infra to `peek` into the mock |
| 110 | +// // and ensure that the correct values were passed |
| 111 | +// sdk::pose_in_frame current_location; |
| 112 | +// sdk::pose peek_current_pose; |
| 113 | +// sdk::Name peek_component_name; |
| 114 | +// sdk::Name peek_movement_sensor_name; |
| 115 | +// sdk::Name peek_slam_name; |
| 116 | +// sdk::geo_point peek_destination; |
| 117 | +// std::string peek_destination_frame; |
| 118 | +// double peek_heading; |
| 119 | +// bool peek_stop_plan_called = false; |
| 120 | +// std::string peek_debug_key; |
| 121 | +// std::vector<sdk::geo_geometry> peek_obstacles; |
| 122 | +// std::vector<sdk::GeometryConfig> peek_map_obstacles; |
| 123 | +// std::shared_ptr<constraints> peek_constraints; |
| 124 | +// std::shared_ptr<sdk::motion_configuration> peek_motion_configuration; |
| 125 | +// std::vector<sdk::geo_geometry> peek_bounding_regions; |
| 126 | +// std::shared_ptr<sdk::WorldState> peek_world_state; |
| 127 | + |
| 128 | +// MockMotion(std::string name) |
| 129 | +// : sdk::Motion(std::move(name)), current_location(init_fake_pose()){}; |
| 130 | +// }; |
| 131 | + |
| 132 | +} // namespace navigation |
| 133 | +} // namespace sdktests |
| 134 | +} // namespace viam |
0 commit comments