You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GazeSimulation/expts_body_head_eye_coordin...

176 lines
8.3 KiB
Matlab

function expts_body_head_eye_coordination_direct
%Perform experiments on coordinated body, head and eye movements
%define network for performing body, head, and eye movements
[W,V,interconnects]=define_network(3);
figoff=100;
%McCluskey and Cullen 2007 generated eye movements in their subjects (Macaca mulatta monkeys) by presenting a sequence of visual targets. The target positions alternated between being to the left or to the right of the mid-line, but where otherwise are at unpredictable locations (we do not simulate the experiments reported at the end of the paper, where the target locations are predictable). All targets were at 20:10:80 degrees of the world mid-line. However, with this set up the minimum gaze shift is 40 degrees (from -20 to +20) but McCluskey and Cullen report results for gaze shifts of 20 and 30 degrees? We must assume that they included initial saccades from the central fixation point.
%Here, rather than perform a sequence of alternating left-right target shifts, a single gaze shift from left to right is performed. For experiments where McCluskey and Cullen 2007 prescribe required initial positions of the torso, neck, or eye these are imposed on the simulated agent as part of the initial pose used to fixate the left target, and then the gaze shift is performed.
%Simulate results shown in Fig 2a in McCluskey and Cullen 2007
vistarget=60;
eyepaninit=-8;
neckpaninit=-16;
torsopaninit=-24;
[eyeamp,headcontrib,headamp,bodycontrib,bodyamp,eyeposn,neckposn,torsoposn,targetposn]=control_body_head_eye(vistarget,eyepaninit,neckpaninit,torsopaninit,W,V,interconnects,[],0);
figured(figoff+1),clf,
gaze=vistarget-targetposn
plot(gaze,'LineWidth',3,'MarkerSize',8);hold on
plot(eyeposn,'--','LineWidth',3,'MarkerSize',8);hold on,
plot(neckposn,'-.','LineWidth',3,'MarkerSize',8);
plot(torsoposn,':','LineWidth',3,'MarkerSize',8);
plot(vistarget.*ones(size(targetposn)),'k--','LineWidth',2);
axis([1,4,-35,63]);
xlabel('saccade number'); ylabel('position (degrees)');
set(gca,'XTick',[1:4],'XTickLabel',[1:4]-1);
legend({'gaze','eye','head','body'},'Location','NorthEastOutside');legend('boxoff')
set(gcf,'PaperSize',[9 7],'PaperPosition',[0.5 0.5 8.5 6.5],'PaperOrientation','Portrait');
print -dpdf body_head_eye_direct1.pdf
%Simulate results shown in Fig 2b in McCluskey and Cullen 2007
vistarget=120;
eyepaninit=-8;
neckpaninit=-16;
torsopaninit=-24;
[eyeamp,headcontrib,headamp,bodycontrib,bodyamp,eyeposn,neckposn,torsoposn,targetposn]=control_body_head_eye(vistarget,eyepaninit,neckpaninit,torsopaninit,W,V,interconnects,[],0);
figured(figoff+2),clf,
gaze=vistarget-targetposn
plot(gaze,'LineWidth',3,'MarkerSize',8);hold on
plot(eyeposn,'--','LineWidth',3,'MarkerSize',8);
plot(neckposn,'-.','LineWidth',3,'MarkerSize',8);
plot(torsoposn,':','LineWidth',3,'MarkerSize',8);
plot(vistarget.*ones(size(targetposn)),'k--','LineWidth',2);
axis([1,4,-35,125]);
xlabel('saccade number'); ylabel('position (degrees)');
set(gca,'XTick',[1:4],'XTickLabel',[1:4]-1);
legend({'gaze','eye','head','body'},'Location','NorthEastOutside');legend('boxoff')
set(gcf,'PaperSize',[9 7],'PaperPosition',[0.5 0.5 8.5 6.5],'PaperOrientation','Portrait');
print -dpdf body_head_eye_direct2.pdf
%Simulate results shown in Fig 5 in McCluskey and Cullen 2007
clear eyeamp headcontrib headamp bodycontrib bodyamp
gaze=[20:10:120];
k=0;
for vistarget=gaze
k=k+1;
%fixate target to left
[~,~,~,~,~,eyeposn,neckposn,torsoposn]=control_body_head_eye(-vistarget./2,0,0,0,W,V,interconnects,[],0);
%fixate target at same world position to the right
[eyeamp(k),headcontrib(k),headamp(k),bodycontrib(k),bodyamp(k)]=control_body_head_eye(vistarget,eyeposn(end),neckposn(end),torsoposn(end),W,V,interconnects,[],0);
end
figured(figoff+3),clf,
subplot(3,1,1)
plot(gaze,eyeamp,'LineWidth',2,'Color',[0.8500 0.3250 0.0980]);
ylabel({'eye','amplitude'}), axis([0,120,0,60])
subplot(3,1,2)
plot(gaze,headamp,'LineWidth',2,'Color',[0.9290 0.6940 0.1250]); hold on;
plot(gaze,headcontrib,'--','LineWidth',2,'Color',[0.9290 0.6940 0.1250]);
ylabel('head'), axis([0,120,0,120]);
legend({'amp.','contrib.'},'Location',[0.445,0.56,0.1,0.05],'Orientation','horizontal');legend('boxoff')
subplot(3,1,3)
plot(gaze,bodyamp,'LineWidth',2,'Color',[0.4940 0.1840 0.5560]); hold on;
plot(gaze,bodycontrib,'--','LineWidth',2,'Color',[0.4940 0.1840 0.5560]);
ylabel('body'), axis([0,120,0,25]);
legend({'amp.','contrib.'},'Location',[0.445,0.26,0.1,0.05],'Orientation','horizontal');legend('boxoff')
xlabel('gaze amplitude'),
set(gcf,'PaperSize',[9 9],'PaperPosition',[0.5 0.5 8.5 8.5],'PaperOrientation','Portrait');
print -dpdf body_head_eye_direct3.pdf
%Simulate results shown in Fig 8a/b in McCluskey and Cullen 2007
clear eyeamp headcontrib headamp bodycontrib bodyamp
gaze=[20:10:120];
eyepan=[-10,-30];
j=0;
for eyepaninit=eyepan
j=j+1;
k=0;
for vistarget=gaze
k=k+1;
%fixate target to left - however required positions after looking left are mostly predefined
torsoposn=0; %required to be +/-5
neckposn=-vistarget./2-0-eyepaninit-torsoposn; %only free parameter - set to fixate left target
%fixate target at same world position to the right
[eyeamp(j,k),headcontrib(j,k),headamp(j,k),bodycontrib(j,k),bodyamp(j,k)]=control_body_head_eye(vistarget,eyepaninit,neckposn,torsoposn,W,V,interconnects,[],0);
end
end
figured(figoff+4),clf,
subplot(3,1,1),
plot(gaze,eyeamp(1,:),'LineWidth',2,'Color',[0.8500 0.3250 0.0980]); hold on,
plot(gaze,eyeamp(2,:),'--','LineWidth',2,'Color',[0.8500 0.3250 0.0980]);
ylabel({'eye','amplitude'}); axis([0,120,0,60])
legend(int2str(eyepan'),'Location',[0.615,0.73,0.1,0.05],'Orientation','horizontal');legend('boxoff')
%Simulate results shown in Fig 8c-f in McCluskey and Cullen 2007
clear eyeamp headcontrib headamp bodycontrib bodyamp
gaze=[20:10:120];
neckpan=[-30,-65];
j=0;
for neckpaninit=neckpan
j=j+1;
k=0;
for vistarget=gaze
k=k+1;
%fixate target to left - however required positions after looking left are predefined
torsoposn=0; %required to be +/-5
eyeposn=0; %required to be +/-10
%fixate target at same world position to the right
[eyeamp(j,k),headcontrib(j,k),headamp(j,k),bodycontrib(j,k),bodyamp(j,k)]=control_body_head_eye(vistarget,eyeposn,neckpaninit,torsoposn,W,V,interconnects,[],0);
end
end
figured(figoff+4)
subplot(3,1,2)
plot(gaze,headamp(1,:),'LineWidth',2,'Color',[0.9290 0.6940 0.1250]); hold on,
plot(gaze,headamp(2,:),'--','LineWidth',2,'Color',[0.9290 0.6940 0.1250]);
ylabel({'head','amplitude'}), axis([0,120,0,120]);
legend(int2str(neckpan'),'Location',[0.29,0.55,0.1,0.05]);legend('boxoff')
subplot(3,1,3)
plot(gaze,bodyamp(1,:),'LineWidth',2,'Color',[0.4940 0.1840 0.5560]); hold on,
plot(gaze,bodyamp(2,:),'--','LineWidth',2,'Color',[0.4940 0.1840 0.5560]);
ylabel({'body','amplitude'}), axis([0,120,0,16]);
legend(int2str(neckpan'),'Location',[0.29,0.25,0.1,0.05]);legend('boxoff')
xlabel('gaze amplitude'),
set(gcf,'PaperSize',[9 9],'PaperPosition',[0.5 0.5 8.5 8.5],'PaperOrientation','Portrait');
print -dpdf body_head_eye_direct4.pdf
%Simulate results shown in Fig 6a in McCluskey and Cullen 2007
clear neckfinal neckinit
gaze=[40:40:120];
neckpan=[-65,-40,-15];
k=0;
for vistarget=gaze
k=k+1;
j=0;
for neckpaninit=neckpan
j=j+1;
%fixate target to left
[~,~,~,~,~,eyeposn,neckposn,torsoposn]=control_body_head_eye(-vistarget./2,0,0,0,W,V,interconnects,[],0);
eyeposn=0; %required to be "central"?
%fixate target at same world position to the right
[~,~,~,~,~,eyeposn,neckposn,torsoposn]=control_body_head_eye(vistarget,eyeposn,neckpaninit,torsoposn(end),W,V,interconnects,[],0);
neckfinal(k,j)=neckposn(end);
neckinit(k,j)=neckposn(1);
end
end
neckfinal(k,j)=NaN;
figured(figoff+5),clf
colours=flipud(get(gcf,'DefaultAxesColorOrder'));
set(gcf,'DefaultAxesColorOrder',colours);
plot(neckinit',neckfinal','LineWidth',2)
text(double(neckinit(1,3)),double(neckfinal(1,3)),[' ',int2str(gaze(1))])
text(double(neckinit(2,3)),double(neckfinal(2,3)),[' ',int2str(gaze(2))])
text(double(neckinit(3,2)),double(neckfinal(3,2)),[' ',int2str(gaze(3))])
%legend({int2str(gaze')},'Location',[0.69,0.19,0.09,0.19]);legend('boxoff')
xlabel('initial head position (degrees)'),
ylabel('final head position (degrees)'),
axis([-70,-7,-40,60])
set(gcf,'PaperSize',[7 7],'PaperPosition',[0.5 0.5 6.5 6.5],'PaperOrientation','Portrait');
print -dpdf body_head_eye_direct5.pdf