Commit 320ff302 authored by Jan-Gerrit Richter's avatar Jan-Gerrit Richter

more modification on motorcontrol (continuous measurement)

parent 5fa8de59
......@@ -219,6 +219,7 @@ classdef itaMotorControlNanotec < itaMotorControl
% get the preangle and the speed
sArgs.preAngle = 0;
sArgs.speed = 2;
sArgs.postAngle = 10;
[sArgs notFound] = ita_parse_arguments(sArgs, varargin);
% first, do a reference move
......@@ -231,7 +232,8 @@ classdef itaMotorControlNanotec < itaMotorControl
% now prepare the big move but don't start it
this.moveTo(motorName,360-35,'speed',sArgs.speed,'absolut',true,'start',0,'limit',0);
moveAngle = 360 + sArgs.preAngle + sArgs.postAngle;
this.moveTo(motorName,moveAngle,'speed',sArgs.speed,'absolut',false,'start',0,'limit',0,'direct',1);
this.preparedList = motorName;
ita_verbose_info('Finished preparing',2)
end
......
......@@ -17,7 +17,7 @@ classdef itaMotorNanotec_HRTFarc < itaMotorNanotec
sArgs_default_motor = struct( ...
'wait', true, ...
'speed', 2, ...
'speed', 1, ...
'VST', 'adaptiv', ...
'limit', true, ...
'continuous', false, ...
......
......@@ -16,7 +16,7 @@ classdef itaMotorNanotec_Turntable < itaMotorNanotec
properties(Constant, Hidden = true)
sArgs_default_motor = struct( ...
'wait', true, ...
'speed', 0.5, ...
'speed', 2, ...
'VST', 'adaptiv', ...
'limit', false, ...
'continuous', false, ...
......@@ -117,8 +117,8 @@ classdef itaMotorNanotec_Turntable < itaMotorNanotec
% Set direction:
motorControl.add_to_commandlist(sprintf('#%dd=0\r' , this.motorID));
% Calculate and set lower speed:
%stepspersecond = (this.sArgs_default_motor.speed/0.9*this.sArgs_default_motor.gear_ratio);
motorControl.add_to_commandlist(sprintf('#%du=%.2f\r' , this.motorID, 25));
stepspersecond = (this.sArgs_default_motor.speed/0.9*this.sArgs_default_motor.gear_ratio);
motorControl.add_to_commandlist(sprintf('#%du=%.2f\r' , this.motorID, stepspersecond));
% Calculate and set upper speed:
stepspersecond = (this.sArgs_default_motor.speed/0.9*this.sArgs_default_motor.gear_ratio);
motorControl.add_to_commandlist(sprintf('#%do=%.2f\r' , this.motorID, stepspersecond));
......@@ -155,6 +155,7 @@ classdef itaMotorNanotec_Turntable < itaMotorNanotec
end
sArgs.continuous = false;
sArgs.direct = true;
sArgs.speed = this.sArgs_default_motor.speed;
if ~isempty(varargin)
sArgs = ita_parse_arguments(sArgs,varargin);
......@@ -173,8 +174,11 @@ classdef itaMotorNanotec_Turntable < itaMotorNanotec
end
if this.old_position.phi ~= position.phi
angle = mod(position.phi(1)/2/pi*360+360, 720)-360;
if ~sArgs.direct
angle = mod(position.phi(1)/2/pi*360+360, 720)-360;
else
angle = position.phi_deg(1);
end
ret = this.prepare_move(angle, 'absolut', true, 'wait', true, 'speed', sArgs.speed);
this.old_position = position;
started = ret;
......@@ -397,7 +401,7 @@ classdef itaMotorNanotec_Turntable < itaMotorNanotec
% Divide by 0.9 because each (half)-step is equal to 0.9 degree
% and multiply by the gear_ratio because the given angle value
% is for the turntable and not for the motor:
steps = (angle/0.9*this.sArgs_motor.gear_ratio)
steps = (angle/0.9*this.sArgs_motor.gear_ratio);
% Check if absolut or relative position mode:
if this.sArgs_motor.absolut == true
% Absolut position mode:
......
......@@ -207,20 +207,35 @@ classdef test_itaEimarMotorControl < itaMeasurementTasksScan
numRepetitions = this.measurementSetup.repetitions;
timePerRepetition = this.measurementSetup.twait*length(this.measurementSetup.outputChannels);
speed = 360/(numRepetitions*timePerRepetition);
motorControl = this.getMotorControl;
motorName = motorControl.motorList{1}.getMotorName;
if strcmp(motorName,'HRTFArc')
% preangletime
preAngle = 45;
preAngleTime = preAngle/speed; % it takes 2 seconds to start recording
% preangletime
preAngle = 45;
preAngleTime = preAngle/speed; % it takes 2 seconds to start recording
postAngle = -35;
postAngleTime = postAngle/speed;
postAngle = 10;
postAngleTime = postAngle/speed;
additionalReps = ceil((postAngleTime+preAngleTime + 1)/timePerRepetition);
numTotalRepetitions = numRepetitions+additionalReps;
this.measurementSetup.repetitions = numTotalRepetitions;
additionalReps = ceil((postAngleTime+preAngleTime + 1)/timePerRepetition);
numTotalRepetitions = numRepetitions+additionalReps;
this.measurementSetup.repetitions = numTotalRepetitions;
else
% preangletime
preAngle = 15;
preAngleTime = preAngle/speed; % it takes 2 seconds to start recording
postAngle = 5;
postAngleTime = postAngle/speed;
additionalReps = ceil((postAngleTime+preAngleTime + 1)/timePerRepetition);
numTotalRepetitions = numRepetitions+additionalReps;
this.measurementSetup.repetitions = numTotalRepetitions;
end
%prepare motors for continuous measurement
this.mMotorControl.prepareForContinuousMeasurement('speed',speed,'preAngle',preAngle);
this.mMotorControl.prepareForContinuousMeasurement('speed',speed,'preAngle',preAngle,'postAngle',postAngle);
% calculate the excitation as this takes quite a long time
this.measurementSetup.excitation;
......@@ -243,6 +258,12 @@ classdef test_itaEimarMotorControl < itaMeasurementTasksScan
result = this.measurementSetup.deconvolve(result_raw);
% this.stop;
this.mMotorControl.setWait(true);
% add history line
commitID = ita_git_getMasterCommitHash;
if ~isempty(commitID)
ita_metainfo_add_historyline(result_raw,'Continuous Measurement',commitID);
end
end
function motorControl = getMotorControl(this)
......
......@@ -101,7 +101,7 @@ classdef itaEimar < itaMeasurementTasksScan
%
% someAdditionalStuff = 4;
% function1 = @(varargin)someFunction(varargin,someAdditionalStuff);
% functionHandles = {function1,@someOtherFunction}
% functionHandles = {function0,@someOtherFunction}
%
% *********************************************************************
%
......@@ -924,7 +924,7 @@ classdef itaEimar < itaMeasurementTasksScan
return;
end
angle = angle - 120.41; % Larger substractive value: Higher position. Checkt at 90°.
angle = angle - 119.01; % Larger substractive value: Higher position. Checkt at 90°.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment