-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathattRefCorrection.cpp
More file actions
50 lines (42 loc) · 2.09 KB
/
Copy pathattRefCorrection.cpp
File metadata and controls
50 lines (42 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// SPDX-License-Identifier: ISC
// Copyright (c) 2021, Autonomous Vehicle System Lab, University of Colorado at Boulder
// Copyright (c) 2025, Laboratory for Atmospheric and Space Physics, University of Colorado at Boulder
#include <architecture/utilities/eigenSupport.h>
#include <architecture/utilities/rigidBodyKinematics.hpp>
#include "attRefCorrection.h"
#include <stdexcept>
/*! This method performs a complete reset of the module. Local module variables that retain
time varying states between function calls are reset to their default values.
Check if required input messages are connected.
@return void
@param callTime [ns] time the method is called
*/
void AttRefCorrection::reset(uint64_t callTime) {
// check if the required message has not been connected
if (!this->attRefInMsg.isLinked()) {
throw std::invalid_argument("attRefCorrection.attRefInMsg wasn't connected.");
}
}
/*! Corrects the reference attitude message by a fixed rotation
@return void
@param callTime The clock time at which the function was called (nanoseconds)
*/
void AttRefCorrection::updateState(uint64_t const callTime) {
// read in the input messages
AttRefMsgPayload attRefMsgBuffer = this->attRefInMsg();
Eigen::Vector3d sigma_RN_local = cArrayToEigenVector3(attRefMsgBuffer.sigma_RN);
// compute corrected reference orientation
sigma_RN_local = addMrp(sigma_RN_local, this->sigma_RR0);
// write to the output messages
eigenVectorToCArray(sigma_RN_local, attRefMsgBuffer.sigma_RN);
this->attRefOutMsg.write(attRefMsgBuffer, this->moduleID, callTime);
}
/*! Setter method for the current MRP attitude coordinate set with respect to the input reference
@return void
@param sigmaRR0 [-] current MRP attitude coordinate set with respect to the input reference
*/
void AttRefCorrection::setSigmaRR0(const Eigen::Vector3d& sigma) { this->sigma_RR0 = sigma; }
/*! Getter method for the current MRP attitude coordinate set with respect to the input reference
@return const Eigen::Vector3d
*/
const Eigen::Vector3d AttRefCorrection::getSigmaRR0() const { return this->sigma_RR0; }