Enhanced Affine Formation Maneuver Control Using Historical Acceleration Command (HAC) Simulation Code
Simulation code for Enhanced Affine Formation Maneuver Control Using Historical Acceleration Command (HAC).
Author:Wei Yu & Peng Yi
Date: 2023-07-22
- Matlab Version 2020b and above.
- Simulink Version 2020b and above.
![code_structure](https://private-user-images.githubusercontent.com/66028151/255334075-93326ddd-ac32-4532-9cab-aea330c388e4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE2NjM2ODQsIm5iZiI6MTcyMTY2MzM4NCwicGF0aCI6Ii82NjAyODE1MS8yNTUzMzQwNzUtOTMzMjZkZGQtYWMzMi00NTMyLTljYWItYWVhMzMwYzM4OGU0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIyVDE1NDk0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM5MGZlYTQwM2VjYzY5Y2FjNGQwMmZiMDFjMjQ3MDgxM2U0ODI0ZmY2MzgyYjQyZjg3M2Y2ZjVjZGU5ZjdmMjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.RaypZ6RYG5AWmxKo9fxEVPFlKvIrGGvHUToFJ84eN6c)
-
affine_double_intergrator.slx
- Main programme of simulation by Simulink. -
run_by_script.m
- A Matlab script to easyly run simulation and demonstrate results including essential figures and cohesiveness. -
fcn_StressMatrix.m
- A script to calculate Stress Matrix by Shiyu, Zhao. -
Initial_Parameters.m
- A script to initialize parameters for simulation. -
FigureUtility
- Functions of visualizing simulation results including trajectory, norm error, etc. -
VideoUtility
- Functions of visualizing simulation formation maneuvering and some cases demonstration.
It is strongly recommended to use run_by_script.m
for simulation. Detailed Usage is as follow:
-
Setting simulation case with different
$\tau$ : setting variabledelays
. Example:delays = [0.01, 0.1, 0.5, 1];
-
Setting different controller parameters: setting variable
kp
,kv
andkbeta
, which is as the same as the paper defined. Example:kp = 1; kv = 10; kbeta = 1.5;
-
Setting simulation condition: variable
simtime
for simulation time and variablesimstep
for simulation step size. Example:simtime = 50; simstep = 0.01;
If you want to change formation and initial positions, you can modity Initial_Parameters.m
. Detailed Usage is as follow:
-
Setting formation: setting variable
P
, which means the configuration of the agents, also, you need to change Adjacency Matrix. Example:P=2*[2 0; 1 1; 1 -1; 0 1.2; 0 -1.2; -1 1; -1 -1; -2 0.5; -2 -0.5]; neighborMat=zeros(nodenum,nodenum); neighborMat(1,2)=1;neighborMat(1,3)=1;neighborMat(1,8)=1;neighborMat(1,9)=1; neighborMat(2,4)=1;neighborMat(2,7)=1; neighborMat(3,5)=1;neighborMat(3,6)=1;neighborMat(3,4)=1;neighborMat(2,5)=1; neighborMat(4,5)=1;neighborMat(4,6)=1;neighborMat(2,7)=1;neighborMat(4,7)=0; neighborMat(5,7)=1;neighborMat(5,8)=0;neighborMat(5,6)=0; neighborMat(6,7)=1;neighborMat(6,8)=1; neighborMat(7,9)=1; neighborMat(8,9)=1;
-
Setting initial positions: setting variable
P0
. Example:P0 = [2 0; 1 1; 1 -1; 1 2.2; -1 -2.2; 1 3; -3 -3; 1 3.5; -5 -3.5];