Skip to content
Snippets Groups Projects
Commit f14d9558 authored by Tim Stadtmann's avatar Tim Stadtmann
Browse files

Revise test scripts, add a new one

parent 449adfe0
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ for power=30:20:70
motor.start;
% Save tachocount values
% -> Disabling the visual output seems to lead to the bug occuring less frequently
tic
t = toc;
tVec = []; tachoVec = [];
......
......@@ -2,6 +2,7 @@
% low-level functionality. There is no 'hidden' communication here;
% everytime a method of CommunicationInterface is called, a packet with the
% corresponding command is sent.
% However, I wasn't able to reproduce the problem with this stripped down version.
%
% Requires:
% * Brick connected via USB
......@@ -13,9 +14,11 @@ b = CommunicationInterface('usb');
b.pauseAfterSend = 0; % Set this to ~0.005 (= 5ms) and the bug should not occur anymore
b.debug = false; % Set this to true to get all packets sent and received printed to the console
power = 30;
for i=1:10
figure; hold all;
for power=30:20:70
% figure; hold all;
% for power=30:20:70
% Reset tachocount
b.outputClrCount(0, MotorBitfield.MotorA);
......@@ -24,22 +27,22 @@ for i=1:10
% is too high.
b.outputStepPower(0, MotorBitfield.MotorA, power, 0, 1000, 0, BrakeMode.Coast);
% Save tachocount values
tic
t = toc;
tVec = []; tachoVec = [];
while t < 6
t = toc;
tVec = [tVec, t]; %#ok<AGROW>
tachoVec = [tachoVec, b.outputGetCount(0, MotorPort.MotorA)]; %#ok<AGROW>
end
% % Save tachocount values
% tic
% t = toc;
% tVec = []; tachoVec = [];
% while t < 6
% t = toc;
% tVec = [tVec, t]; %#ok<AGROW>
% tachoVec = [tachoVec, b.outputGetCount(0, MotorPort.MotorA)]; %#ok<AGROW>
% end
% Wait until motor is not busy anymore
while(b.outputTest(0, MotorBitfield.MotorA))
end
% Plot tachocount values
plot(tVec,tachoVec); drawnow;
end
% % Plot tachocount values
% plot(tVec,tachoVec); drawnow;
% end
end
b.delete();
\ No newline at end of file
% This function requires:
% This script requires:
% * Brick connected via USB
% * Motor at port A
b = EV3();
b.connect('usb');
b.pauseAfterSend = 0; % Set this to ~0.005 (= 5ms) and the bug should not occur anymore
b.debug = 0; % Set this to 2 to get all packets sent and received printed to the console
b.debug = 0; % Set this to 2 to have all packets sent and received printed to the console
for i=1:10
motorProblemStart(b);
......
% This function requires:
% * Brick connected via USB
% * EV3-Touch-Sensor at port 1
clear all;
b = CommunicationInterface('usb');
b.debug = 0; % Set this to 1 to have all packets sent and received printed to the console
% If you call this script more than once in a row, the reply to this command will also be
% erroneous (as this is another implicit mode change, from Bumps to Pushed).
val = b.inputReadSI(0, SensorPort.Sensor1, DeviceMode.Touch.Pushed);
fprintf('Pushed: %d\n', val);
val = b.inputReadSI(0, SensorPort.Sensor1, DeviceMode.Touch.Bumps); % The reply to this command should be erroneous
fprintf('Bumps: %d\n', val);
val = b.inputReadSI(0, SensorPort.Sensor1, DeviceMode.Touch.Bumps); % Now it should work
fprintf('Bumps: %d\n', val);
\ No newline at end of file
......@@ -18,7 +18,7 @@ function testUSBSpeed(sendOnly, secondsWaitedAfterSend)
end
b = CommunicationInterface('usb');
b.secondsWaitedAfterSend = secondsWaitedAfterSend;
b.pauseAfterSend = secondsWaitedAfterSend;
t_measure = 10.0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment