function [ z_jihuo_cishu,shibie_jingdu] = test( d ,isnt_last,xianxing)
%TEST 此处显示有关此函数的摘要
% 此处显示详细说明
%d代表目标和障碍物是否均为动态,0为静态,非0为动态
%isnt_last 不是最后一次运行为1,
%xianxing 轨迹线型
%第123个障碍物可设置为动态
global net
global y_neuron_num
global z_neuron_num
global bushu_temp
shibie_jingdu=[];
xingzoubushu=0;
%设置初始位置
%%%***初始位置1*%%%%%*%%%%***%%%
% ax=180;ay=180;
% fx=800;fy=700;
% enx1=420;eny1=900;
% enx2=600;eny2=550;
% enx3=685;eny3=707;
% enx4=290;eny4=300;
% enx5=480;eny5=400;
% enx6=400;eny6=470;
% enx7=490;eny7=670;
% enx8=300;eny8=700;
% enx9=260;eny9=500;
% enx10=700;eny10=200;
% enx11=400;eny11=230;
% enx12=320;eny12=400;
% enx13=250;eny13=550;
%初始位置2
% ax=180;ay=180;
% fx=800;fy=700;
% enx1=320;eny1=600;
% enx2=430;eny2=630;
% enx3=235;eny3=255;
% enx4=260;eny4=300;
% enx5=350;eny5=260;
% enx6=450;eny6=400;
% enx7=670;eny7=620;
% enx8=650;eny8=450;
% enx9=550;eny9=500;
% enx10=740;eny10=560;
% enx11=310;eny11=450;
% enx12=580;eny12=760;
% enx13=650;eny13=720;
% %初始位置3
% ax=180;ay=180;
% fx=800;fy=700;
% enx1=290;eny1=400;
% enx2=430;eny2=630;
% enx3=235;eny3=255;
% enx4=560;eny4=300;
% enx5=320;eny5=310;
% enx6=450;eny6=400;
% enx7=700;eny7=560;
% enx8=560;eny8=560;
% enx9=650;eny9=500;
% enx10=420;eny10=500;
% enx11=510;eny11=450;
% enx12=680;eny12=700;
% enx13=540;eny13=640;
%初始位置2
ax=180;ay=180;
fx=800;fy=700;
enx1=219;eny1=324;
enx2=300;eny2=335;
enx3=416;eny3=248;
enx4=309;eny4=409;
enx5=441;eny5=398;
enx6=512;eny6=363;
enx7=599;eny7=417;
enx8=474;eny8=520;
enx9=345;eny9=618;
enx10=510;eny10=692;
enx11=600;eny11=596;
enx12=762;eny12=512;
enx13=283;eny13=516;
xla=[1,0];yla=[0,1];
agent=[ax,ay]; %智能体
friend=[fx,fy]; %目标机器人
chushi_f_dis=norm(friend-agent);
enemy_1=[enx1,eny1];
enemy_2=[enx2,eny2];
enemy_3=[enx3,eny3]; %三个动态障碍物
enemy_4=[enx4,eny4];
enemy_5=[enx5,eny5]; %两个静态障碍物
enemy_6=[enx6,eny6];
enemy_7=[enx7,eny7];
enemy_8=[enx8,eny8];
enemy_9=[enx9,eny9];
enemy_10=[enx10,eny10];
enemy_11=[enx11,eny11];
enemy_12=[enx12,eny12];
enemy_13=[enx13,eny13];
x=1;y=1;
if d>0&d<=3
ffx=1;ffy=1;
elseif d>3&d<=6
ffx=-1;ffy=1;
else
ffx=-1;ffy=-1;
end
th=0;
axis_jb=gca;
guiji_x=[];
guiji_y=[];
enemy_1_jb=rectangle('Position',[enemy_1(1)-6,enemy_1(2)-6,12,12],'Curvature',[1,1]);
enemy_2_jb=rectangle('Position',[enemy_2(1)-6,enemy_2(2)-6,12,12],'Curvature',[1,1]);
enemy_3_jb=rectangle('Position',[enemy_3(1)-6,enemy_3(2)-6,12,12],'Curvature',[1,1]);
% enemy_1_jb=rectangle('Position',[enemy_1(1)-6,enemy_1(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
% enemy_2_jb=rectangle('Position',[enemy_2(1)-6,enemy_2(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
% enemy_3_jb=rectangle('Position',[enemy_3(1)-6,enemy_3(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
enemy_5_jb=rectangle('Position',[enemy_5(1)-6,enemy_5(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
enemy_4_jb=rectangle('Position',[enemy_4(1)-6,enemy_4(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
enemy_6_jb=rectangle('Position',[enemy_6(1)-6,enemy_6(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
enemy_7_jb=rectangle('Position',[enemy_7(1)-6,enemy_7(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
enemy_8_jb=rectangle('Position',[enemy_8(1)-6,enemy_8(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
enemy_9_jb=rectangle('Position',[enemy_9(1)-6,enemy_9(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
enemy_10_jb=rectangle('Position',[enemy_10(1)-6,enemy_10(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
enemy_11_jb=rectangle('Position',[enemy_11(1)-6,enemy_11(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
enemy_12_jb=rectangle('Position',[enemy_12(1)-6,enemy_12(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
enemy_13_jb=rectangle('Position',[enemy_13(1)-6,enemy_13(2)-6,12,12],'Curvature',[1,1],'FaceColor','k');
friend_jb=rectangle('Position',[friend(1)-10,friend(2)-10,20,20],'Curvature',[1,1],'FaceColor','g');
agent_jb=rectangle('Position',[agent(1)-6,agent(2)-6,12,12],'Curvature',[0,0],'FaceColor','b');
axis([0,1000,0,1000]);
f=gcf;
set(f,'position',[0,0,1000,1000]);
set(enemy_1_jb,'EraseMode','Xor');
set(enemy_2_jb,'EraseMode','Xor');
set(enemy_3_jb,'EraseMode','Xor');
set(enemy_5_jb,'EraseMode','Xor');
set(enemy_6_jb,'EraseMode','Xor');
set(enemy_4_jb,'EraseMode','Xor');
set(enemy_7_jb,'EraseMode','Xor');
set(enemy_8_jb,'EraseMode','Xor');
set(enemy_9_jb,'EraseMode','Xor');
set(enemy_10_jb,'EraseMode','Xor');
set(enemy_11_jb,'EraseMode','Xor');
set(enemy_12_jb,'EraseMode','Xor');
set(enemy_13_jb,'EraseMode','Xor');
set(friend_jb,'EraseMode','Xor');
set(agent_jb,'EraseMode','Xor');
%清空临时记忆区
for i=1:bushu_temp
net.Y.temp_memory_neuron(i).zuobiao=[];
net.Y.temp_memory_neuron(i).goodOrBad=[];
end
bushu_temp=0;
%记录z区每个神经元激活的次数
z_jihuo_cishu=zeros(1,8);
while(1)
%% 朋友和敌人分别与智能体的角度theta、欧氏距离dis 6组
jiangli_zhi=2;
changfa_zhi=2;
jiangli_fx1=0;
jiangli_fx2=0;
changfa_fx1=0;
changfa_fx2=0;
jiangli_fx=jiangli_zhi*[jiangli_fx1,jiangli_fx2];
changfa_fx=changfa_zhi*[changfa_fx1,changfa_fx2];
drawnow;
ffri=friend-agent;
ee1=enemy_1-agent;
ee2=enemy_2-agent;
ee3=enemy_3-agent;
ee5=enemy_5-agent;
ee4=enemy_4-agent;
ee6=enemy_6-agent;
ee7=enemy_7-agent;
ee8=enemy_8-agent;
ee9=enemy_9-agent;
ee10=enemy_10-agent;
ee11=enemy_11-agent;
ee12=enemy_12-agent;
ee13=enemy_13-agent;
jihe=[ffri;ee1;ee2;ee3;ee5;ee4;ee6;ee7;ee8;ee9;ee10;ee11;ee12;ee13];
for i=1:length(jihe)
aa=[jihe(i,1),jihe(i,2)];
%表示方法有问题,有待解决!!!!
theax_i=acos(dot(aa,xla)/(norm(aa)*norm(xla)));
thety_i=acos(dot(aa,yla)/(norm(aa)*norm(yla)));
if(thety_i>pi/2)
theta(i)=2*pi-theax_i;
else
theta(i)=theax_i;
end
dis(i)=norm(aa);
end
%%
fri_theta=theta(1);
fri_dis=dis(1);
dd=find(dis(2:length(jihe))<=80);
[c1,c2] = min(dis(2:length(jihe)));
if length(dd)==0
if(fri_theta<=pi)
en_theta=fri_theta+pi;
else
en_theta=fri_theta-pi;
end
% en_dis=dis(c2+1);
en_dis=150;
changfa_zhi=0;
if(fri_dis<20)
jiangli_zhi=0;
elseif fri_dis<chushi_f_dis
jiangli_zhi=1/(chushi_f_dis-20)*fri_dis-20/(chushi_f_dis-20);
else
jiangli_zhi=1;
end
pipeidu=0;
fazhi=cos(pi/10);
else
en_theta=theta(c2+1);
en_dis=dis(c2+1);
jiangli_zhi=0;
if(en_dis<=22)
changfa_zhi=5;
else
changfa_zhi=-1/58*en_dis+80/58;
end
zhixian_zuobiao1=[cos(fri_theta),cos(en_theta)]/norm([cos(fri_theta),cos(en_theta)]);
zhixian_zuobiao2=[sin(fri_theta),sin(en_theta)]/norm([sin(fri_theta),sin(en_theta)]);
pipeidu=zhixian_zuobiao1*zhixian_zuobiao2';
fazhi=cos(pi/10);
if(pipeidu<fazhi)
bushu_temp=bushu_temp+1;
net.Y.temp_memory_neuron(bushu_temp).zuobiao=[ffri,jihe(c2+1,:)];
end
end
jiangli_fx1=cos(fri_theta);
jiangli_fx2=sin(fri_theta);
chengfa_theta=en_theta+pi;
if chengfa_theta>2*pi chengfa_theta=chengfa_theta-2*pi; end
changfa_fx1=cos(chengfa_theta);
changfa_fx2=sin(chengfa_theta);
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
功能:1,可实现半监督学习(少量样本的训练,之后完全自主学习新的知识) 2,实现知识的增量记忆 3,自主学习 4,路径导航自主避障并接近目标。 该项目由于国内研究较少,且比较新,经过稍微改进优化可发表相关学术论文(该研究点较易发表学术论文),通过研究本代码,可学习相关算法、matlab代码GUI科研作图等。对于初入学术圈和进阶者均适用。
资源推荐
资源详情
资源评论
收起资源包目录
发育网络改进升级版(具备自主学习和知识记忆能力).zip (27个子文件)
off_task_2
test.m 14KB
main.m 4KB
xian_xia_zhuanyi.m 3KB
ping_jia_TEST.m 491B
matlab.mat 750B
f.xls 19KB
two_XL_theta.m 153B
duibishujujiance.m 382B
x1.mat 3KB
x2.mat 3KB
u.xls 19KB
x4.mat 3KB
tiQu_teDing_fangxiang_shuJu.m 2KB
f_all.xlsx 10KB
fu_nengLiangZhi.m 2KB
e.xls 19KB
u_all.xlsx 9KB
ping_jia.m 7KB
jy.mat 653KB
x3.mat 3KB
create.m 767B
train.m 3KB
Untitled2.m 117B
x5.mat 3KB
create.prj 44KB
e_all.xlsx 10KB
sub2ind_fuben.m 234B
共 27 条
- 1
资源评论
- weixin_499403482023-07-04怎么能有这么好的资源!只能用感激涕零来形容TAT...
- evalhq2022-10-03发现一个超赞的资源,赶紧学习起来,大家一起进步,支持!
- m0_378268702023-10-25终于找到了超赞的宝藏资源,果断冲冲冲,支持!
盘古开天1666
- 粉丝: 1w+
- 资源: 73
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功