2022-09-19 15:03:25 +02:00
|
|
|
#ifndef ACTUATORCMD_H_
|
|
|
|
#define ACTUATORCMD_H_
|
|
|
|
|
2023-04-27 10:19:07 +02:00
|
|
|
#include <cmath>
|
|
|
|
|
2022-12-13 11:51:03 +01:00
|
|
|
class ActuatorCmd {
|
|
|
|
public:
|
2023-02-27 17:36:33 +01:00
|
|
|
ActuatorCmd();
|
2022-12-13 11:51:03 +01:00
|
|
|
virtual ~ActuatorCmd();
|
2022-09-19 15:03:25 +02:00
|
|
|
|
2022-12-13 11:51:03 +01:00
|
|
|
/*
|
|
|
|
* @brief: scalingTorqueRws() scales the torque via maximum part in case this part is
|
|
|
|
* higher then the maximum torque
|
2023-03-10 17:31:12 +01:00
|
|
|
* @param: rwTrq given torque for reaction wheels which will be
|
|
|
|
* scaled if needed to be
|
2022-12-13 11:51:03 +01:00
|
|
|
*/
|
2023-03-10 17:31:12 +01:00
|
|
|
void scalingTorqueRws(double *rwTrq, double maxTorque);
|
2022-11-08 13:48:50 +01:00
|
|
|
|
2022-12-13 11:51:03 +01:00
|
|
|
/*
|
2023-04-27 10:19:07 +02:00
|
|
|
* @brief: cmdSpeedToRws() Calculates the RPM for the reaction wheel configuration,
|
|
|
|
* given the required torque calculated by the controller. Will also scale down the RPM of the
|
|
|
|
* wheels if they exceed the maximum possible RPM
|
|
|
|
* @param: rwTrq given torque from pointing controller
|
2022-12-13 11:51:03 +01:00
|
|
|
* rwCmdSpeed output revolutions per minute for every
|
|
|
|
* reaction wheel
|
|
|
|
*/
|
2023-04-27 10:19:07 +02:00
|
|
|
void cmdSpeedToRws(const int32_t speedRw0, const int32_t speedRw1, const int32_t speedRw2,
|
|
|
|
const int32_t speedRw3, const double sampleTime, const double inertiaWheel,
|
|
|
|
const int32_t maxRwSpeed, const double *rwTorque, int32_t *rwCmdSpeed);
|
2022-09-19 15:03:25 +02:00
|
|
|
|
2022-12-13 11:51:03 +01:00
|
|
|
/*
|
2023-04-27 10:33:43 +02:00
|
|
|
* @brief: cmdDipoleMtq() gives the commanded dipole moment for the
|
|
|
|
* magnetorquer
|
2022-12-13 11:51:03 +01:00
|
|
|
*
|
2023-04-27 10:33:43 +02:00
|
|
|
* @param: dipoleMoment given dipole moment in spacecraft frame
|
|
|
|
* dipoleMomentActuator resulting dipole moment in actuator reference frame
|
2022-12-13 11:51:03 +01:00
|
|
|
*/
|
2023-04-27 10:33:43 +02:00
|
|
|
void cmdDipoleMtq(const double *inverseAlignment, const double maxDipole,
|
|
|
|
const double *dipoleMoment, int16_t *dipoleMomentActuator);
|
2022-09-19 15:03:25 +02:00
|
|
|
|
2022-11-03 10:43:27 +01:00
|
|
|
protected:
|
|
|
|
private:
|
2023-04-27 10:19:07 +02:00
|
|
|
static constexpr double RAD_PER_SEC_TO_RPM = 60 / (2 * M_PI);
|
2022-09-19 15:03:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ACTUATORCMD_H_ */
|