-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0282fdf
commit 572bd5e
Showing
872 changed files
with
246,780 additions
and
238,916 deletions.
There are no files selected for viewing
This file contains 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 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 was deleted.
Oops, something went wrong.
This file contains 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,24 @@ | ||
#ifndef ZPSW3_AM_FBWA_HPP | ||
#define ZPSW3_AM_FBWA_HPP | ||
|
||
#include "flightmode.hpp" | ||
|
||
namespace AM { | ||
|
||
class FBWA : public Flightmode { | ||
public: | ||
FBWA() = default; | ||
|
||
AttitudeManagerInput run(const AttitudeManagerInput& input) override; | ||
void updatePid() override; | ||
void updatePidGains() override; | ||
void updateControlLimits(ControlLimits_t limits) override; | ||
|
||
private: | ||
// TODO: FIXME to be a control limit class | ||
ControlLimits_t fbwa_control_limits; | ||
}; | ||
|
||
} // namespace AM | ||
|
||
#endif // ZPSW3_AM_FBWA_HPP |
This file contains 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,31 @@ | ||
/* | ||
* AM_ControlAlgorithm.hpp | ||
* | ||
* Attitude Manager Control Algorithm Interface | ||
* | ||
* Created on: Oct 22, 2022 | ||
* Author(s): Aidan Bowers | ||
*/ | ||
#ifndef ZPSW3_AM_CONTROL_INTERFACE_HPP | ||
#define ZPSW3_AM_CONTROL_INTERFACE_HPP | ||
|
||
#include "CommonDataTypes.hpp" | ||
|
||
namespace AM { | ||
|
||
class Flightmode { | ||
public: | ||
virtual ~Flightmode() = default; | ||
|
||
virtual AttitudeManagerInput run(const AttitudeManagerInput& input) = 0; | ||
virtual void updatePid() = 0; | ||
virtual void updatePidGains() = 0; | ||
virtual void updateControlLimits(ControlLimits_t limits) = 0; | ||
|
||
protected: | ||
Flightmode() = default; | ||
}; | ||
|
||
} // namespace AM | ||
|
||
#endif // ZPSW3_AM_CONTROL_INTERFACE_HPP |
This file contains 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 ZPSW3_AM_MANUAL_HPP | ||
#define ZPSW3_AM_MANUAL_HPP | ||
|
||
#include "flightmode.hpp" | ||
|
||
namespace AM { | ||
|
||
class Manual : public Flightmode { | ||
public: | ||
Manual() = default; | ||
|
||
AttitudeManagerInput run(const AttitudeManagerInput& input) override; | ||
void updatePid() override; | ||
void updatePidGains() override; | ||
void updateControlLimits(ControlLimits_t limits) override; | ||
}; | ||
|
||
} // namespace AM | ||
|
||
#endif // ZPSW3_AM_MANUAL_HPP |
This file contains 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,51 @@ | ||
#include "fbwa.hpp" | ||
#include "CommonDataTypes.hpp" | ||
#include "AM.hpp" | ||
#include <cassert> | ||
|
||
namespace AM { | ||
AttitudeManagerInput FBWA::run(const AttitudeManagerInput& input) { | ||
|
||
AttitudeManagerInput mappedOutputs; | ||
|
||
// TODO: bound checking that doesn't throw an abort() and program exit | ||
// Bounded checking to make sure input is within max and min | ||
// assert(input.pitch <= AM::AttitudeManager::INPUT_MAX && input.pitch >= AM::AttitudeManager::INPUT_MIN); | ||
// assert(input.roll <= AM::AttitudeManager::INPUT_MAX && input.roll >= AM::AttitudeManager::INPUT_MIN); | ||
// assert(input.yaw <= AM::AttitudeManager::INPUT_MAX && input.yaw >= AM::AttitudeManager::INPUT_MIN); | ||
// assert(input.throttle <= AM::AttitudeManager::INPUT_MAX && input.throttle >= AM::AttitudeManager::INPUT_MIN); | ||
|
||
// Mapping inputs to outputs with ratios of min-max | ||
// Mapping maintains 0->0 I/O | ||
mappedOutputs.pitch = | ||
input.pitch < 0 | ||
? input.pitch * (fbwa_control_limits.pitchLimit.min / AM::AttitudeManager::INPUT_MIN) | ||
: input.pitch * (fbwa_control_limits.pitchLimit.max / AM::AttitudeManager::INPUT_MAX); | ||
mappedOutputs.roll = | ||
input.roll < 0 | ||
? input.roll * (fbwa_control_limits.rollLimit.min / AM::AttitudeManager::INPUT_MIN) | ||
: input.roll * (fbwa_control_limits.rollLimit.max / AM::AttitudeManager::INPUT_MAX); | ||
mappedOutputs.yaw = | ||
input.yaw < 0 | ||
? input.yaw * (fbwa_control_limits.yawLimit.min / AM::AttitudeManager::INPUT_MIN) | ||
: input.yaw * (fbwa_control_limits.yawLimit.max / AM::AttitudeManager::INPUT_MAX); | ||
|
||
// Throttle maps -100-100 to range 0-100 | ||
mappedOutputs.throttle = | ||
fbwa_control_limits.throttleLimit.min + | ||
(input.throttle - AM::AttitudeManager::INPUT_MIN) * | ||
(fbwa_control_limits.throttleLimit.max - fbwa_control_limits.throttleLimit.min) / | ||
(AM::AttitudeManager::INPUT_MAX - AM::AttitudeManager::INPUT_MIN); | ||
|
||
return mappedOutputs; | ||
} | ||
|
||
void FBWA::updatePid() {} //Needs to be implemented | ||
|
||
void FBWA::updatePidGains() {} //Needs to be implemented | ||
|
||
void FBWA::updateControlLimits(ControlLimits_t limits) { | ||
// TODO: make this better than a straight copy | ||
fbwa_control_limits = limits; | ||
} | ||
} |
This file contains 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,14 @@ | ||
#include "manual.hpp" | ||
#include "CommonDataTypes.hpp" | ||
|
||
namespace AM { | ||
|
||
AttitudeManagerInput Manual::run(const AttitudeManagerInput& input) { | ||
return input; | ||
} | ||
|
||
void Manual::updatePid() {} | ||
void Manual::updatePidGains() {} | ||
void Manual::updateControlLimits(ControlLimits_t limits) {} | ||
|
||
} // namespace AM |
This file contains 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 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
Oops, something went wrong.