目录
一、代码及文献获取
1. 代码链接:哔哩哔哩工房 (bilibili.com)
2. 视频链接:https://b23.tv/hr8a3VM
二、引言
多智能体编队控制任务通常由两个子任务组成。首先是引导agent形成所需的几何图案,其次是实现所需的集体机动,使队形的质心、方位、尺度等几何参数可以连续变化。本文提出了一种新的仿射编队机动控制方法来同时实现这两个子任务。该方法依赖于应力矩阵,应力矩阵可以看作是具有正负边权的广义图拉普拉斯矩阵。所提出的控制律可以跟踪任何目标编队,即一个标称构型的时变仿射变换。地层的质心、方位、不同方向的尺度,甚至几何图形都可以连续变化。期望的编队机动只有少数被称为“领导者”的智能体知道,其余的被称为“追随者”的智能体只需要跟随“领导者”。所提出的控制律是全局稳定的,如果所需的测量可以在每个智能体的局部参考系中测量,则不需要全局参考系。
三、主要代码
robotdata.ifLeaderFollower=1;
robotdata.leaderNum=3; % the first leaderNum agents are leaders
robotdata.dim=2;
% configuration matrix
P=2*[2 0;
1 1;
1 -1;
0 1;
0 -1;
-1 1;
-1 -1];
robotdata.nodenum=size(P,1); % number of nodes
% adjacent matrix
neighborMat=zeros(robotdata.nodenum,robotdata.nodenum);
neighborMat(1,2)=1;neighborMat(1,3)=1;neighborMat(1,4)=1;neighborMat(1,5)=1;
neighborMat(2,4)=1;
neighborMat(3,5)=1;neighborMat(3,6)=1;
neighborMat(4,5)=1;neighborMat(4,6)=1;neighborMat(2,7)=1;
neighborMat(5,7)=1;
neighborMat(6,7)=1;
robotdata.m=sum(sum(neighborMat)); % number of edges
robotdata.neighborMat=neighborMat+neighborMat';
% stress matrix: the returned is -Omega, hence the ijth entry is omega_ij!!
robotdata.stressMat=fcn_StressMatrix(robotdata.dim,robotdata.nodenum,robotdata.m,P,robotdata.neighborMat) ;
%%%%
robotdata.T1=0.5;
robotdata.tho1=28;
robotdata.c1=200;
robotdata.h1=0.1;
robotdata.gamma=0.5;
robotdata.T2=0.5;
robotdata.tho2=20;
robotdata.k2=1.2;
robotdata.k1=0.5;
%%%%
robotdata.theta=1;
robotdata.yita=0;
robotdata.sa0=50;
robotdata.sa=robotdata.sa0*robotdata.theta;
samplePos_all=P';
p=reshape(P',robotdata.dim*robotdata.nodenum,1);
% initial states
x_init=p+[0 0 ...
0 0 ...
0 0 ...
1 1 ...
0 1 ...
-1 1 ...
-2 -1]';
for k=1:robotdata.leaderNum
x_init(robotdata.dim*(k-1)+1:robotdata.dim*k)=samplePos_all(:,k); % initial leader position
end
robotdata.x_init=x_init;
v_leader_init=zeros(robotdata.dim*robotdata.leaderNum,1);
v_init=zeros(robotdata.dim*robotdata.nodenum,1);
v_init(1:robotdata.dim*robotdata.leaderNum,1)=v_leader_init; % initial leader velocity
robotdata.v_init=v_init;
robotdata.ahat_init=zeros(robotdata.dim*(robotdata.nodenum-robotdata.leaderNum),1);
robotdata.rotateFlag=1;
robotdata.tempp1=zeros(robotdata.dim,1);
robotdata.tempp2=zeros(robotdata.dim,1);
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%
% simulink
robotdata.simTime=125
robotdata.stepsize=0.001
% comment: reduce the stepsize to get less tracking error;
% that is because there is acceleration feedback, which is delayed by the time of stepsize.
% the value used in the paper is 0.001
option=simset('fixedstep',robotdata.stepsize);
sim('AffineSecond.mdl', [0, robotdata.simTime], option)
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
robotdata.delta=200;
fcn_Plot_StationaryLeader(p_all_time, v_all_time, a_all_time, error_all, estamation_error,robotdata)
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% animation
fcn_Animation_2DObstacle(p_all_time, error_all,robotdata)