GPOPS-II教程(3): 航天器最優控制問題

文章目錄

  • 問題描述
  • GPOPS代碼
    • `main function`
    • `continuous function`
    • `endpoint function`
    • 完整代碼
    • 代碼仿真結果
  • 最后

問題描述

例子出自論文 Direct solution of nonlinear optimal control problems using quasilinearization and Chebyshev polynomials(DOI:10.1016/S0016-0032(02)00028-5) Section 5.2. Example 2: Rigid asymmetric spacecraft

題目如下:

一個剛體非對稱航天器控制問題,其狀態方程為

{ ω ˙ 1 = ? I 3 ? I 2 I 1 ω 2 ω 3 + u 1 I 1 , ω ˙ 2 = ? I 1 ? I 3 I 2 ω 1 ω 3 + u 2 I 2 , ω ˙ 3 = ? I 2 ? I 1 I 3 ω 1 ω 2 + u 3 I 3 , (1) \left \{ \begin{matrix} \dot{\omega}_1 = -\frac{I_3-I_2}{I_1} \omega_2 \omega_3 + \frac{u_1}{I_1}, \\ \dot{\omega}_2 = -\frac{I_1-I_3}{I_2} \omega_1 \omega_3 + \frac{u_2}{I_2}, \\ \dot{\omega}_3 = -\frac{I_2-I_1}{I_3} \omega_1 \omega_2 + \frac{u_3}{I_3}, \end{matrix} \right. \tag{1} ? ? ??ω˙1?=?I1?I3??I2??ω2?ω3?+I1?u1??,ω˙2?=?I2?I1??I3??ω1?ω3?+I2?u2??,ω˙3?=?I3?I2??I1??ω1?ω2?+I3?u3??,?(1)

式中, ω 1 \omega_1 ω1? ω 2 \omega_2 ω2? ω 3 \omega_3 ω3? 為航天器的角速度。

控制量為 u 1 u_1 u1? u 2 u_2 u2? u 3 u_3 u3?,目標函數為

J = 0.5 ∫ 0 100 ( u 1 2 + u 2 2 + u 3 2 ) d t . (2) J = 0.5 \int_{0}^{100}(u_1^2+u_2^2+u_3^2) \text{d}t. \tag{2} J=0.50100?(u12?+u22?+u32?)dt.(2)

其余參數為

ω 1 ( 0 ) = 0.01 r/s , ω 1 ( t f ) = 0 r/s , ω 2 ( 0 ) = 0.005 r/s , ω 2 ( t f ) = 0 r/s , ω 3 ( 0 ) = 0.001 r/s , ω 3 ( t f ) = 0 r/s , I 1 = 86.24 kg?m 2 , I 2 = 85.07 kg?m 2 , I 3 = 113.59 kg?m 2 . (3) \begin{array}{lll} \omega_1(0)\ = 0.01\ \text{r/s} &, \ & \omega_1(t_f) = 0 \ \text{r/s}, \\ \omega_2(0)\ = 0.005\ \text{r/s} &, \ & \omega_2(t_f) = 0 \ \text{r/s}, \\ \omega_3(0)\ = 0.001\ \text{r/s} &, \ & \omega_3(t_f) = 0 \ \text{r/s}, \\ I_1=86.24 \ \text{kg m}^2 \ &,\ & I_2=85.07 \ \text{kg m}^2,\\ I_3=113.59 \ \text{kg m}^2. \end{array} \tag{3} ω1?(0)?=0.01?r/sω2?(0)?=0.005?r/sω3?(0)?=0.001?r/sI1?=86.24?kg?m2?I3?=113.59?kg?m2.?,?,?,?,??ω1?(tf?)=0?r/s,ω2?(tf?)=0?r/s,ω3?(tf?)=0?r/s,I2?=85.07?kg?m2,?(3)

GPOPS代碼

main function

首先設置GPOPS-II的參數。式 ( 3 ) (3) (3)給出了所有用到的參數,按照式 ( 3 ) (3) (3)寫出代碼即可。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 功能描述:剛體非對稱航天器控制問題
% 文件名解釋:mainSpacecraftOCP.m 中,main 代表 主函數,
%             Spacecraft 代表 航天器,
%             OCP 代表 最優控制問題
% 作者:Lei Lie
% 時間:2024/06/22
% 版本:1.0
% - 完成了代碼框架的初始搭建
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;clear;close all;
tic;
%% 01.初始參數設置
%-------------------------------------------------------------------------%
%----------------------- 設置問題的求解邊界 ------------------------------%
%-------------------------------------------------------------------------%
% 設置時間
t0 = 0;
tf = 100;
% 設置狀態量初值
w10 = .01;
w20 = .005;
w30 = .001;
% 設置狀態量邊界條件
w1_max = 1;
w1_min = 0;
w2_max = 1;
w2_min = 0;
w3_max = 1;
w3_min = 0;
% 設置控制量初值
u10 = -.009;
u20 = -.004;
u30 = -.001;
% 設置控制量邊界條件
u1_max = 0;
u1_min = -.01;
u2_max = 0;
u2_min = -.01;
u3_max = 0;
u3_min = -.01;
% 設置靜態參數
auxdata.I1 = 86.24;
auxdata.I2 = 85.07;
auxdata.I3 = 113.59;
% 設置不等式約束邊界條件(路徑約束)
path_max = .002;
path_min = 0;%% 02.邊界條件設置
%-------------------------------------------------------------------------%
%------------------------ 將求解邊界設置于問題中 -------------------------%
%-------------------------------------------------------------------------%
bounds.phase.initialtime.lower  = t0; 
bounds.phase.initialtime.upper  = t0;
bounds.phase.finaltime.lower    = tf; 
bounds.phase.finaltime.upper    = tf;
bounds.phase.initialstate.lower = [w10 w20 w30]; 
bounds.phase.initialstate.upper = [w10 w20 w30];
bounds.phase.state.lower        = [w1_min w2_min w3_min]; 
bounds.phase.state.upper        = [w1_max w2_max w3_max];
bounds.phase.finalstate.lower   = [0 0 0];
bounds.phase.finalstate.upper   = [0 0 0];
bounds.phase.control.lower      = [u1_min u2_min u3_min]; 
bounds.phase.control.upper      = [u1_max u2_max u3_max];
bounds.phase.integral.lower     = 0; 
bounds.phase.integral.upper     = 10000;%% 03.初值猜測
%-------------------------------------------------------------------------%
%------------------------------- 初值猜想 --------------------------------%
%-------------------------------------------------------------------------%
guess.phase.time     = [t0; tf]; 
guess.phase.state    = [[w10 w20 w30];[0 0 0]];
guess.phase.control  = [[u10 u20 u30];[u10 u20 u30]];
guess.phase.integral = 100;%% 04.設置GPOPS求解器參數
%-------------------------------------------------------------------------%
%---------------------------- 設置求解器參數 -----------------------------%        
%-------------------------------------------------------------------------%
setup.name = 'Spacecraft-OCP';
setup.functions.continuous  = @socpContinuous;
setup.functions.endpoint   	= @socpEndpoint;
setup.bounds                = bounds;
setup.guess                 = guess;
setup.auxdata               = auxdata;
setup.nlp.solver            = 'ipopt';
setup.derivatives.supplier  = 'sparseCD';
setup.derivatives.derivativelevel = 'second';
setup.mesh.method           = 'hp1';
setup.mesh.tolerance        = 1e-6;
setup.mesh.maxiteration     = 45;
setup.mesh.colpointsmax     = 4;
setup.mesh.colpointsmin     = 10;
setup.mesh.phase.fraction   = 0.1*ones(1,10);
setup.mesh.phase.colpoints  = 4*ones(1,10);
setup.method = 'RPMintegration';%% 05.求解
%-------------------------------------------------------------------------%
%----------------------- 使用 GPOPS2 求解最優控制問題 --------------------%
%-------------------------------------------------------------------------%
output = gpops2(setup);
solution = output.result.solution;
toc;

把結果畫出來,代碼如下。

%% 06.畫圖
t = solution.phase.time(:,1);
w1 = solution.phase.state(:,1);
w2 = solution.phase.state(:,2);
w3 = solution.phase.state(:,3);
u1 = solution.phase.control(:,1);
u2 = solution.phase.control(:,2);
u3 = solution.phase.control(:,3);figure('Color',[1,1,1]);
plot(t,w1,'-','LineWidth',1.5);hold on;
plot(t,w2,'-.','LineWidth',1.5);
plot(t,w3,'--','LineWidth',1.5);
xlabel('Time',...'FontWeight','bold');
ylabel('States',...'FontWeight','bold');
legend('w1','w2','w3',...'LineWidth',1,...'EdgeColor',[1,1,1],...'Orientation','horizontal',...'Position',[0.5,0.93,0.40,0.055]);
set(gca,'FontName','Times New Roman',...'FontSize',15,...'LineWidth',1.3);
print -dpng spacecraft_ocp_state.pngfigure('Color',[1,1,1]);
plot(t,u1,'-','LineWidth',1.5);hold on;
plot(t,u2,'-.','LineWidth',1.5);
plot(t,u3,'--','LineWidth',1.5);
xlabel('Time',...'FontWeight','bold');
ylabel('Control',...'FontWeight','bold');
legend('u1','u2','u3',...'LineWidth',1,...'EdgeColor',[1,1,1],...'Orientation','horizontal',...'Position',[0.5,0.93,0.40,0.055]);
set(gca,'FontName','Times New Roman',...'FontSize',15,...'LineWidth',1.3);
print -dpng spacecraft_ocp_control.png

continuous function

現在寫動力學方程,再把式 ( 1 ) (1) (1)重新寫一遍,放在這里。
{ ω ˙ 1 = ? I 3 ? I 2 I 1 ω 2 ω 3 + u 1 I 1 , ω ˙ 2 = ? I 1 ? I 3 I 2 ω 1 ω 3 + u 2 I 2 , ω ˙ 3 = ? I 2 ? I 1 I 3 ω 1 ω 2 + u 3 I 3 , \left \{ \begin{matrix} \dot{\omega}_1 = -\frac{I_3-I_2}{I_1} \omega_2 \omega_3 + \frac{u_1}{I_1}, \\ \dot{\omega}_2 = -\frac{I_1-I_3}{I_2} \omega_1 \omega_3 + \frac{u_2}{I_2}, \\ \dot{\omega}_3 = -\frac{I_2-I_1}{I_3} \omega_1 \omega_2 + \frac{u_3}{I_3}, \end{matrix} \right. ? ? ??ω˙1?=?I1?I3??I2??ω2?ω3?+I1?u1??,ω˙2?=?I2?I1??I3??ω1?ω3?+I2?u2??,ω˙3?=?I3?I2??I1??ω1?ω2?+I3?u3??,?
那么在代碼中可以這么寫:

dw1 = -((I3-I2)/I1) .* w2 .* w3 + u1 ./ I1;
dw2 = -((I1-I3)/I2) .* w1 .* w3 + u2 ./ I2;
dw3 = -((I2-I1)/I2) .* w1 .* w2 + u3 ./ I3;

性能指標的形式為
J = 0.5 ∫ 0 100 ( u 1 2 + u 2 2 + u 3 2 ) d t . J = 0.5 \int_{0}^{100}(u_1^2+u_2^2+u_3^2) \text{d}t. J=0.50100?(u12?+u22?+u32?)dt.
對應的代碼如下。

phaseout.integrand = 0.5*(u1.^2 + u2.^2 + u3.^2);

那么,continues function的完整代碼如下。

function phaseout = socpContinuous(input)w1 = input.phase.state(:,1);w2 = input.phase.state(:,2);w3 = input.phase.state(:,3);u1 = input.phase.control(:,1);u2 = input.phase.control(:,2);u3 = input.phase.control(:,3);I1 = input.auxdata.I1;I2 = input.auxdata.I2;I3 = input.auxdata.I3;dw1 = -((I3-I2)/I1) .* w2 .* w3 + u1 ./ I1;dw2 = -((I1-I3)/I2) .* w1 .* w3 + u2 ./ I2;dw3 = -((I2-I1)/I2) .* w1 .* w2 + u3 ./ I3;phaseout.dynamics = [dw1 dw2 dw3];phaseout.integrand = 0.5*(u1.^2 + u2.^2 + u3.^2);
end

endpoint function

此處代碼很簡單,只有2行。

function output = socpEndpoint(input)J  = input.phase.integral;output.objective = J;
end

完整代碼

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 功能描述:剛體非對稱航天器控制問題
% 文件名解釋:mainSpacecraftOCP.m 中,main 代表 主函數,
%             Spacecraft 代表 航天器,
%             OCP 代表 最優控制問題
% 作者:Lei Lie
% 時間:2024/06/22
% 版本:1.0
% - 完成了代碼框架的初始搭建
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;clear;close all;
tic;
%% 01.初始參數設置
%-------------------------------------------------------------------------%
%----------------------- 設置問題的求解邊界 ------------------------------%
%-------------------------------------------------------------------------%
% 設置時間
t0 = 0;
tf = 100;
% 設置狀態量初值
w10 = .01;
w20 = .005;
w30 = .001;
% 設置狀態量邊界條件
w1_max = 1;
w1_min = 0;
w2_max = 1;
w2_min = 0;
w3_max = 1;
w3_min = 0;
% 設置控制量初值
u10 = -.009;
u20 = -.004;
u30 = -.001;
% 設置控制量邊界條件
u1_max = 0;
u1_min = -.01;
u2_max = 0;
u2_min = -.01;
u3_max = 0;
u3_min = -.01;
% 設置靜態參數
auxdata.I1 = 86.24;
auxdata.I2 = 85.07;
auxdata.I3 = 113.59;
% 設置不等式約束邊界條件(路徑約束)
path_max = .002;
path_min = 0;%% 02.邊界條件設置
%-------------------------------------------------------------------------%
%------------------------ 將求解邊界設置于問題中 -------------------------%
%-------------------------------------------------------------------------%
bounds.phase.initialtime.lower  = t0; 
bounds.phase.initialtime.upper  = t0;
bounds.phase.finaltime.lower    = tf; 
bounds.phase.finaltime.upper    = tf;
bounds.phase.initialstate.lower = [w10 w20 w30]; 
bounds.phase.initialstate.upper = [w10 w20 w30];
bounds.phase.state.lower        = [w1_min w2_min w3_min]; 
bounds.phase.state.upper        = [w1_max w2_max w3_max];
bounds.phase.finalstate.lower   = [0 0 0];
bounds.phase.finalstate.upper   = [0 0 0];
bounds.phase.control.lower      = [u1_min u2_min u3_min]; 
bounds.phase.control.upper      = [u1_max u2_max u3_max];
bounds.phase.integral.lower     = 0; 
bounds.phase.integral.upper     = 10000;%% 03.初值猜測
%-------------------------------------------------------------------------%
%------------------------------- 初值猜想 --------------------------------%
%-------------------------------------------------------------------------%
guess.phase.time     = [t0; tf]; 
guess.phase.state    = [[w10 w20 w30];[0 0 0]];
guess.phase.control  = [[u10 u20 u30];[u10 u20 u30]];
guess.phase.integral = 100;%% 04.設置GPOPS求解器參數
%-------------------------------------------------------------------------%
%---------------------------- 設置求解器參數 -----------------------------%        
%-------------------------------------------------------------------------%
setup.name = 'Spacecraft-OCP';
setup.functions.continuous  = @socpContinuous;
setup.functions.endpoint   	= @socpEndpoint;
setup.bounds                = bounds;
setup.guess                 = guess;
setup.auxdata               = auxdata;
setup.nlp.solver            = 'ipopt';
setup.derivatives.supplier  = 'sparseCD';
setup.derivatives.derivativelevel = 'second';
setup.mesh.method           = 'hp1';
setup.mesh.tolerance        = 1e-6;
setup.mesh.maxiteration     = 45;
setup.mesh.colpointsmax     = 4;
setup.mesh.colpointsmin     = 10;
setup.mesh.phase.fraction   = 0.1*ones(1,10);
setup.mesh.phase.colpoints  = 4*ones(1,10);
setup.method = 'RPMintegration';%% 05.求解
%-------------------------------------------------------------------------%
%----------------------- 使用 GPOPS2 求解最優控制問題 --------------------%
%-------------------------------------------------------------------------%
output = gpops2(setup);
solution = output.result.solution;
toc;%% 06.畫圖
t = solution.phase.time(:,1);
w1 = solution.phase.state(:,1);
w2 = solution.phase.state(:,2);
w3 = solution.phase.state(:,3);
u1 = solution.phase.control(:,1);
u2 = solution.phase.control(:,2);
u3 = solution.phase.control(:,3);figure('Color',[1,1,1]);
plot(t,w1,'-','LineWidth',1.5);hold on;
plot(t,w2,'-.','LineWidth',1.5);
plot(t,w3,'--','LineWidth',1.5);
xlabel('Time',...'FontWeight','bold');
ylabel('States',...'FontWeight','bold');
legend('w1','w2','w3',...'LineWidth',1,...'EdgeColor',[1,1,1],...'Orientation','horizontal',...'Position',[0.5,0.93,0.40,0.055]);
set(gca,'FontName','Times New Roman',...'FontSize',15,...'LineWidth',1.3);
print -dpng spacecraft_ocp_state.pngfigure('Color',[1,1,1]);
plot(t,u1,'-','LineWidth',1.5);hold on;
plot(t,u2,'-.','LineWidth',1.5);
plot(t,u3,'--','LineWidth',1.5);
xlabel('Time',...'FontWeight','bold');
ylabel('Control',...'FontWeight','bold');
legend('u1','u2','u3',...'LineWidth',1,...'EdgeColor',[1,1,1],...'Orientation','horizontal',...'Position',[0.5,0.93,0.40,0.055]);
set(gca,'FontName','Times New Roman',...'FontSize',15,...'LineWidth',1.3);
print -dpng spacecraft_ocp_control.png%% 函數模塊部分
% ----------------------------------------------------------------------- %
% ------------------------- BEGIN: vsopcContinuous.m -------------------- %
% ----------------------------------------------------------------------- %
function phaseout = socpContinuous(input)w1 = input.phase.state(:,1);w2 = input.phase.state(:,2);w3 = input.phase.state(:,3);u1 = input.phase.control(:,1);u2 = input.phase.control(:,2);u3 = input.phase.control(:,3);I1 = input.auxdata.I1;I2 = input.auxdata.I2;I3 = input.auxdata.I3;dw1 = -((I3-I2)/I1) .* w2 .* w3 + u1 ./ I1;dw2 = -((I1-I3)/I2) .* w1 .* w3 + u2 ./ I2;dw3 = -((I2-I1)/I2) .* w1 .* w2 + u3 ./ I3;phaseout.dynamics = [dw1 dw2 dw3];phaseout.integrand = 0.5*(u1.^2 + u2.^2 + u3.^2);
end
% ----------------------------------------------------------------------- %
% -------------------------- END: vsopcContinuous.m --------------------- %
% ----------------------------------------------------------------------- %% ----------------------------------------------------------------------- %
% -------------------------- BEGIN: vsopcEndpoint.m --------------------- %
% ----------------------------------------------------------------------- %
function output = socpEndpoint(input)J  = input.phase.integral;output.objective = J;
end
% ----------------------------------------------------------------------- %
% --------------------------- END: vsopcEndpoint.m ---------------------- %
% ----------------------------------------------------------------------- %

代碼仿真結果

狀態量:

在這里插入圖片描述

控制量:

在這里插入圖片描述

論文仿真結果:

狀態量:

在這里插入圖片描述

控制量:

在這里插入圖片描述

最后

歡迎通過郵箱聯系我:lordofdapanji@foxmail.com

來信請注明你的身份,否則恕不回信。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/35805.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/35805.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/35805.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

新手選擇代理IP時這幾點誤區一定要避開!

在選擇代理IP時,許多用戶可能會因為對代理IP的認識不足或受到一些誤導,而陷入一些常見的誤區。這些誤區不僅可能導致用戶無法達到預期的效果,還可能帶來一些不必要的風險。下面,IPIDEA代理IP就與大家一同分析在選擇代理IP時需要避…

國企:2024年6月中國鐵路相關招聘信息,6.27截止

中國鐵路濟南局集團有限公司2024年度 招聘普通高校本科及以上學歷畢業生公告(三) 中國鐵路濟南局集團有限公司根據企業發展需要,擬招聘普通高等院校本科及以上學歷畢業生,現將有關事項公告如下: 一、招聘計劃 本次招聘崗位均為生產一線操作技能崗位,具體崗位、專業要求…

【教資優秀作文】

目錄 不沉湎于過去, 向未來進發 轉變思維方式,風景這邊獨好 一英尺的距離 面對逆境,智者生存 機遇與準備 1. 巴西足球名將貝利在足壇初露鋒芒時 ,一個記者問他:“你哪一個球踢得最好? ” 他回答說&am…

說說ThreadLocal的實現原理

ThreadLocal是什么? ThreadLocal是Java中的一個類,用于創建線程局部變量和解決線程安全。每個線程都有自己獨立的變量副本,彼此之間互不影響。它的主要作用是在多線程環境下,確保每個線程都有自己的變量實例,避免了變…

Retrofit類型安全的HTTP客戶端庫(json)

簡介 Retrofit是Square公司開發的一個類型安全的HTTP客戶端庫,用于Android和Java平臺,它使得與Web服務的交互變得更加簡單快捷。Retrofit將HTTP API轉換成Java接口,讓你可以用更簡潔的代碼形式調用RESTful API,Android網絡編程重點…

在前端開發過程中如果函數參數很多,該如何精簡

1. 在前端開發過程中如果函數參數很多,該如何精簡 1.1. 對象參數(對象字面量):1.2. 默認參數和解構賦值:1.3. 使用類或構造函數:1.4. 利用閉包或者高階函數:1.5. 利用ES6的擴展運算符&#xff1…

【LeetCode】每日一題:反轉鏈表

題解思路 循環的方法需要注意prev應該是None開始,然后到結束的時候prev是tail,遞歸的思路很難繞過彎來,主要在于很難想清楚為什么可以返回尾節點,需要多做遞歸題,以及遞歸過程中,可以不使用尾節點來找當前…

Nuxt3 的生命周期和鉤子函數(二)

title: Nuxt3 的生命周期和鉤子函數(二) date: 2024/6/26 updated: 2024/6/26 author: cmdragon excerpt: 摘要:本文深入介紹了Nuxt.js框架中幾個關鍵的生命周期鉤子函數,包括app:redirected(SSR環境下重定向前觸發…

20240626讓飛凌的OK3588-C開發板在相機使用1080p60分辨率下預覽

20240626讓飛凌的OK3588-C開發板在相機使用1080p60分辨率下預覽 2024/6/26 15:15 4.2.1 全編譯測試 在源碼路徑內,提供了編譯腳本 build.sh,運行該腳本對整個源碼進行編譯,需要在終端切換到解壓 出來的源碼路徑,找到 build.sh 文件…

6.26作業

1.整理思維導圖 2.統計家目錄下.c文件的個數 ls ~/*.c | wc -l 3.終端輸入一個.sh文件,判斷文件是否由可執行權限,如果有可執行權限運行腳本,沒有可執行權限添加可執行權限后,再運行腳本 #!/bin/bash read -p "請輸入一個.…

spring模塊(二)SpringBean(2)InitializingBean

一、介紹 InitializingBean是Spring框架提供的一個接口,用于在Bean初始化完成后執行特定的初始化邏輯。 二、使用 1、使用方法 1.1、實現InitializingBean接口 可以讓Bean實現該接口,并重寫其afterPropertiesSet()方法 1.2、注冊 也即讓bean初始化…

從官方源碼精簡出第1個FreeRTOS程序

一、下載官方源碼 1、打開百度搜索freerots,找到官網:FreeRTOS官網 2、將源碼解壓到沒有中文目錄的路徑下 二、刪減目錄 1、刪除FreeRTOS-Plus和tools 2、刪除FreeRTOS/Demo下除CORTEX_STM32F103_Keil外的所有文件 3、刪除FreeRTOS\Source\portable下除RVDS和MemM…

vue2面試題——API

1. $set this.$set(目標對象target&#xff0c;改的位置&#xff0c;最終數據) /* 數據更新了而視圖沒有更新的情況 */ <template><div>{{ arr }}<button clickbtn>按鈕</button></div> </template> <script> export default {name:…

海康威視攝像頭修復

一、適用場景 1、室外安裝的攝像頭&#xff0c;長時間日曬雨淋后&#xff0c;可能因風向導致雨水進入水晶頭&#xff0c;進而攝像頭無法識別&#xff1b; 2、在經常施工的場地&#xff0c;可能由于車輛的進出&#xff0c;或施工設備的運行導致攝像頭的網線水晶頭斷裂而無法使用…

潯川社團正式啟用 代碼付費制度——潯川總社部

潯川社團正式啟用 代碼付費制度。 規則&#xff1a; 潯川社團源代碼收費標準表&#xff08;1&#xff09; 1-5行代碼0.2元/行1-10行代碼0.3元/行1-20行代碼0.5元/行 潯川社團源代碼收費標準表&#xff08;2&#xff09; 1-30行代碼0.6元/行1-40行代碼0.8元/行1-50行代碼0.09元…

【PythonWeb開發】Flask中間件鉤子函數實現封IP

在 Flask 框架中&#xff0c; 提供了幾種類型的鉤子&#xff08;類似于Django的中間件&#xff09;&#xff0c;它們是在請求的不同階段自動調用的函數。這些鉤子讓你能夠對請求和響應的處理流程進行擴展&#xff0c;而無需修改核心代碼。 Flask鉤子的四種類型 before_first_r…

IT入門知識第八部分《云計算》(8/10)

目錄 云計算&#xff1a;現代技術的新篇章 1. 云計算基礎 1.1 云計算的起源和發展 云計算的早期概念 云計算的發展歷程 1.2 云計算的核心特點 按需自助服務 廣泛的網絡訪問 資源池化 快速彈性 按使用量付費 1.3 云計算的優勢和挑戰 成本效益 靈活性和可擴展性 維…

[leetcode]intersection-of-two-arrays-ii 兩個數組的交集 II

. - 力扣&#xff08;LeetCode&#xff09; class Solution { public:vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {sort(nums1.begin(), nums1.end());sort(nums2.begin(), nums2.end());int length1 nums1.size(), length2 …

動態規劃——123. 買賣股票的最佳時機 III

目錄 1、題目鏈接 2、題目分析 1.狀態表示 2.狀態轉移方程 3.初始化 4.填表 5.返回值 3、代碼解析 1、題目鏈接 123. 買賣股票的最佳時機 III 2、題目分析 1.狀態表示 由題目可知&#xff0c;我們分為兩種狀態&#xff0c;買入和賣出&#xff0c;又因為只能完成兩次交易…

windows下如何配置vs code的編譯環境

在 Windows 上配置 VS Code 的編譯環境涉及安裝編譯器、配置 VS Code 以及編寫和運行代碼。以下是具體的步驟&#xff1a; 步驟 1&#xff1a;安裝必要的軟件 安裝 Visual Studio Code&#xff1a; 訪問 VS Code 的官方網站并下載安裝包。按照安裝向導進行安裝。 安裝 C/C 編譯…