Skip to content

Address compiler warnings #451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a9fa851
Address Faceted SRP warnings
patkenneally Jun 20, 2025
0060904
Default initialize the VSCMG config msg payload
patkenneally Jun 20, 2025
7bb6185
Initialize to zeros eigen vectors
patkenneally Jun 20, 2025
0736637
Default initialize msg payload
patkenneally Jun 20, 2025
94734b5
Default initialize msg payload
patkenneally Jun 20, 2025
e9058c4
Default initialize msg payloads
patkenneally Jun 20, 2025
1c3c28c
Refactor loop counter to be unsigned size_t
patkenneally Jun 20, 2025
0278e5f
Default initialize msg payloads
patkenneally Jun 20, 2025
e502d42
Default initialize msg payloads
patkenneally Jun 20, 2025
9666c18
Default initialize msg payloads
patkenneally Jun 20, 2025
9d65018
Refactor to use size_t type for counter
patkenneally Jun 20, 2025
a1628f6
Default initialize msg payloads
patkenneally Jun 20, 2025
9158b89
Default initialize msg payloads
patkenneally Jun 21, 2025
53dc6bd
Refactor to use size_t for index
patkenneally Jun 21, 2025
e7fc64d
Default initialize msg payload
patkenneally Jun 21, 2025
b74c101
Default initialize msg payload
patkenneally Jun 21, 2025
9ad7525
Default initialize msg payload
patkenneally Jun 21, 2025
894b66f
Refactor to use size_t for index
patkenneally Jun 21, 2025
85f99cc
Refactor to use size_t for index
patkenneally Jun 21, 2025
49004d2
Refactor to return state vector size() as size_t
patkenneally Jun 21, 2025
36dcc76
Refactor to use size_t for index
patkenneally Jun 21, 2025
6fb6286
Refactor to use size_t for index
patkenneally Jun 21, 2025
c7ee98a
Pre-commit formatting clean up
patkenneally Jun 21, 2025
e16ac49
Refactor to use uint32_t for loop indexs
patkenneally Jun 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 89 additions & 92 deletions src/architecture/msgPayloadDefCpp/VSCMGConfigMsgPayload.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -23,103 +23,100 @@
#include <Eigen/Dense>
#include <vector>


/*! @brief enumeration definiting the types of VSCMG modes */
/*! @brief enumeration definiting the types of VSCMG modes */
enum VSCMGModels { vscmgBalancedWheels, vscmgJitterSimple, vscmgJitterFullyCoupled };


/*! @brief Structure used to define the individual VSCMG configuration data message*/
typedef struct
//@cond DOXYGEN_IGNORE
VSCMGConfigMsgPayload
//@cond DOXYGEN_IGNORE
VSCMGConfigMsgPayload
//@endcond
{
VSCMGModels VSCMGModel; //!< [-], Type of imbalance model to use
Eigen::Vector3d rGB_B; //!< [m], position vector of the VSCMG relative to the spacecraft body frame
Eigen::Vector3d gsHat0_B; //!< module variable
Eigen::Vector3d gsHat_B; //!< [-] spin axis unit vector in body frame
Eigen::Vector3d gtHat0_B; //!< module variable
Eigen::Vector3d gtHat_B; //!< module variable
Eigen::Vector3d ggHat_B; //!< module variable
Eigen::Vector3d w2Hat0_B; //!< [-] initial torque axis unit vector in body frame
Eigen::Vector3d w2Hat_B; //!< module variable
Eigen::Vector3d w3Hat0_B; //!< [-] initial gimbal axis unit vector in body frame
Eigen::Vector3d w3Hat_B; //!< module variable
double massV; //!< [kg]
double massG; //!< [kg]
double massW; //!< [kg]
double theta; //!< [rad], wheel angle
double Omega; //!< [rad/s], wheel speed
double gamma; //!< [s], gimbal angle
double gammaDot; //!< [rad/s], gimbal rate
double IW1; //!< [kg-m^2], spin axis gsHat rotor moment of inertia
double IW2; //!< [kg-m^2], gtHat axis rotor moment of inertia
double IW3; //!< [kg-m^2], ggHat axis rotor moment of inertia
double IW13; //!< [kg-m^2], x-z inertia of wheel about wheel center in wheel frame (imbalance)
double IG1; //!< [kg-m^2]
double IG2; //!< [kg-m^2]
double IG3; //!< [kg-m^2]
double IG12; //!< [kg-m^2]
double IG13; //!< [kg-m^2]
double IG23; //!< [kg-m^2]
double IV1; //!< [kg-m^2]
double IV2; //!< [kg-m^2]
double IV3; //!< [kg-m^2]
double rhoG; //!< module variable
double rhoW; //!< module variable
double U_s; //!< [kg-m], static imbalance
double U_d; //!< [kg-m^2], dynamic imbalance
Eigen::Vector3d rGcG_G; //!< module variable
double d; //!< [m], wheel center of mass offset from wheel frame origin
double l; //!< module variable
double L; //!< module variable
double u_s_current; //!< [N-m], current motor torque
double u_s_max = -1.0; //!< [N-m], Max torque
double u_s_min; //!< [N-m], Min torque
double u_s_f; //!< [N-m], Coulomb friction torque magnitude
double Omega_max = -1.0; //!< [rad/s], max wheel speed
double wheelLinearFrictionRatio;//!< [%] ratio relative to max speed value up to which the friction behaves linearly
double u_g_current; //!< [N-m], current motor torque
double u_g_max = -1.0; //!< [N-m], Max torque
double u_g_min; //!< [N-m], Min torque
double u_g_f; //!< [N-m], Coulomb friction torque magnitude
double gammaDot_max; //!< [rad/s], max wheel speed
double gimbalLinearFrictionRatio;//!< [%] ratio relative to max speed value up to which the friction behaves linearly

Eigen::Matrix3d IGPntGc_B; //!< module variable
Eigen::Matrix3d IWPntWc_B; //!< module variable
Eigen::Matrix3d IPrimeGPntGc_B; //!< module variable
Eigen::Matrix3d IPrimeWPntWc_B; //!< module variable
Eigen::Vector3d rGcG_B; //!< module variable
Eigen::Vector3d rGcB_B; //!< module variable
Eigen::Vector3d rWcB_B; //!< module variable
Eigen::Vector3d rWcG_B; //!< module variable
Eigen::Matrix3d rTildeGcB_B; //!< module variable
Eigen::Matrix3d rTildeWcB_B; //!< module variable
Eigen::Vector3d rPrimeGcB_B; //!< module variable
Eigen::Vector3d rPrimeWcB_B; //!< module variable
Eigen::Matrix3d rPrimeTildeGcB_B; //!< module variable
Eigen::Matrix3d rPrimeTildeWcB_B; //!< module variable

Eigen::Vector3d aOmega; //!< [-], parameter used in coupled jitter back substitution
Eigen::Vector3d bOmega; //!< [-], parameter used in coupled jitter back substitution
double cOmega; //!< [-], parameter used in coupled jitter back substitution
double dOmega; //!< module variable
double eOmega; //!< module variable
Eigen::Vector3d agamma; //!< module variable
Eigen::Vector3d bgamma; //!< module variable
double cgamma; //!< module variable
double dgamma; //!< module variable
double egamma; //!< module variable
Eigen::Vector3d p; //!< module variable
Eigen::Vector3d q; //!< module variable
double s; //!< module variable

double gravityTorqueWheel_s; //!< module variable
double gravityTorqueGimbal_g; //!< module variable
}VSCMGConfigMsgPayload;



VSCMGModels VSCMGModel; //!< [-], Type of imbalance model to use
Eigen::Vector3d rGB_B{}; //!< [m], position vector of the VSCMG relative to the spacecraft body frame
Eigen::Vector3d gsHat0_B{}; //!< module variable
Eigen::Vector3d gsHat_B{}; //!< [-] spin axis unit vector in body frame
Eigen::Vector3d gtHat0_B{}; //!< module variable
Eigen::Vector3d gtHat_B{}; //!< module variable
Eigen::Vector3d ggHat_B{}; //!< module variable
Eigen::Vector3d w2Hat0_B{}; //!< [-] initial torque axis unit vector in body frame
Eigen::Vector3d w2Hat_B{}; //!< module variable
Eigen::Vector3d w3Hat0_B{}; //!< [-] initial gimbal axis unit vector in body frame
Eigen::Vector3d w3Hat_B{}; //!< module variable
double massV; //!< [kg]
double massG; //!< [kg]
double massW; //!< [kg]
double theta; //!< [rad], wheel angle
double Omega; //!< [rad/s], wheel speed
double gamma; //!< [s], gimbal angle
double gammaDot; //!< [rad/s], gimbal rate
double IW1; //!< [kg-m^2], spin axis gsHat rotor moment of inertia
double IW2; //!< [kg-m^2], gtHat axis rotor moment of inertia
double IW3; //!< [kg-m^2], ggHat axis rotor moment of inertia
double IW13; //!< [kg-m^2], x-z inertia of wheel about wheel center in wheel frame (imbalance)
double IG1; //!< [kg-m^2]
double IG2; //!< [kg-m^2]
double IG3; //!< [kg-m^2]
double IG12; //!< [kg-m^2]
double IG13; //!< [kg-m^2]
double IG23; //!< [kg-m^2]
double IV1; //!< [kg-m^2]
double IV2; //!< [kg-m^2]
double IV3; //!< [kg-m^2]
double rhoG; //!< module variable
double rhoW; //!< module variable
double U_s; //!< [kg-m], static imbalance
double U_d; //!< [kg-m^2], dynamic imbalance
Eigen::Vector3d rGcG_G{}; //!< module variable
double d; //!< [m], wheel center of mass offset from wheel frame origin
double l; //!< module variable
double L; //!< module variable
double u_s_current; //!< [N-m], current motor torque
double u_s_max = -1.0; //!< [N-m], Max torque
double u_s_min; //!< [N-m], Min torque
double u_s_f; //!< [N-m], Coulomb friction torque magnitude
double Omega_max = -1.0; //!< [rad/s], max wheel speed
double
wheelLinearFrictionRatio; //!< [%] ratio relative to max speed value up to which the friction behaves linearly
double u_g_current; //!< [N-m], current motor torque
double u_g_max = -1.0; //!< [N-m], Max torque
double u_g_min; //!< [N-m], Min torque
double u_g_f; //!< [N-m], Coulomb friction torque magnitude
double gammaDot_max; //!< [rad/s], max wheel speed
double
gimbalLinearFrictionRatio; //!< [%] ratio relative to max speed value up to which the friction behaves linearly

Eigen::Matrix3d IGPntGc_B = Eigen::Matrix3d::Identity(); //!< module variable
Eigen::Matrix3d IWPntWc_B = Eigen::Matrix3d::Identity(); //!< module variable
Eigen::Matrix3d IPrimeWPntWc_B = Eigen::Matrix3d::Identity(); //!< module variable
Eigen::Matrix3d IPrimeGPntGc_B = Eigen::Matrix3d::Identity(); //!< module variable
Eigen::Vector3d rGcG_B{}; //!< module variable
Eigen::Vector3d rGcB_B{}; //!< module variable
Eigen::Vector3d rWcB_B{}; //!< module variable
Eigen::Vector3d rWcG_B{}; //!< module variable
Eigen::Matrix3d rTildeGcB_B = Eigen::Matrix3d::Identity(); //!< module variable
Eigen::Matrix3d rTildeWcB_B = Eigen::Matrix3d::Identity(); //!< module variable
Eigen::Vector3d rPrimeGcB_B{}; //!< module variable
Eigen::Vector3d rPrimeWcB_B{}; //!< module variable
Eigen::Matrix3d rPrimeTildeGcB_B = Eigen::Matrix3d::Identity(); //!< module variable
Eigen::Matrix3d rPrimeTildeWcB_B = Eigen::Matrix3d::Identity(); //!< module variable

Eigen::Vector3d aOmega{}; //!< [-], parameter used in coupled jitter back substitution
Eigen::Vector3d bOmega{}; //!< [-], parameter used in coupled jitter back substitution
double cOmega; //!< [-], parameter used in coupled jitter back substitution
double dOmega; //!< module variable
double eOmega; //!< module variable
Eigen::Vector3d agamma{}; //!< module variable
Eigen::Vector3d bgamma{}; //!< module variable
double cgamma; //!< module variable
double dgamma; //!< module variable
double egamma; //!< module variable
Eigen::Vector3d p{}; //!< module variable
Eigen::Vector3d q{}; //!< module variable
double s; //!< module variable

double gravityTorqueWheel_s; //!< module variable
double gravityTorqueGimbal_g; //!< module variable
} VSCMGConfigMsgPayload;

#endif
2 changes: 1 addition & 1 deletion src/fswAlgorithms/_GeneralModuleFiles/srukfInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void SRukfInterface::reset(uint64_t currentSimNanos) {
this->wM(0) = this->lambda / ((double)this->state.size() + this->lambda);
this->wC(0) =
this->lambda / ((double)this->state.size() + this->lambda) + (1 - this->alpha * this->alpha + this->beta);
for (auto i = 1; i < this->numberSigmaPoints; ++i) {
for (size_t i = 1; i < this->numberSigmaPoints; ++i) {
this->wM(i) = 1.0 / (2.0 * ((double)this->state.size() + this->lambda));
this->wC(i) = this->wM(i);
}
Expand Down
38 changes: 19 additions & 19 deletions src/fswAlgorithms/_GeneralModuleFiles/srukfInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
#ifndef SRUKF_INTERFACE_HPP
#define SRUKF_INTERFACE_HPP

#include <Eigen/Dense>
#include <functional>
#include <optional>
#include <array>
#include "architecture/utilities/avsEigenSupport.h"
#include "architecture/utilities/macroDefinitions.h"
#include "architecture/_GeneralModuleFiles/sys_model.h"
#include "architecture/messaging/messaging.h"
#include "architecture/utilities/avsEigenSupport.h"
#include "architecture/utilities/macroDefinitions.h"
#include "fswAlgorithms/_GeneralModuleFiles/filterInterfaceDefinitions.h"
#include "fswAlgorithms/_GeneralModuleFiles/kalmanFilter.h"
#include "fswAlgorithms/_GeneralModuleFiles/measurementModels.h"
#include "fswAlgorithms/_GeneralModuleFiles/stateModels.h"
#include <Eigen/Dense>
#include <array>
#include <functional>
#include <optional>

/*! @brief Square Root unscented Kalman Filter base class */
class SRukfInterface: public KalmanFilter {
public:
class SRukfInterface : public KalmanFilter {
public:
SRukfInterface() = default;
~SRukfInterface() = default;
void reset(uint64_t currentSimNanos) final;
Expand All @@ -45,7 +45,7 @@ class SRukfInterface: public KalmanFilter {
void setBeta(double beta);
double getBeta() const;

private:
private:
void timeUpdate(double updateTime) final;
void measurementUpdate(const MeasurementModel &measurement) final;

Expand All @@ -58,20 +58,20 @@ class SRukfInterface: public KalmanFilter {
Eigen::MatrixXd forwardSubstitution(const Eigen::MatrixXd &L, const Eigen::MatrixXd &b) const;
Eigen::MatrixXd choleskyDecomposition(const Eigen::MatrixXd &input) const;

Eigen::MatrixXd sBar; //!< [-] Time updated covariance
std::array<FilterStateVector, 2*MAX_STATES_VECTOR+1> sigmaPoints; //!< [-] sigma point vector
int numberSigmaPoints=0;//!< [-] number of sigma points
Eigen::MatrixXd cholProcessNoise; //!< [-] cholesky of Qnoise
Eigen::MatrixXd cholMeasNoise; //!< [-] cholesky of Measurement noise
Eigen::MatrixXd sBar; //!< [-] Time updated covariance
std::array<FilterStateVector, 2 * MAX_STATES_VECTOR + 1> sigmaPoints; //!< [-] sigma point vector
size_t numberSigmaPoints = 0; //!< [-] number of sigma points
Eigen::MatrixXd cholProcessNoise; //!< [-] cholesky of Qnoise
Eigen::MatrixXd cholMeasNoise; //!< [-] cholesky of Measurement noise

double beta=0;
double alpha=0;
double lambda=0;
double eta=0;
double beta = 0;
double alpha = 0;
double lambda = 0;
double eta = 0;

Eigen::VectorXd wM;
Eigen::VectorXd wC;
Eigen::MatrixXd sBarInitial; //!< [-] Time updated covariance at previous time
Eigen::MatrixXd sBarInitial; //!< [-] Time updated covariance at previous time
};

#endif /* SRUKF_INTERFACE_HPP */
Loading
Loading