In the steps8 program (steps8.ino) I applied sequences of 1 second positive and negative pulses to both the left and right wheels, reducing the magnitude by half on each run. I was testing for linearity of the responses.
apply_steps( 1000000, MAX_COMMAND ); apply_steps( 1000000, 128 ); apply_steps( 1000000, 64 ); apply_steps( 1000000, 32 ); apply_steps( 1000000, 16 );
The plots below (or ones like them) are in lab1/steps8_1/, as is the data from my robot. The file lab1/steps8_1/notes.txt has the Matlab commands below. I copy and paste commands into Matlab from notes.txt to do stuff.
Plotting the positions of both left and right wheels:
To get this plot use these commands in the data directory steps8_1 or whatever you called the directory you put data from your robot in. Load the data:
Plot the positions:
Velocities look like:
If I now scale the positions plots by 256/command_magnitude I get:
If the responses were linear and the left and right motor-wheel systems
were the same, all these traces would lie on top of each other.
They don't. Larger pulses have a larger effect than they should, or
smaller pulses have a smaller effect than they should. The left and right
wheels become more different for smaller pulses.
load f0.dat
load f1.dat
load f2.dat
load f3.dat
load f4.dat
hold off
plot( f0(:,2) - f0(990,2) )
hold on
plot( f0(:,5) - f0(990,5) )
plot( f1(:,2) - f1(990,2) )
plot( f1(:,5) - f1(990,5) )
plot( f2(:,2) - f2(990,2) )
plot( f2(:,5) - f2(990,5) )
plot( f3(:,2) - f3(990,2) )
plot( f3(:,5) - f3(990,5) )
plot( f4(:,2) - f4(990,2) )
plot( f4(:,5) - f4(990,5) )
title( "steps8: positions" )
xlabel( "samples" )
ylabel( "encoder units" )
legend( "f0l", "f0r", "f1l", "f1r", "f2l", "f2r", "f3l", "f3r", "f4l", "f4r" )
hold off
plot( f0(:,3) )
hold on
plot( f0(:,6) )
plot( f1(:,3) )
plot( f1(:,6) )
plot( f2(:,3) )
plot( f2(:,6) )
plot( f3(:,3) )
plot( f3(:,6) )
plot( f4(:,3) )
plot( f4(:,6) )
title( "steps8: velocities" )
xlabel( "samples" )
ylabel( "encoder units/second" )
legend( "f0l", "f0r", "f1l", "f1r", "f2l", "f2r", "f3l", "f3r", "f4l", "f4r" )
hold off
plot( 256*(f0(:,2) - f0(990,2))/255 )
hold on
plot( 256*(f0(:,5) - f0(990,5))/255 )
plot( 2*(f1(:,2) - f1(990,2)) )
plot( 2*(f1(:,5) - f1(990,5)) )
plot( 4*(f2(:,2) - f2(990,2)) )
plot( 4*(f2(:,5) - f2(990,5)) )
plot( 8*(f3(:,2) - f3(990,2)) )
plot( 8*(f3(:,5) - f3(990,5)) )
plot( 16*(f4(:,2) - f4(990,2)) )
plot( 16*(f4(:,5) - f4(990,5)) )
title( "steps8: positions normalized by 256/command" )
xlabel( "samples" )
ylabel( "encoder units" )
legend( "f0l", "f0r", "f1l", "f1r", "f2l", "f2r", "f3l", "f3r", "f4l", "f4r" )
What are we going to do about this?