This repository was archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
Path Manager Restructure #151
Open
Pop0097
wants to merge
13
commits into
UWARG:devel
Choose a base branch
from
Pop0097:pathManRestructure
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1bceb62
Call reaches all the way to correct mode
Pop0097 ea2e7a3
Sending data from PM works
Pop0097 709ed96
Data is sent back
Pop0097 910529d
Added comments and shit
Pop0097 d8868a3
Cruising and Landing Mode Implementation (#17)
Pop0097 28adf28
Takeoff Mode implementation (#18)
OABF 9b3c5ec
Fixed casing error that did not pass in linux build
Pop0097 dc9a2fe
Casing error 2
Pop0097 6f97bb1
Undefined variable now defined;
Pop0097 8173173
Addressed some of Sahil comments
Pop0097 6c221b0
Merge branch 'pathManRestructure' into pathManRestructure
Pop0097 54a67ff
Little fixes to remove some bugs and update code with devel
Pop0097 0dafc90
minor typo fixes
Gongsta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| #ifndef CRUISING_MODE_HPP | ||
| #define CRUISING_MODE_HPP | ||
|
|
||
| #include "pathMode.hpp" | ||
| #include "cruisingModeStageManager.hpp" | ||
| #include "pathModeSelector.hpp" | ||
|
|
||
| class CruisingModeStageManager; | ||
|
|
||
| // Mode class as depicted in https://uwarg-docs.atlassian.net/wiki/spaces/ZP/pages/1866989569/Proposed+Redesign | ||
| class CruisingMode : public PathMode { | ||
| public: | ||
| /** | ||
| * Call to get singleton for this class | ||
| * | ||
| * @return instance of class object | ||
| */ | ||
| static PathMode& getInstance(); | ||
|
|
||
| /** | ||
| * Execute the curent stage in the mode | ||
| * | ||
| * @param telemetry_in -> telemetry data from ground | ||
| * @param sensor_fusion_in -> sensor fusion data | ||
| * @param imu_data_in -> raw imu data | ||
| * | ||
| * @return none | ||
| */ | ||
| void execute(Telemetry_PIGO_t telemetry_in, SFOutput_t sensor_fusion_in, IMU_Data_t imu_data_in); | ||
|
|
||
| /** | ||
| * Get PathModeSelector singleton instance | ||
| * | ||
| * @return instance of PathModeSelector singleton | ||
| */ | ||
| PathModeSelector* getModeSelector(); | ||
|
|
||
| /** | ||
| * Returns a pointer for the current stage of flight | ||
| * | ||
| * @return current stage of flight within mode | ||
| */ | ||
| inline CruisingModeStageManager* getCurrentStage() const { return current_stage; } | ||
|
|
||
| // No need a setStage method as we only have one stage | ||
| private: | ||
| CruisingMode(); | ||
|
|
||
| CruisingModeStageManager* current_stage; | ||
| static PathModeSelector* _mode_selector; | ||
| }; | ||
|
|
||
| #endif | ||
|
|
21 changes: 21 additions & 0 deletions
21
Autopilot/PathManager/Inc/cruisingMode/cruisingModeStageManager.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #ifndef CRUISING_MODE_STAGE_MANAGER_HPP | ||
| #define CRUISING_MODE_STAGE_MANAGER_HPP | ||
|
|
||
| #include "cruisingMode.hpp" | ||
|
|
||
| class CruisingMode; | ||
|
|
||
| // Like ModeStage class as depicted in https://uwarg-docs.atlassian.net/wiki/spaces/ZP/pages/1866989569/Proposed+Redesign | ||
| class CruisingModeStageManager { | ||
| public: | ||
| virtual void enter(CruisingMode* cruise_mode) = 0; | ||
| virtual void execute(CruisingMode* cruise_mode) = 0; | ||
| virtual void exit(CruisingMode* cruise_mode) = 0; | ||
|
|
||
| bool operator==(const CruisingModeStageManager& rhs) const {return (this == &rhs);} | ||
|
|
||
| virtual ~CruisingModeStageManager() {} | ||
| }; | ||
|
|
||
| #endif | ||
|
|
36 changes: 36 additions & 0 deletions
36
Autopilot/PathManager/Inc/cruisingMode/cruisingModeStages.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #ifndef CRUISING_MODE_STAGES_HPP | ||
| #define CRUISING_MODE_STAGES_HPP | ||
|
|
||
| #include <cstdint> | ||
|
|
||
| #include "cruisingModeStageManager.hpp" | ||
| #include "cruisingMode.hpp" | ||
|
|
||
| #include "waypointManager.hpp" | ||
| #include "TelemPathInterface.hpp" | ||
| #include "AutoSteer.hpp" | ||
| #include "cruisingFlight.hpp" | ||
|
|
||
| class CruisingFlight : public CruisingModeStageManager { | ||
| public: | ||
| void enter(CruisingMode* cruise_mode) { (void) cruise_mode; } | ||
| void execute(CruisingMode* cruise_mode); | ||
| void exit(CruisingMode* cruise_mode) { (void) cruise_mode; } | ||
| static CruisingModeStageManager& getInstance(); | ||
|
|
||
| private: | ||
| CruisingFlight() : in_hold {false}, going_home {false} {} | ||
| CruisingFlight(const CruisingFlight& other); | ||
| CruisingFlight& operator=(const CruisingFlight& other); | ||
|
|
||
| WaypointManager cruising_state_manager; | ||
| uint16_t waypoint_id_array[PATH_BUFFER_SIZE]; // Stores ids of the waypoints in the flight path in the order that they are executed | ||
| static _WaypointManager_Data_In _input_data; | ||
| static _WaypointManager_Data_Out _output_data; | ||
| static _CruisingState_Telemetry_Return _return_to_ground; | ||
| bool in_hold; | ||
| bool going_home; | ||
| }; | ||
|
|
||
| #endif | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| #ifndef LANDING_MODE_HPP | ||
| #define LANDING_MODE_HPP | ||
|
|
||
| #include "pathMode.hpp" | ||
| #include "landingModeStageManager.hpp" | ||
| #include "pathModeSelector.hpp" | ||
| #include "SensorFusion.hpp" | ||
|
|
||
| class LandingModeStageManager; | ||
|
|
||
| enum LandingStages { | ||
| LANDING_TRANSITION = 0, | ||
| LANDING_SLOPE, | ||
| LANDING_FLARE, | ||
| LANDING_DECRAB, | ||
| LANDING_TOUCHDOWN | ||
| }; | ||
|
|
||
| class LandingMode : public PathMode { | ||
| public: | ||
| /** | ||
| * Call to get singleton for this class | ||
| * | ||
| * @return instance of class object | ||
| */ | ||
| static PathMode& getInstance(); | ||
|
|
||
| /** | ||
| * Execute the curent stage in the mode | ||
| * | ||
| * @param telemetry_in -> telemetry data from ground | ||
| * @param sensor_fusion_in -> sensor fusion data | ||
| * @param imu_data_in -> raw imu data | ||
| * | ||
| * @return none | ||
| */ | ||
| void execute(Telemetry_PIGO_t telemetry_in, SFOutput_t sensor_fusion_in, IMU_Data_t imu_data_in); | ||
|
|
||
| /** | ||
| * Get PathModeSelector singleton instance | ||
| * | ||
| * @return instance of PathModeSelector singleton | ||
| */ | ||
| PathModeSelector* getModeSelector(); | ||
|
|
||
| /** | ||
| * Returns a pointer for the current stage of flight | ||
| * | ||
| * @return current stage of flight within mode | ||
| */ | ||
| inline LandingModeStageManager* getCurrentStage() const { return current_stage; } | ||
|
|
||
| /** | ||
| * Sets the pointer for the current stage of flight | ||
| * | ||
| * @param new_stage -> new stage of flight within mode | ||
| * | ||
| * @return none | ||
| */ | ||
| inline void setCurrentStage(LandingModeStageManager* new_stage) { current_stage = new_stage; } | ||
|
|
||
| /** | ||
| * Returns a pointer for the current stage of flight | ||
| * | ||
| * @return current stage of flight within mode | ||
| */ | ||
| inline LandingStages getCurrentStageEnum() const { return landing_stage; } | ||
|
|
||
| /** | ||
| * Sets the enum for the current stage of flight | ||
| * | ||
| * @param new_stage -> enum for new stage of flight within mode | ||
| * | ||
| * @return none | ||
| */ | ||
| inline void setCurrentStageEnum(LandingStages new_stage) { landing_stage = new_stage; } | ||
|
|
||
| /* | ||
| * Getters and setters for Landing Mode data | ||
| */ | ||
| inline bool getMadeLandingPoints() { return made_landing_points; } | ||
|
|
||
| inline void setMadeLandingPoints(bool new_made_landing_points) { made_landing_points = new_made_landing_points; } | ||
|
|
||
| inline bool getIsPackage() { return is_package; } | ||
|
|
||
| inline void setIsPackage(bool new_is_package) { is_package = new_is_package; } | ||
|
|
||
| private: | ||
| LandingMode(); | ||
|
|
||
| LandingModeStageManager* current_stage; | ||
| LandingStages landing_stage; | ||
| static PathModeSelector* _mode_selector; | ||
|
|
||
| bool made_landing_points; | ||
| bool is_package; | ||
| }; | ||
|
|
||
| #endif | ||
|
|
||
|
|
20 changes: 20 additions & 0 deletions
20
Autopilot/PathManager/Inc/landingMode/landingModeStageManager.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #ifndef LANDING_MODE_STAGE_MANAGER_HPP | ||
| #define LANDING_MODE_STAGE_MANAGER_HPP | ||
|
|
||
| #include "landingMode.hpp" | ||
|
|
||
| class LandingMode; | ||
|
|
||
| class LandingModeStageManager { | ||
| public: | ||
| virtual void enter(LandingMode* land_mode) = 0; | ||
| virtual void execute(LandingMode* land_mode) = 0; | ||
| virtual void exit(LandingMode* land_mode) = 0; | ||
|
|
||
| bool operator==(const LandingModeStageManager& rhs) const {return (this == &rhs);} | ||
|
|
||
| virtual ~LandingModeStageManager() {} | ||
| }; | ||
|
|
||
| #endif | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.