WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
PidTranslationalControl.h
/******************************************************************************
* Copyright (c) ATTX INC 2025. All Rights Reserved.
*
* This software and associated documentation (the "Software") are the 
* proprietary and confidential information of ATTX INC. 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 INC.
******************************************************************************/
/*
Simple PID header file

Author: Alex Reynolds
*/
/*
Metadata for MS GUI:
imdata = {"exclude" : True}
*/

#ifndef SUPPORT_PID_TRANSLATIONAL_CONTROL_H 
#define SUPPORT_PID_TRANSLATIONAL_CONTROL_H

#include "simulation/Model.h"
#include "frames/Frame.h"
#include "frames/frameutils.h"

namespace warptwin {

    /**
     * @brief   Simple PID controller header file
     * 
     * This model implements a simple PID translational model
     * for simplified GNC control.
    */
    MODEL(PidTranslationalControl)
    public:
        // Model params
        //         NAME                     TYPE                    DEFAULT VALUE
        START_PARAMS
            /** The proportional weight in the PID controller */
            SIGNAL(P,                       double,                 0.0)
            /** The integral weight in the PID controller */
            SIGNAL(I,                       double,                 0.0)
            /** The derivative weight in the PID controller */
            SIGNAL(D,                       double,                 0.0)
        END_PARAMS

        // Model inputs
        //         NAME                     TYPE                    DEFAULT VALUE
        START_INPUTS
            /** The commanded vector. This is the desired state for the system to achieve */
            SIGNAL(cmd_state,               CartesianVector3,       CartesianVector3({0.0,0.0,0.0}))
            /** The actual state vector. This is the current state of the system */
            SIGNAL(act_state,               CartesianVector3,       CartesianVector3({0.0,0.0,0.0}))
            /** The rate of change in the state vector. This is the current rate of change in the system */
            SIGNAL(deriv_state,             CartesianVector3,       CartesianVector3({0.0,0.0,0.0}))
        END_INPUTS

        // Model outputs
        //         NAME                     TYPE                    DEFAULT VALUE
        START_OUTPUTS
            /** The control command provided by the controller */
            SIGNAL(control_cmd,             CartesianVector3,       CartesianVector3({0.0,0.0,0.0}))
            /** The current error in the system - actual - cmd */
            SIGNAL(error,                   CartesianVector3,       CartesianVector3({0.0,0.0,0.0}))
            /** The integrated error in the system -- summation of error over time */
            SIGNAL(integrated_error,        CartesianVector3,       CartesianVector3({0.0,0.0,0.0}))
        END_OUTPUTS

    protected:
        int16 execute();
    };

}

#endif