![]() |
WarpTwin
Documentation for WarpTwin models and classes.
|
/******************************************************************************
* Copyright (c) ATTX LLC 2024. All Rights Reserved.
*
* This software and associated documentation (the "Software") are the
* proprietary and confidential information of ATTX, LLC. The Software is
* furnished under a license agreement between ATTX and the user organization
* and may be used or copied only in accordance with the terms of the agreement.
* Refer to 'license/attx_license.adoc' for standard license terms.
*
* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
* transmitted in any form or by any means, for any purpose, without the express
* written permission of ATTX, LLC.
******************************************************************************/
/*
Triad method guidance task header file
Author: Alex Jackson
*/
#ifndef APPS_TWO_AXIS_POINTING_GUIDANCE_H
#define APPS_TWO_AXIS_POINTING_GUIDANCE_H
#include "flight/App.h"
#include "flight/FlightExecutive.h"
#include "core/CartesianVector.hpp"
#include "dynamics/Quaternion.h"
#include "core/mathmacros.h"
#include "telemetry/tlm_TwoAxisPointingGuidance.h"
namespace warpos {
/**
* @brief Two-axis constrained pointing guidance method guidance
*
* This task applies a simple pointing guidance based on the Triad method
* for attitude determination. In this approach, two body axes are selected,
* along with desired vectors in the reference frame to which they should
* point. The task calculates the attitude body/reference which fully meets
* the primary pointing constraint and attempts a best effort at the secondary
* pointing constraint.
*/
class TwoAxisPointingGuidance : public App {
public:
// Model inputs
// NAME TYPE DEFAULT VALUE
START_INPUTS
/** The body axis vector which will be pointed to desired_primary */
SIGNAL(current_primary_body, CartesianVector3, CartesianVector3({1.0, 0.0, 0.0}))
/** The desired primary vector expressed in an arbitrary frame */
SIGNAL(desired_primary, CartesianVector3, CartesianVector3({1.0, 0.0, 0}))
/** The body axis vector which will be pointed to desired_secondary */
SIGNAL(current_secondary_body, CartesianVector3, CartesianVector3({0.0, 1.0, 0.0}))
/** The desired secondary vector expressed in an arbitrary frame */
SIGNAL(desired_secondary, CartesianVector3, CartesianVector3({0.0, 1.0, 0.0}))
END_INPUTS
// Model outputs
// NAME TYPE DEFAULT VALUE
START_OUTPUTS
/** The desired attitude of the s/c body with respect to a reference frame that the desired primary and secondary were expressed in */
SIGNAL(quat_body_ref, clockwerk::Quaternion, clockwerk::Quaternion({1.0, 0.0, 0.0, 0.0}))
END_OUTPUTS
TwoAxisPointingGuidance(FlightExecutive &executive);
virtual ~TwoAxisPointingGuidance() {};
/// @brief Activate the app. The app will step when active.
/// @return Flag indicating success/failure
int16 activate() override;
/// @brief Deactivate the app. The app will not step when deactivated
/// @return Flag indicating success/failure
int16 deactivate() override;
/// @brief Process commands issued to the app
/// @param apid The APID of the command sent
/// @param buffer Pointer to the location of the buffer holding the command
/// @param size The size of the command being sent
/// @return Flag indicating success/failure
int16 command(uint16 apid, uint8* buffer, uint16 size) override;
protected:
int16 start() override;
int16 execute() override;
// Local vectors to establish DCM -- here for speed
CartesianVector3 _body_triadx;
CartesianVector3 _body_triady;
CartesianVector3 _body_triadz;
CartesianVector3 _ref_triadx;
CartesianVector3 _ref_triady;
CartesianVector3 _ref_triadz;
/// Local variables for DCM body/ref to Quaternion conversion
clockwerk::DCM _dcm_body_ref;
clockwerk::Quaternion _quat_body_ref;
// Internal variables for DCMs defined by pointing targets
clockwerk::DCM _body_triad;
clockwerk::DCM _ref_triad;
// Telemetry packet for packing
tlm_gnc_two_axis_pnt_data _tlm_pkt;
};
}
#endif