10-07-2013, 07:01 PM
AKA Ryan Van Why
FRC #0957 (SWARM)
Team Role: Alumni
Join Date: Sep 2009
Rookie Year: 2009
Location: Oregon
Posts: 168
Re: calculating position using follower wheels
MATLAB:
Spoiler for code :
Code:
rotate_CW = @(t) 1.5*sin(t/2.5);
angle = @(t) 5*pi/12 - integral(rotate_CW, 0, t, 'ArrayValued', true);
forward = @(t) 5*sin(t/2);
strafe_right = @(t) 4*sin(t/2.2);
xvel = @(t) cos(angle(t)) * forward(t) + cos(angle(t) - pi/2) * strafe_right(t);
yvel = @(t) sin(angle(t)) * forward(t) + sin(angle(t) - pi/2) * strafe_right(t);
xpos = @(t) integral(xvel, 0, t, 'ArrayValued', true);
ypos = @(t) integral(yvel, 0, t, 'ArrayValued', true);
spd = @(t) sqrt(forward(t)^2 + strafe_right(t)^2);
distance = @(t) integral(spd, 0, t, 'ArrayValued', true);
x_position = xpos(30)
y_position = ypos(30)
distance = distance(30)
Last edited by flameout : 10-07-2013 at 07:04 PM .
Reason: Units and nicer MATLAB output