ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
PidAttitudeControl.h
1/******************************************************************************
2* Copyright (c) ATTX LLC 2024. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX, LLC. The Software is
6* furnished under a license agreement between ATTX and the user organization
7* and may be used or copied only in accordance with the terms of the agreement.
8* Refer to 'license/attx_license.adoc' for standard license terms.
9*
10* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13* transmitted in any form or by any means, for any purpose, without the express
14* written permission of ATTX, LLC.
15******************************************************************************/
16/*
17Simple PID header file
18
19Author: Alex Reynolds
20*/
21
22#ifndef GNC_CONTROL_PID_ATTITUDE_CONTROL_H
23#define GNC_CONTROL_PID_ATTITUDE_CONTROL_H
24
25#include "core/macros.h"
26#include "architecture/Tasks.h"
27#include "six_dof_dynamics/Frame.hpp"
28#include "utils/frameutils.hpp"
29
30namespace clockwerk {
31
32 /**
33 * @brief Simple attitude controller header file
34 *
35 * This file implements PD attitude control
36 */
37 class PidAttitudeControl : public clockwerk::Task {
38 public:
39 // Model params
40 // NAME TYPE DEFAULT VALUE
42 /** The proportional weight in the PD controller */
43 SIGNAL(P, double, 0.0)
44 /** The angular acceleration (derivative) weight in the pD controller */
45 SIGNAL(K, double, 0.0)
47
48 // Model inputs
49 // NAME TYPE DEFAULT VALUE
51 /** The commanded attitude. This is the desired state for the system to achieve */
52 SIGNAL(cmd_state, QuaternionD, QuaternionD({0.0,0.0,0.0,0.0}))
53 /** The actual state vector. This is the current state of the system */
54 SIGNAL(act_state, QuaternionD, QuaternionD({0.0,0.0,0.0,0.0}))
55 /** The commanded angular velocity. */
57 /** The actual angular velocity. */
60
61 // Model outputs
62 // NAME TYPE DEFAULT VALUE
64 /** The control command provided by the controller */
66 /** The current error in the system - actual - cmd */
67 SIGNAL(error_quat, QuaternionD, QuaternionD({0.0,0.0,0.0,0.0}))
68 /** The magnitude of the error angle between control and actual attitude */
69 SIGNAL(error_angle, double, 0.0)
70 /** The current error in the system - actual - cmd */
73
74 // Model-specific implementations of startup and derivative
75 PidAttitudeControl() : clockwerk::Task() {}
76 PidAttitudeControl(clockwerk::Task &pnt, int schedule_slot=0, const std::string &m_name="simple_pid_task")
77 : clockwerk::Task(pnt, schedule_slot, m_name) {}
78 PidAttitudeControl(clockwerk::Executive &e, int schedule_slot=0, const std::string &m_name="simple_pid_task")
79 : clockwerk::Task(e, schedule_slot, m_name) {}
80 virtual ~PidAttitudeControl() {}
81 protected:
82 int execute();
83 };
84
85}
86
87#endif
Central control mechanism to run simulations and software.
Definition Executive.h:43
Simple attitude controller header file.
Definition PidAttitudeControl.h:37
int execute()
Function to execute the task. All math and calculations should be here.
Definition PidAttitudeControl.cpp:22
This is the base implementation of the task class.
Definition Tasks.h:68
Task()
Default constructor for the task object for simplicity. Note: Masks some functionality and should not...
Definition Tasks.cpp:21
Task(Task &pnt, int slot, const std::string &m_name="Unnamed")
Task-based constructor for the task. Auto-assigns executive.
Definition Tasks.cpp:47
Task(Executive &executive, int slot, const std::string &m_name="Unnamed")
Executive-based constructor for the task.
Definition Tasks.cpp:62
#define SIGNAL(NAME, TYPE, INITIAL_VALUE)
Definition macros.h:87
#define START_PARAMS
Definition macros.h:96
#define CartesianVector3D
Definition macros.h:54
#define END_OUTPUTS
Definition macros.h:90
#define END_PARAMS
Definition macros.h:98
#define QuaternionD
Definition macros.h:78
#define START_OUTPUTS
Definition macros.h:88
#define END_INPUTS
Definition macros.h:94
#define START_INPUTS
Definition macros.h:92
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > cmd_ang_vel
Definition PidAttitudeControl.h:56
clockwerk::DataIO< clockwerk::Quaternion< double > > act_state
Definition PidAttitudeControl.h:54
clockwerk::DataIO< clockwerk::Quaternion< double > > cmd_state
Definition PidAttitudeControl.h:52
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > act_ang_vel
Definition PidAttitudeControl.h:58
clockwerk::DataIO< clockwerk::Quaternion< double > > error_quat
Definition PidAttitudeControl.h:67
clockwerk::DataIO< double > error_angle
Definition PidAttitudeControl.h:69
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > control_cmd
Definition PidAttitudeControl.h:65
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > error_omega
Definition PidAttitudeControl.h:71
clockwerk::DataIO< double > K
Definition PidAttitudeControl.h:45
clockwerk::DataIO< double > P
Definition PidAttitudeControl.h:43