diff --git a/missions/alder/XLOG_SHORESIDE_16_6_2025_____22_24_59/XLOG_SHORESIDE_16_6_2025_____22_24_59.slog b/missions/alder/XLOG_SHORESIDE_16_6_2025_____22_24_59/XLOG_SHORESIDE_16_6_2025_____22_24_59.slog new file mode 100644 index 0000000..087c2a5 --- /dev/null +++ b/missions/alder/XLOG_SHORESIDE_16_6_2025_____22_24_59/XLOG_SHORESIDE_16_6_2025_____22_24_59.slog @@ -0,0 +1,507 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOG FILE: ./XLOG_SHORESIDE_16_6_2025_____22_24_59/XLOG_SHORESIDE_16_6_2025_____22_24_59.slog +%% FILE OPENED ON Thu Jan 1 08:00:00 1970 +%% LOGSTART 1750083899.229048 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% (1) TIME +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TIME +%% TIME +0.753351 +%% TIME +%% TIME +0.9541769 +1.154654 +1.355344 +1.555892 +1.756309 +1.957507 +2.159124 +2.359773 +2.56044 +2.761579 +2.962356 +3.163624 +3.364308 +3.564977 +3.765584 +3.966173 +4.166899 +4.367947 +4.56872 +4.769442 +4.970057 +5.170623 +5.3714 +5.572141 +5.772642 +5.973307 +6.173816 +6.374367 +6.575039 +6.775772 +%% TIME +%% TIME +6.976394 +7.176887 +7.377504 +7.578273 +7.779018 +7.979556 +8.180116 +8.380661 +8.581375 +8.782269 +8.982922 +9.183596 +9.384163 +9.585023 +9.785771 +9.986298 +10.18705 +10.38767 +10.58915 +10.78978 +10.99054 +11.19117 +11.39183 +11.59261 +11.79331 +11.99397 +12.19466 +12.39533 +12.59607 +12.79691 +%% TIME +%% TIME +12.99757 +13.19839 +13.40052 +13.60162 +13.80216 +14.00297 +14.20373 +14.40436 +14.60503 +14.80572 +15.00716 +15.20774 +15.40825 +15.60892 +15.80956 +16.01028 +16.21093 +16.41163 +16.61239 +16.81314 +17.01373 +17.21427 +17.41495 +17.61559 +17.81621 +18.01677 +18.21732 +18.41789 +18.61861 +18.82008 +%% TIME +%% TIME +19.02093 +19.22154 +19.4222 +19.62307 +19.82388 +20.02439 +20.22731 +20.42817 +20.6296 +20.83033 +21.03077 +21.23151 +21.43203 +21.63292 +21.83371 +22.03494 +22.23552 +22.43613 +22.63677 +22.83751 +23.03813 +23.23886 +23.43951 +23.64017 +23.84067 +24.04121 +24.24189 +24.44258 +24.64337 +24.844 +%% TIME +%% TIME +25.04463 +25.2452 +25.44573 +25.64626 +25.847 +26.04751 +26.24819 +26.44885 +26.64966 +26.85041 +27.05103 +27.25183 +27.45259 +27.65336 +27.85387 +28.05447 +28.25517 +28.45659 +28.65718 +28.85778 +29.05839 +29.25912 +29.45987 +29.66105 +29.86174 +30.06238 +30.26313 +30.46388 +30.66472 +30.86538 +%% TIME +%% TIME +31.06595 +31.26655 +31.46723 +31.66805 +31.86872 +32.06911 +32.26977 +32.47035 +32.67114 +32.87194 +33.0725 +33.27309 +33.47374 +33.67441 +33.87498 +34.07561 +34.27614 +34.47669 +34.67736 +34.87791 +35.07867 +35.27921 +35.4797 +35.68037 +35.88092 +36.0815 +36.28229 +36.48282 +36.68356 +36.88418 +%% TIME +%% TIME +37.08485 +37.28559 +37.48616 +37.68695 +37.88758 +38.08825 +38.28895 +38.48963 +38.69037 +38.89095 +39.09159 +39.2921 +39.49272 +39.69319 +39.894 +40.09477 +40.2954 +40.49589 +40.69654 +40.89731 +41.0981 +41.29871 +41.49917 +41.69975 +41.90029 +42.10097 +42.30172 +42.50249 +42.70328 +42.904 +%% TIME +%% TIME +43.10473 +43.30688 +43.50759 +43.70835 +43.90911 +44.10994 +44.31045 +44.51092 +44.71182 +44.91255 +45.11345 +45.31411 +45.51459 +45.7152 +45.9157 +46.11637 +46.31697 +46.51752 +46.71834 +46.91902 +47.11984 +47.32065 +47.52125 +47.7226 +47.92329 +48.12404 +48.32464 +48.52522 +48.72574 +48.92664 +%% TIME +%% TIME +49.1275 +49.32804 +49.52874 +49.7295 +49.93018 +50.13099 +50.33162 +50.53217 +50.73272 +50.93353 +51.13435 +51.33578 +51.53632 +51.73706 +51.93772 +52.13849 +52.33924 +52.53995 +52.74131 +52.94199 +53.14274 +53.34349 +53.54407 +53.74475 +53.94528 +54.14598 +54.34656 +54.547 +54.74763 +54.94835 +%% TIME +%% TIME +55.14907 +55.34962 +55.55006 +55.75082 +55.95134 +56.15204 +56.35268 +56.55323 +56.75382 +56.95457 +57.15536 +57.35608 +57.55659 +57.75765 +57.95828 +58.15882 +58.35953 +58.55999 +58.76058 +58.96128 +59.16228 +59.36293 +59.56335 +59.764 +59.9645 +60.16511 +60.36572 +60.56624 +60.76684 +60.96766 +%% TIME +%% TIME +61.16849 +61.36899 +61.5695 +61.77005 +61.9706 +62.17123 +62.3718 +62.57225 +62.77296 +62.97364 +63.1745 +63.37505 +63.5755 +63.77626 +63.97674 +64.17739 +64.37793 +64.57839 +64.77893 +64.97951 +65.18021 +65.3808 +65.58128 +65.782 +65.98256 +66.18323 +66.38409 +66.58549 +66.78604 +66.98836 +%% TIME +%% TIME +67.18904 +67.38967 +67.59016 +67.79091 +67.99137 +68.19202 +68.39277 +68.59335 +68.794 +68.99486 +69.19559 +69.39615 +69.59659 +69.79731 +69.99776 +70.19827 +70.39908 +70.59954 +70.80009 +71.00086 +71.20138 +71.40195 +71.60251 +71.80303 +72.00341 +72.20387 +72.40451 +72.60503 +72.8055 +73.0064 +%% TIME +%% TIME +73.20704 +73.40755 +73.60801 +73.80876 +74.00935 +74.20996 +74.41052 +74.61089 +74.81154 +75.0123 +75.21298 +75.41346 +75.61402 +75.81472 +76.0154 +76.21598 +76.4164 +76.61682 +76.81735 +77.01857 +77.21921 +77.41978 +77.62023 +77.82092 +78.02147 +78.22216 +78.42275 +78.62348 +78.82409 +79.02489 +%% TIME +%% TIME +79.22562 +79.42619 +79.6267 +79.82731 +80.02774 +80.2284 +80.42915 +80.63017 +80.83089 +81.03153 +81.23204 +81.43256 +81.63315 +81.83399 +82.03449 +82.23539 +82.43602 +82.63671 +82.83746 +83.03824 +83.23917 +83.4398 +83.64045 +83.84125 +84.04179 +84.24239 +84.44314 +84.64379 +84.84455 +85.04534 +%% TIME +%% TIME +85.24831 +85.54721 +85.74793 +85.94861 +86.14924 +86.35003 +86.55062 +86.7512 +86.95184 +87.15264 +87.35327 +87.55388 +87.75448 +87.95504 +88.1557 +88.35626 +88.55692 +88.75752 +88.95807 +89.159 +89.35971 +89.56033 +89.76098 +89.96161 +90.16245 +90.36322 +90.564 +90.76487 +90.9655 +91.16648 +%% TIME +%% TIME +91.36718 +91.56772 +91.76833 +91.96926 +92.17004 +92.37056 +92.57115 +92.77188 +92.9725 +93.17327 +93.37389 +93.57453 +93.77508 +93.97559 +94.17622 diff --git a/missions/alder/alder.moos b/missions/alder/alder.moos index 0d000f4..812c8a7 100644 --- a/missions/alder/alder.moos +++ b/missions/alder/alder.moos @@ -16,12 +16,13 @@ ProcessConfig = ANTLER Run = MOOSDB @ NewConsole = false //Run = uSimMarineV22 @ NewConsole = false Run = pNodeReporter @ NewConsole = false + //Run = pLogger @ NewConsole = false //Run = pMarinePIDV22 @ NewConsole = false Run = pMarineViewer @ NewConsole = false Run = uProcessWatch @ NewConsole = false Run = pHelmIvP @ NewConsole = false Run = pAUV150 @ NewConsole = false - Run = pMotionControler @ NewConsole = false + //Run = pMotionControler @ NewConsole = false } //------------------------------------------ @@ -176,4 +177,25 @@ ProcessConfig = pMotionControler AppTick = 10 CommsTick = 10 config_file = /home/zjk/project/moos-ivp-extend/missions/alder/ControlParam.json +} + +ProcessConfig = pLogger +{ + AppTick = 10 + CommsTick = 10 + + File = XLOG_SHORESIDE + PATH = ./ + SyncLog = true @ 0.2 + AsyncLog = true + FileTimeStamp = true + + LogAuxSrc = true + + // Log it all!!!!! + WildCardLogging = true + + WildCardOmitPattern = *_STATUS + WildCardOmitPattern = DB_VARSUMMARY + WildCardOmitPattern = DB_RWSUMMARY } \ No newline at end of file diff --git a/src/pAUV150/AUV150.cpp b/src/pAUV150/AUV150.cpp index 7ab526b..4d5c8da 100644 --- a/src/pAUV150/AUV150.cpp +++ b/src/pAUV150/AUV150.cpp @@ -17,6 +17,9 @@ using namespace std; +// 添加静态成员定义 +Controler AUV150::m_control; + static bool TCP_ReadLoop(void *p) { AUV150 *pAUV150 = (AUV150 *)p; @@ -49,6 +52,8 @@ AUV150::AUV150() m_desiredVarTime = 0; m_controlTime = 0; m_samplingTime = 0; + + m_control.initialize(); } //--------------------------------------------------------- @@ -102,7 +107,19 @@ bool AUV150::OnNewMail(MOOSMSG_LIST &NewMail) { m_CommandFrame.mainThruster = msg.GetDouble(); } - else if(key != "APPCAST_REQ") // handled by AppCastingMOOSApp + else if(key == "DESIRED_HEADING") + { + m_control.rtU.heading_cmd = msg.GetDouble(); + } + else if(key == "DESIRED_SPEED") + { + m_control.rtU.speed_cmd = msg.GetDouble(); + } + else if(key == "DESIRED_DEPTH") + { + m_control.rtU.depth_cmd = msg.GetDouble(); + } + else if(key != "APPCAST_REQ") reportRunWarning("Unhandled Mail: " + key); } @@ -205,6 +222,9 @@ void AUV150::registerVariables() Register("DESIRED_RUDDER",0); Register("DESIRED_THRUST",0); Register("DESIRED_ELEVATOR",0); + Register("DESIRED_HEADING", 0); + Register("DESIRED_SPEED", 0); + Register("DESIRED_DEPTH", 0); } @@ -262,7 +282,16 @@ bool AUV150::ListenLoop() updateStatus(*p); postStatusUpdate("NAV"); // 计算控制量 - + // 修改航向角输入,解决360度临界问题 + m_control.rtU.psi = std::fmod(m_status.trueHeading, 360.0); + m_control.rtU.theta = std::remainder(m_status.pitch, 360.0); + m_control.rtU.z = m_status.depthSensor; + m_control.step(); + m_CommandFrame.rudderUp = -m_control.rtY.DirectUpperRudderServoAngleCmd; + m_CommandFrame.rudderDown = -m_control.rtY.DirectLowerRudderServoAngleCmd; + m_CommandFrame.rudderLeft = m_control.rtY.DirectLeftRudderServoAngleCmd; + m_CommandFrame.rudderRight = m_control.rtY.DirectRightRudderServoAngleCmd; + m_CommandFrame.mainThruster = m_control.rtY.MainThrusterSpeedCmd; // 发送消息 try { @@ -278,7 +307,6 @@ bool AUV150::ListenLoop() << e.sGetException() << "\n"; } - // 计算控制频率 m_samplingTime = MOOSTime(); message_count++; @@ -411,6 +439,12 @@ bool AUV150::buildReport() m_msgs << oss.str() << std::endl << std::endl; }; + //=================DEGUB========================== + + m_msgs << "rudder_L" << m_control.rtY.DirectLowerRudderServoAngleCmd << std::endl; + m_msgs << "rudder_R" << m_control.rtY.DirectRightRudderServoAngleCmd << std::endl; + m_msgs << "thrust" << m_control.rtY.MainThrusterSpeedCmd << std::endl; + // =============== Navigation Info =============== printTable( {"Connect", "Read", "Writ" ,"Conter" ,"Server ip","Latitude", "Longitude","Gap"}, @@ -425,26 +459,12 @@ bool AUV150::buildReport() doubleToString(m_controlGap, 5) + "s" } ); - // printTable( - // {"Connect", "Read", "Writ" ,"Conter" ,"Gap","Gap2"}, - // { - // (isConnected() ? "Yes" : "No"), - // doubleToString(getRealReadFreq(), 4) + " Hz", - // doubleToString(getRealWriteFreq(), 4) + " Hz", - // ulintToString(getCounter()), - // doubleToString(m_controlGap, 5) + "s", - // doubleToString((m_controlTime-m_samplingTime),5) - // } -// ); m_msgs << "Fault Codes: "; for (uint8_t code : getFaultCodes()) { m_msgs << uintToString(code) + " "; } m_msgs << std::endl; m_msgs << "Navigation Mode : " << uintToString(m_status.navModeFb) << std::endl; - // m_msgs << "Origin Latitude : " << m_OriginLatitude << endl; - // m_msgs << "Origin Longitude : " << m_OriginLongitude << endl; - // m_msgs << "---------------------------------\n"; // =============== Heading & Attitude =============== printTable( {"Heading", "Pitch", "Roll", "X", "Y", "Z", "H"}, diff --git a/src/pAUV150/AUV150.h b/src/pAUV150/AUV150.h index 6135473..18dab76 100644 --- a/src/pAUV150/AUV150.h +++ b/src/pAUV150/AUV150.h @@ -14,6 +14,8 @@ #include "MOOS/libMOOS/Utils/MOOSThread.h" #include "MOOS/libMOOS/Utils/MOOSUtilityFunctions.h" #include "MOOS/libMOOSGeodesy/MOOSGeodesy.h" +#include "Controler/Controler.h" +#include "AngleUtils.h" #include #include @@ -179,6 +181,9 @@ private: // State variables double m_controlTime; double m_samplingTime; + + //控制器 + static Controler m_control; }; #endif diff --git a/src/pAUV150/CMakeLists.txt b/src/pAUV150/CMakeLists.txt index eab7a55..0df5049 100644 --- a/src/pAUV150/CMakeLists.txt +++ b/src/pAUV150/CMakeLists.txt @@ -16,6 +16,14 @@ SET(SRC AUV150.cpp AUV150_Info.cpp main.cpp + # 添加Controller源文件 + ${CMAKE_CURRENT_SOURCE_DIR}/Controler/Controler.cpp +) + +# 添加头文件目录 +include_directories( + ${MOOSGEODESY_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR}/Controler ) ADD_EXECUTABLE(pAUV150 ${SRC}) @@ -23,6 +31,7 @@ ADD_EXECUTABLE(pAUV150 ${SRC}) TARGET_LINK_LIBRARIES(pAUV150 ${MOOS_LIBRARIES} ${MOOSGEODESY_LIBRARIES} + geometry apputil mbutil m diff --git a/src/pAUV150/Controler/Controler.cpp b/src/pAUV150/Controler/Controler.cpp new file mode 100644 index 0000000..2dcdd89 --- /dev/null +++ b/src/pAUV150/Controler/Controler.cpp @@ -0,0 +1,177 @@ +// +// Academic License - for use in teaching, academic research, and meeting +// course requirements at degree granting institutions only. Not for +// government, commercial, or other organizational use. +// +// File: Controler.cpp +// +// Code generated for Simulink model 'Controler'. +// +// Model version : 5.11 +// Simulink Coder version : 24.2 (R2024b) 21-Jun-2024 +// C/C++ source code generated on : Tue Jun 17 18:31:17 2025 +// +// Target selection: ert.tlc +// Embedded hardware selection: Intel->x86-64 (Linux 64) +// Code generation objectives: +// 1. Execution efficiency +// 2. RAM efficiency +// Validation result: Not run +// +#include "Controler.h" +#include "rtwtypes.h" + +// Model step function +void Controler::step() +{ + real_T rtb_FilterCoefficient; + real_T rtb_FilterCoefficient_a; + real_T rtb_FilterCoefficient_lc; + real_T rtb_IntegralGain; + real_T rtb_Sum1; + real_T rtb_Sum2; + + // Outputs for Atomic SubSystem: '/Controler' + // Sum: '/Sum' incorporates: + // Inport: '/heading_cmd' + // Inport: '/psi' + + rtb_Sum1 = rtU.heading_cmd - rtU.psi; + + // Gain: '/Filter Coefficient' incorporates: + // DiscreteIntegrator: '/Filter' + // Gain: '/Derivative Gain' + // Sum: '/SumD' + + rtb_FilterCoefficient = (0.01 * rtb_Sum1 - rtDW.Filter_DSTATE) * 10.0; + + // Outport: '/DirectUpperRudderServoAngleCmd' incorporates: + // DiscreteIntegrator: '/Integrator' + // Gain: '/Proportional Gain' + // Sum: '/Sum' + + rtY.DirectUpperRudderServoAngleCmd = (0.1 * rtb_Sum1 + rtDW.Integrator_DSTATE) + + rtb_FilterCoefficient; + + // Gain: '/Integral Gain' + rtb_IntegralGain = 0.0 * rtb_Sum1; + + // Sum: '/Sum1' incorporates: + // Inport: '/depth_cmd' + // Inport: '/z' + + rtb_Sum1 = rtU.z - rtU.depth_cmd; + + // Gain: '/Filter Coefficient' incorporates: + // DiscreteIntegrator: '/Filter' + // Gain: '/Derivative Gain' + // Sum: '/SumD' + + rtb_FilterCoefficient_lc = (0.0 * rtb_Sum1 - rtDW.Filter_DSTATE_m) * 10.0; + + // Sum: '/Sum2' incorporates: + // DiscreteIntegrator: '/Integrator' + // Gain: '/Proportional Gain' + // Inport: '/theta' + // Sum: '/Sum' + + rtb_Sum2 = ((2.0 * rtb_Sum1 + rtDW.Integrator_DSTATE_o) + + rtb_FilterCoefficient_lc) - rtU.theta; + + // Gain: '/Filter Coefficient' incorporates: + // DiscreteIntegrator: '/Filter' + // Gain: '/Derivative Gain' + // Sum: '/SumD' + + rtb_FilterCoefficient_a = (0.1 * rtb_Sum2 - rtDW.Filter_DSTATE_l) * 10.0; + + // Outport: '/DirectLeftRudderServoAngleCmd' incorporates: + // DiscreteIntegrator: '/Integrator' + // Gain: '/Proportional Gain' + // Sum: '/Sum' + + rtY.DirectLeftRudderServoAngleCmd = (0.5 * rtb_Sum2 + rtDW.Integrator_DSTATE_f) + + rtb_FilterCoefficient_a; + + // Update for DiscreteIntegrator: '/Filter' + rtDW.Filter_DSTATE += 0.1 * rtb_FilterCoefficient; + + // Update for DiscreteIntegrator: '/Integrator' + rtDW.Integrator_DSTATE += 0.1 * rtb_IntegralGain; + + // Update for DiscreteIntegrator: '/Filter' + rtDW.Filter_DSTATE_m += 0.1 * rtb_FilterCoefficient_lc; + + // Update for DiscreteIntegrator: '/Integrator' incorporates: + // Gain: '/Integral Gain' + + rtDW.Integrator_DSTATE_o += 0.0 * rtb_Sum1 * 0.1; + + // Update for DiscreteIntegrator: '/Filter' + rtDW.Filter_DSTATE_l += 0.1 * rtb_FilterCoefficient_a; + + // Update for DiscreteIntegrator: '/Integrator' incorporates: + // Gain: '/Integral Gain' + + rtDW.Integrator_DSTATE_f += 0.0 * rtb_Sum2 * 0.1; + + // End of Outputs for SubSystem: '/Controler' + + // Outport: '/MainThrusterSpeedCmd' incorporates: + // Constant: '/Constant' + + rtY.MainThrusterSpeedCmd = 100.0; + + // Outport: '/DirectLowerRudderServoAngleCmd' incorporates: + // Constant: '/Constant2' + + rtY.DirectLowerRudderServoAngleCmd = 1.0; + + // Outport: '/DirectRightRudderServoAngleCmd' incorporates: + // Constant: '/Constant4' + + rtY.DirectRightRudderServoAngleCmd = 1.0; +} + +// Model initialize function +void Controler::initialize() +{ + // (no initialization code required) +} + +const char_T* Controler::RT_MODEL::getErrorStatus() const +{ + return (errorStatus); +} + +void Controler::RT_MODEL::setErrorStatus(const char_T* const volatile + aErrorStatus) +{ + (errorStatus = aErrorStatus); +} + +// Constructor +Controler::Controler() : + rtU(), + rtY(), + rtDW(), + rtM() +{ + // Currently there is no constructor body generated. +} + +// Destructor +// Currently there is no destructor body generated. +Controler::~Controler() = default; + +// Real-Time Model get method +Controler::RT_MODEL * Controler::getRTM() +{ + return (&rtM); +} + +// +// File trailer for generated code. +// +// [EOF] +// diff --git a/src/pAUV150/Controler/Controler.h b/src/pAUV150/Controler/Controler.h new file mode 100644 index 0000000..184f3f2 --- /dev/null +++ b/src/pAUV150/Controler/Controler.h @@ -0,0 +1,314 @@ +// +// Academic License - for use in teaching, academic research, and meeting +// course requirements at degree granting institutions only. Not for +// government, commercial, or other organizational use. +// +// File: Controler.h +// +// Code generated for Simulink model 'Controler'. +// +// Model version : 5.11 +// Simulink Coder version : 24.2 (R2024b) 21-Jun-2024 +// C/C++ source code generated on : Tue Jun 17 18:31:17 2025 +// +// Target selection: ert.tlc +// Embedded hardware selection: Intel->x86-64 (Linux 64) +// Code generation objectives: +// 1. Execution efficiency +// 2. RAM efficiency +// Validation result: Not run +// +#ifndef Controler_h_ +#define Controler_h_ +#include +#include "rtwtypes.h" +#include "Controler_types.h" + +// Class declaration for model Controler +class Controler final +{ + // public data and function members + public: + // Block signals and states (default storage) for system '' + struct DW { + real_T Filter_DSTATE; // '/Filter' + real_T Integrator_DSTATE; // '/Integrator' + real_T Filter_DSTATE_m; // '/Filter' + real_T Integrator_DSTATE_o; // '/Integrator' + real_T Filter_DSTATE_l; // '/Filter' + real_T Integrator_DSTATE_f; // '/Integrator' + }; + + // External inputs (root inport signals with default storage) + struct ExtU { + real_T u; // '/u' + real_T v; // '/v' + real_T w; // '/w' + real_T phi; // '/phi' + real_T theta; // '/theta' + real_T psi; // '/psi' + real_T x; // '/x' + real_T y; // '/y' + real_T z; // '/z' + real_T dx; // '/dx' + real_T dy; // '/dy' + real_T dz; // '/dz' + real_T speed_cmd; // '/speed_cmd' + real_T heading_cmd; // '/heading_cmd' + real_T depth_cmd; // '/depth_cmd' + }; + + // External outputs (root outports fed by signals with default storage) + struct ExtY { + real_T MainThrusterSpeedCmd; // '/MainThrusterSpeedCmd' + real_T DirectUpperRudderServoAngleCmd; + // '/DirectUpperRudderServoAngleCmd' + real_T DirectLowerRudderServoAngleCmd; + // '/DirectLowerRudderServoAngleCmd' + real_T DirectLeftRudderServoAngleCmd; + // '/DirectLeftRudderServoAngleCmd' + real_T DirectRightRudderServoAngleCmd; + // '/DirectRightRudderServoAngleCmd' + }; + + // Real-time Model Data Structure + struct RT_MODEL { + const char_T * volatile errorStatus; + const char_T* getErrorStatus() const; + void setErrorStatus(const char_T* const volatile aErrorStatus); + }; + + // Copy Constructor + Controler(Controler const&) = delete; + + // Assignment Operator + Controler& operator= (Controler const&) & = delete; + + // Move Constructor + Controler(Controler &&) = delete; + + // Move Assignment Operator + Controler& operator= (Controler &&) = delete; + + // Real-Time Model get method + Controler::RT_MODEL * getRTM(); + + // External inputs + ExtU rtU; + + // External outputs + ExtY rtY; + + // model initialize function + static void initialize(); + + // model step function + void step(); + + // Constructor + Controler(); + + // Destructor + ~Controler(); + + // private data and function members + private: + // Block states + DW rtDW; + + // Real-Time Model + RT_MODEL rtM; +}; + +//- +// These blocks were eliminated from the model due to optimizations: +// +// Block '/Scope1' : Unused code path elimination + + +//- +// The generated code includes comments that allow you to trace directly +// back to the appropriate location in the model. The basic format +// is /block_name, where system is the system number (uniquely +// assigned by Simulink) and block_name is the name of the block. +// +// Note that this particular code originates from a subsystem build, +// and has its own system numbers different from the parent model. +// Refer to the system hierarchy for this subsystem below, and use the +// MATLAB hilite_system command to trace the generated code back +// to the parent model. For example, +// +// hilite_system('SimModelR2022b_0617/Controler') - opens subsystem SimModelR2022b_0617/Controler +// hilite_system('SimModelR2022b_0617/Controler/Kp') - opens and selects block Kp +// +// Here is the system hierarchy for this model +// +// '' : 'SimModelR2022b_0617' +// '' : 'SimModelR2022b_0617/Controler' +// '' : 'SimModelR2022b_0617/Controler/PID Controller' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Anti-windup' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/D Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/External Derivative' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Filter' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Filter ICs' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/I Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Ideal P Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Ideal P Gain Fdbk' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Integrator' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Integrator ICs' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/N Copy' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/N Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/P Copy' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Parallel P Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Reset Signal' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Saturation' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Saturation Fdbk' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Sum' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Sum Fdbk' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Tracking Mode' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Tracking Mode Sum' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Tsamp - Integral' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Tsamp - Ngain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/postSat Signal' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/preInt Signal' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/preSat Signal' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Anti-windup/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/D Gain/Internal Parameters' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/External Derivative/Error' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Filter/Disc. Forward Euler Filter' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Filter ICs/Internal IC - Filter' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/I Gain/Internal Parameters' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Ideal P Gain/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Ideal P Gain Fdbk/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Integrator/Discrete' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Integrator ICs/Internal IC' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/N Copy/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/N Gain/Internal Parameters' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/P Copy/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Parallel P Gain/Internal Parameters' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Reset Signal/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Saturation/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Saturation Fdbk/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Sum/Sum_PID' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Sum Fdbk/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Tracking Mode/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Tracking Mode Sum/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Tsamp - Integral/TsSignalSpecification' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/Tsamp - Ngain/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/postSat Signal/Forward_Path' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/preInt Signal/Internal PreInt' +// '' : 'SimModelR2022b_0617/Controler/PID Controller/preSat Signal/Forward_Path' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Anti-windup' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/D Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/External Derivative' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Filter' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Filter ICs' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/I Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Ideal P Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Ideal P Gain Fdbk' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Integrator' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Integrator ICs' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/N Copy' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/N Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/P Copy' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Parallel P Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Reset Signal' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Saturation' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Saturation Fdbk' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Sum' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Sum Fdbk' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Tracking Mode' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Tracking Mode Sum' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Tsamp - Integral' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Tsamp - Ngain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/postSat Signal' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/preInt Signal' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/preSat Signal' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Anti-windup/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/D Gain/Internal Parameters' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/External Derivative/Error' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Filter/Disc. Forward Euler Filter' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Filter ICs/Internal IC - Filter' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/I Gain/Internal Parameters' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Ideal P Gain/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Ideal P Gain Fdbk/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Integrator/Discrete' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Integrator ICs/Internal IC' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/N Copy/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/N Gain/Internal Parameters' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/P Copy/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Parallel P Gain/Internal Parameters' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Reset Signal/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Saturation/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Saturation Fdbk/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Sum/Sum_PID' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Sum Fdbk/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Tracking Mode/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Tracking Mode Sum/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Tsamp - Integral/TsSignalSpecification' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/Tsamp - Ngain/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/postSat Signal/Forward_Path' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/preInt Signal/Internal PreInt' +// '' : 'SimModelR2022b_0617/Controler/PID Controller1/preSat Signal/Forward_Path' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Anti-windup' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/D Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/External Derivative' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Filter' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Filter ICs' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/I Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Ideal P Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Ideal P Gain Fdbk' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Integrator' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Integrator ICs' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/N Copy' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/N Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/P Copy' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Parallel P Gain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Reset Signal' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Saturation' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Saturation Fdbk' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Sum' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Sum Fdbk' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Tracking Mode' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Tracking Mode Sum' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Tsamp - Integral' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Tsamp - Ngain' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/postSat Signal' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/preInt Signal' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/preSat Signal' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Anti-windup/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/D Gain/Internal Parameters' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/External Derivative/Error' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Filter/Disc. Forward Euler Filter' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Filter ICs/Internal IC - Filter' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/I Gain/Internal Parameters' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Ideal P Gain/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Ideal P Gain Fdbk/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Integrator/Discrete' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Integrator ICs/Internal IC' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/N Copy/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/N Gain/Internal Parameters' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/P Copy/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Parallel P Gain/Internal Parameters' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Reset Signal/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Saturation/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Saturation Fdbk/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Sum/Sum_PID' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Sum Fdbk/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Tracking Mode/Disabled' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Tracking Mode Sum/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Tsamp - Integral/TsSignalSpecification' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/Tsamp - Ngain/Passthrough' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/postSat Signal/Forward_Path' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/preInt Signal/Internal PreInt' +// '' : 'SimModelR2022b_0617/Controler/PID Controller2/preSat Signal/Forward_Path' + +#endif // Controler_h_ + +// +// File trailer for generated code. +// +// [EOF] +// diff --git a/src/pAUV150/Controler/Controler_private.h b/src/pAUV150/Controler/Controler_private.h new file mode 100644 index 0000000..54d4625 --- /dev/null +++ b/src/pAUV150/Controler/Controler_private.h @@ -0,0 +1,31 @@ +// +// Academic License - for use in teaching, academic research, and meeting +// course requirements at degree granting institutions only. Not for +// government, commercial, or other organizational use. +// +// File: Controler_private.h +// +// Code generated for Simulink model 'Controler'. +// +// Model version : 5.11 +// Simulink Coder version : 24.2 (R2024b) 21-Jun-2024 +// C/C++ source code generated on : Tue Jun 17 18:31:17 2025 +// +// Target selection: ert.tlc +// Embedded hardware selection: Intel->x86-64 (Linux 64) +// Code generation objectives: +// 1. Execution efficiency +// 2. RAM efficiency +// Validation result: Not run +// +#ifndef Controler_private_h_ +#define Controler_private_h_ +#include "rtwtypes.h" +#include "Controler_types.h" +#endif // Controler_private_h_ + +// +// File trailer for generated code. +// +// [EOF] +// diff --git a/src/pAUV150/Controler/Controler_types.h b/src/pAUV150/Controler/Controler_types.h new file mode 100644 index 0000000..5ffc206 --- /dev/null +++ b/src/pAUV150/Controler/Controler_types.h @@ -0,0 +1,29 @@ +// +// Academic License - for use in teaching, academic research, and meeting +// course requirements at degree granting institutions only. Not for +// government, commercial, or other organizational use. +// +// File: Controler_types.h +// +// Code generated for Simulink model 'Controler'. +// +// Model version : 5.11 +// Simulink Coder version : 24.2 (R2024b) 21-Jun-2024 +// C/C++ source code generated on : Tue Jun 17 18:31:17 2025 +// +// Target selection: ert.tlc +// Embedded hardware selection: Intel->x86-64 (Linux 64) +// Code generation objectives: +// 1. Execution efficiency +// 2. RAM efficiency +// Validation result: Not run +// +#ifndef Controler_types_h_ +#define Controler_types_h_ +#endif // Controler_types_h_ + +// +// File trailer for generated code. +// +// [EOF] +// diff --git a/src/pAUV150/Controler/rtwtypes.h b/src/pAUV150/Controler/rtwtypes.h new file mode 100644 index 0000000..813c030 --- /dev/null +++ b/src/pAUV150/Controler/rtwtypes.h @@ -0,0 +1,106 @@ +// +// Academic License - for use in teaching, academic research, and meeting +// course requirements at degree granting institutions only. Not for +// government, commercial, or other organizational use. +// +// File: rtwtypes.h +// +// Code generated for Simulink model 'Controler'. +// +// Model version : 5.11 +// Simulink Coder version : 24.2 (R2024b) 21-Jun-2024 +// C/C++ source code generated on : Tue Jun 17 18:31:17 2025 +// +// Target selection: ert.tlc +// Embedded hardware selection: Intel->x86-64 (Linux 64) +// Code generation objectives: +// 1. Execution efficiency +// 2. RAM efficiency +// Validation result: Not run +// + +#ifndef RTWTYPES_H +#define RTWTYPES_H + +// Logical type definitions +#if (!defined(__cplusplus)) +#ifndef false +#define false (0U) +#endif + +#ifndef true +#define true (1U) +#endif +#endif + +//=======================================================================* +// Target hardware information +// Device type: Intel->x86-64 (Linux 64) +// Number of bits: char: 8 short: 16 int: 32 +// long: 64 long long: 64 +// native word size: 64 +// Byte ordering: LittleEndian +// Signed integer division rounds to: Zero +// Shift right on a signed integer as arithmetic shift: on +// ======================================================================= + +//=======================================================================* +// Fixed width word size data types: * +// int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * +// uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * +// real32_T, real64_T - 32 and 64 bit floating point numbers * +// ======================================================================= +typedef signed char int8_T; +typedef unsigned char uint8_T; +typedef short int16_T; +typedef unsigned short uint16_T; +typedef int int32_T; +typedef unsigned int uint32_T; +typedef long int64_T; +typedef unsigned long uint64_T; +typedef float real32_T; +typedef double real64_T; + +//===========================================================================* +// Generic type definitions: boolean_T, char_T, byte_T, int_T, uint_T, * +// real_T, time_T, ulong_T, ulonglong_T. * +// =========================================================================== +typedef double real_T; +typedef double time_T; +typedef unsigned char boolean_T; +typedef int int_T; +typedef unsigned int uint_T; +typedef unsigned long ulong_T; +typedef unsigned long long ulonglong_T; +typedef char char_T; +typedef unsigned char uchar_T; +typedef char_T byte_T; + +//=======================================================================* +// Min and Max: * +// int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * +// uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * +// ======================================================================= +#define MAX_int8_T ((int8_T)(127)) +#define MIN_int8_T ((int8_T)(-128)) +#define MAX_uint8_T ((uint8_T)(255U)) +#define MAX_int16_T ((int16_T)(32767)) +#define MIN_int16_T ((int16_T)(-32768)) +#define MAX_uint16_T ((uint16_T)(65535U)) +#define MAX_int32_T ((int32_T)(2147483647)) +#define MIN_int32_T ((int32_T)(-2147483647-1)) +#define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU)) +#define MAX_int64_T ((int64_T)(9223372036854775807L)) +#define MIN_int64_T ((int64_T)(-9223372036854775807L-1L)) +#define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFUL)) + +// Block D-Work pointer type +typedef void * pointer_T; + +#endif // RTWTYPES_H + +// +// File trailer for generated code. +// +// [EOF] +//