Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raceday 2017 - Fully Autonomous #458

Merged
merged 167 commits into from
May 26, 2017
Merged
Show file tree
Hide file tree
Changes from 159 commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
99bd9f7
added new localizer analysis code
babraham123 Oct 16, 2016
72c0a10
added matlab lib to plot map
babraham123 Oct 16, 2016
bb4aaf1
new localizer code
babraham123 Oct 19, 2016
88a8c31
finished localizer code and added analysis script
babraham123 Oct 20, 2016
5ed83f1
new analsyis and localizer fixes
babraham123 Oct 24, 2016
d7de18c
added skeleton files
VivaanBahl Nov 4, 2016
9173567
update
babraham123 Nov 7, 2016
8e48942
Merge branch 'master' into vivaan-newAutonImplementation
VivaanBahl Nov 7, 2016
7bb13cd
Fleshed out some of the details of the skeleton class
VivaanBahl Nov 7, 2016
a8bfbfd
added more to the skeleton localizer
VivaanBahl Nov 8, 2016
3e7befc
Merge branch 'vivaan-newAutonImplementation' into bereket_localizer
babraham123 Nov 12, 2016
1e32004
buffed out docs
VivaanBahl Nov 12, 2016
adc9406
finished up docs for covariance and the update routine
VivaanBahl Nov 13, 2016
bd74836
incremental commit
VivaanBahl Nov 13, 2016
92955b8
Updated the predict step to include the motion model
VivaanBahl Nov 13, 2016
c60f81f
added docs for update, and buffed out docs for predict
VivaanBahl Nov 13, 2016
4293f04
ballmer peak ftw
VivaanBahl Nov 13, 2016
5742d56
updated RoboBuggyKFLocalizer
babraham123 Nov 13, 2016
3207333
updating simulator
babraham123 Nov 14, 2016
18d6e0e
new comments in localizer
babraham123 Nov 14, 2016
0d41949
compilation issues fixed
VivaanBahl Nov 14, 2016
68d4c62
controller
babraham123 Nov 14, 2016
3fa6827
Merge branch 'vivaan-newAutonImplementation' of https://github.com/CM…
babraham123 Nov 14, 2016
60e7019
new controller sim
babraham123 Nov 14, 2016
149ad4d
added top-level comments
VivaanBahl Nov 15, 2016
165a85a
cleanup
VivaanBahl Nov 16, 2016
87653d4
converted controller to radians
VivaanBahl Nov 16, 2016
db8222a
fixed an issue where the matrices were the wrong sizes
VivaanBahl Nov 17, 2016
7b9ce60
added map to the surface to show where pose estimates are
VivaanBahl Nov 17, 2016
76ff3dd
localizer comfirmed in simulation
babraham123 Nov 17, 2016
f4a4c63
Merge branch 'vivaan-newAutonImplementation' of https://github.com/CM…
babraham123 Nov 17, 2016
6c5a6b0
fixed naming issues
VivaanBahl Nov 17, 2016
17b176e
fixed loclizer trajectory analysis
babraham123 Nov 18, 2016
0dce024
Matlab controller implementation added
Nov 20, 2016
18b1602
updates to controller sim
babraham123 Nov 21, 2016
57dfbf9
fixed controller sim
babraham123 Dec 3, 2016
c9d6b0e
Fixed controller simulation bugs
dapatil211 Dec 3, 2016
1acf75c
added steering vel
babraham123 Dec 3, 2016
319317b
minor
babraham123 Dec 4, 2016
f4073f5
pure pursuit controller works very well!
babraham123 Dec 5, 2016
a389370
ported the matlab controller to java
VivaanBahl Jan 20, 2017
d85fa60
prepped buggy for auton testing
VivaanBahl Jan 22, 2017
a002bc7
started migration of matlab simulator over to java
VivaanBahl Jan 26, 2017
da9dc2d
minor
babraham123 Jan 26, 2017
91798c8
Merge branch 'vivaan-newAutonImplementation' of https://github.com/CM…
babraham123 Jan 26, 2017
345d0ca
Merge branch 'vivaan-newAutonImplementation' of https://github.com/CM…
VivaanBahl Jan 26, 2017
5083e8b
finished first version of simulator
VivaanBahl Jan 26, 2017
bf5e8b3
simulator almost working, had to change everything to radians to cope
VivaanBahl Jan 27, 2017
1a01e8e
AWW YEEEE
VivaanBahl Jan 27, 2017
4d047ae
added skeleton of localizer tester
VivaanBahl Jan 27, 2017
64c0871
added robot config, still need to test
VivaanBahl Jan 27, 2017
adbbcaf
localizer sim finished for just GPS
VivaanBahl Jan 27, 2017
2b644b1
added steering angle clamping
babraham123 Jan 27, 2017
c19df1a
finished version 1 of localizer simulator
VivaanBahl Jan 27, 2017
3ff0acf
cleanup
VivaanBahl Jan 27, 2017
7c62772
cleanup and fixed odom #blessed
VivaanBahl Jan 27, 2017
caa2741
minor changes, added logging fix
VivaanBahl Jan 28, 2017
66bc66c
fixed a critical bug in the system where the localizer sent the
VivaanBahl Jan 29, 2017
ed661a1
fixed a critical bug in the system where the localizer sent the
VivaanBahl Jan 29, 2017
11da978
Merge branch 'vivaan-newAutonImplementation' of https://github.com/CM…
VivaanBahl Jan 29, 2017
5a05eca
edits to WayPointFollowerPlanner
abhinavGirish Feb 4, 2017
9c39475
edits to WayPointFollowerPlanner
abhinavGirish Feb 4, 2017
9fcdec0
removed the stupid angle int conversion from the messages
VivaanBahl Feb 4, 2017
12e9f42
generified the software clamping
VivaanBahl Feb 4, 2017
a30da60
added v1 of pid stabilization
VivaanBahl Feb 4, 2017
aaa5f2f
toolchain fixes
VivaanBahl Feb 10, 2017
1454400
changed offline analysis to handle triangle test route
babraham123 Feb 11, 2017
a83d9c2
testing fixes and setup for Friday
VivaanBahl Feb 14, 2017
331f2ce
disabled PID and reenabled lookahead
VivaanBahl Feb 17, 2017
fc4fbff
removed PID from steering controller, fixed lookahead distance calcul…
babraham123 Feb 18, 2017
300ab6e
merge fix
babraham123 Feb 18, 2017
16c843b
added current waypoint to the map display
VivaanBahl Feb 24, 2017
c4e007a
added skeleton of imu integration in kalman filter
VivaanBahl Feb 25, 2017
7ee21fd
forgot about the degrees to radians issue
VivaanBahl Feb 25, 2017
0f9725e
new controller analysis files
babraham123 Feb 25, 2017
29a9175
Merge branch 'vivaan-newAutonImplementation' of https://github.com/CM…
babraham123 Feb 25, 2017
6360fa9
get heading estimation from IMU compass
babraham123 Feb 25, 2017
0a2a8c9
fixes for playback robot
VivaanBahl Feb 25, 2017
d688757
Revert "fixes for playback robot"
VivaanBahl Feb 25, 2017
316df16
Revert "get heading estimation from IMU compass"
VivaanBahl Feb 25, 2017
baf5d6c
Revert "forgot about the degrees to radians issue"
VivaanBahl Feb 25, 2017
619af97
Revert "added skeleton of imu integration in kalman filter"
VivaanBahl Feb 25, 2017
c371f0e
added current commanded angle to the GUI printout
VivaanBahl Feb 25, 2017
f417a5b
fixed issues
VivaanBahl Feb 25, 2017
f7f0b66
added more info to gui,
VivaanBahl Feb 25, 2017
87b28ac
testing new controller sim
babraham123 Feb 26, 2017
74ea873
Merge branch 'vivaan-newAutonImplementation' of https://github.com/CM…
babraham123 Feb 26, 2017
7e7d686
fixed steering controller, tested new version
babraham123 Feb 26, 2017
63b50da
added a limit on how many waypoints we consider for picking
VivaanBahl Feb 28, 2017
66c558d
reworked the controller tester to start at the first waypoint instead of
VivaanBahl Mar 3, 2017
f1466ae
style
babraham123 Mar 7, 2017
984956d
@agirish wrote a fix to stop the localizer from transmitting until we
VivaanBahl Mar 29, 2017
4a7dafc
added steering feedback into the localizer
VivaanBahl Mar 31, 2017
1200264
minor fixes and added skeleton of new simulation toolbox
VivaanBahl Apr 3, 2017
53febf2
filled in init routine for new sim toolbox
VivaanBahl Apr 3, 2017
a345948
added better sim toolbox
VivaanBahl Apr 3, 2017
a9ffef8
added noise and disabled periodicity of simulator
VivaanBahl Apr 4, 2017
82bd186
changed noise covariance matrices to fit better with what we actually
VivaanBahl Apr 4, 2017
df87f20
added skeleton of polynomial path planner
VivaanBahl Apr 5, 2017
e8486ee
added current waypoint into logs
VivaanBahl Apr 5, 2017
396a449
testing fixes
VivaanBahl Apr 5, 2017
85a5128
swapped out Pure Pursuit for Stanley controller
VivaanBahl Apr 6, 2017
34ddd6b
added in extremely crude dynamic GPS covariance
VivaanBahl Apr 6, 2017
275d5f0
this is a terrible commit and i should feel bad about it
VivaanBahl Apr 6, 2017
63b7c9b
continuing the disgusting code quality
VivaanBahl Apr 6, 2017
48086f4
added in the controller to avoid trusting sudden changes in the
VivaanBahl Apr 6, 2017
bbccdb2
added mroe to the polynomial planner
VivaanBahl Apr 6, 2017
fac6ceb
finished polynomial planner
VivaanBahl Apr 7, 2017
71e2b7a
turns out doing the max allowable angle diff thing makes the stanley
VivaanBahl Apr 7, 2017
e792a5a
turns out the polynomial planner was a bust, we keep getting singular
VivaanBahl Apr 7, 2017
aaf2ccc
tuned stanley controller from the simulation
VivaanBahl Apr 7, 2017
c70f54b
fixed math error in the Stanley controller
VivaanBahl Apr 8, 2017
fd867f8
removed dumb import
VivaanBahl Apr 8, 2017
41a94b7
rolls code
VivaanBahl Apr 8, 2017
3ef5bbc
Merge branch 'vivaan-newAutonImplementation' of https://github.com/CM…
VivaanBahl Apr 8, 2017
7c9d37d
added a Config robot to directly edit the config file
VivaanBahl Apr 9, 2017
79ad673
forgot about other conflicts
VivaanBahl Apr 9, 2017
4efb350
fixed playback
VivaanBahl Apr 10, 2017
957d26e
added in version 2 of the pure pursuit contoller
VivaanBahl Apr 10, 2017
ebfaf92
added more stanley fixes
VivaanBahl Apr 11, 2017
d5c2331
localizer fixes
VivaanBahl Apr 12, 2017
a2f77d5
the gps has been actually fairly accurate, so we are choosing to trus…
VivaanBahl Apr 13, 2017
7a68aa5
pretty ballsy move here but if it works itll be legend
VivaanBahl Apr 13, 2017
0f3dd51
more tuning fixes
VivaanBahl Apr 13, 2017
f61f479
forgot to reinclude ackermann steering
VivaanBahl Apr 13, 2017
b7c1453
testing fixes
VivaanBahl Apr 18, 2017
7db4bf1
added untested course correction code
VivaanBahl Apr 18, 2017
cca6f42
made the switchover more aggressive
VivaanBahl Apr 18, 2017
06d5777
this will go down as one of the ballsiest moves in the history of the
VivaanBahl Apr 19, 2017
cf5accb
Merge branch 'vivaan-newAutonImplementation' of https://github.com/CM…
VivaanBahl Apr 19, 2017
3162d7e
ran simulations and fixed issues that came up
VivaanBahl Apr 19, 2017
c76a1cc
Merge branch 'master' into vivaan-newAutonImplementation
VivaanBahl Apr 23, 2017
3281dde
raceday commit
VivaanBahl Apr 26, 2017
61ff1b9
Merge branch 'vivaan-newAutonImplementation' of https://github.com/CM…
VivaanBahl Apr 26, 2017
d5cbc4f
Stupid stuff
Apr 28, 2017
70e66c6
moved all the data from the current state matrix into the rest of the
VivaanBahl Apr 30, 2017
66db548
forgot about this one
VivaanBahl Apr 30, 2017
085d06a
cleaned up comments and moved them to more appropriate place
VivaanBahl May 5, 2017
a4d8dc9
removed cancerous commented code
VivaanBahl May 5, 2017
3704bea
fixes to Robots
VivaanBahl May 5, 2017
bd0bc49
fixed sim tools
VivaanBahl May 5, 2017
a411bd4
fixed testing code kerfuffle
VivaanBahl May 5, 2017
1038e8e
fixed static analysis inconsistencies
VivaanBahl May 5, 2017
aa9c929
Cleaned up RobobuggyMainFile
dapatil211 May 5, 2017
3670b88
Removed star import in Util.java
dapatil211 May 5, 2017
a305d6d
Removed unused controller code from WayPointFollowerPlanner
dapatil211 May 5, 2017
8e0708e
removing waypoint .txt files
abhinavGirish May 20, 2017
500b0cc
removing waypoint .txt files
abhinavGirish May 20, 2017
5d71d04
removing waypoint txt files
abhinavGirish May 20, 2017
c1e15ba
removing duplicate method
abhinavGirish May 20, 2017
2482b7f
eliminating magic nums in simrobot
abhinavGirish May 20, 2017
60ec6e6
removed localizer.java
abhinavGirish May 20, 2017
d484efb
fixing magic nums again
abhinavGirish May 21, 2017
c84c36b
renaming constants
abhinavGirish May 21, 2017
d9b6f1d
took care of more constants
abhinavGirish May 21, 2017
0783c18
deleted unnecessary folder
abhinavGirish May 21, 2017
d82c628
changing localizer tester so correct getDistance method is used
abhinavGirish May 22, 2017
5dd245e
fixing style on most things
abhinavGirish May 23, 2017
78f4631
last changes to style
abhinavGirish May 23, 2017
91fc0aa
changed naming in the controller tester to be more accurate
VivaanBahl May 23, 2017
d0ec4f4
Removed file notes.txt in offline/localizer per Vivaan's comments
May 25, 2017
f5e568c
Removed some obsolete packages per earlier code review
May 25, 2017
7113f08
Merge branch 'vivaan-newAutonImplementation' of https://github.com/CM…
May 25, 2017
5938c1a
Cleaning up code
May 25, 2017
0658e07
corrected a typo from 'jason' to 'json'
May 25, 2017
08406c9
Merge branch 'master' into vivaan-newAutonImplementation
VivaanBahl May 26, 2017
4fe136c
fixed findbugs issues
VivaanBahl May 26, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions offline/controller/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.mat
*.jpg
*.png
.DS_Store
*.pyc

125 changes: 125 additions & 0 deletions offline/controller/controller.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
function [trajectory] = controller()

addpath('../localizer/latlonutm/Codes/matlab');
global wheel_base
global velocity
global steering_vel
global dt

save_data = true;
wheel_base = 1.13;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bunch of magic numbers used

utm_zone = 17;
first_heading = deg2rad(250);
lat_long = [40.441670, -79.9416362];
dt = 0.001; % 1000Hz
m = 50; % 20Hz
velocity = 8; % m/s, 17.9mph, forward velocity
steering_vel = deg2rad(40); % 40deg/s, reaction speed to control cmds

[x, y, ~] = ll2utm(lat_long(1), lat_long(2));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please document this a bit more maybe to clarify what this is doing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ll2utm is actually a pretty decent naming convention, IMO. I think this is all right as is


X = [x; % X, m, UTM coors
y; % Y, m, UTM coors
velocity; % d_Yb, body velocity
first_heading; % heading, rad, world frame
0]; % d_heading, rad/s

load('./waypoints.mat');
desired_traj = processWaypoints(logs);
% time = linspace(0, 240, size(trajectory,2));
time = 0:dt:240;
u = 0; % commanded steering angle
steering = u; % steering angle
trajectory = [X; lat_long(1); lat_long(2); steering];

for i = 1:size(time, 2)
t = time(i);
A = model(X, steering);
X = A*X;
steering = updateSteering(steering, u);

X(4) = clampAngle(X(4));
X(5) = clampAngle(X(5));

if(mod(i, m) == 0)
u = control(desired_traj, X);
end

% trajectory = [trajectory, X];
snapshot = summarize(X, utm_zone, steering);
trajectory = [trajectory, snapshot];
end

if save_data
save('controller_v2.mat', 'trajectory');
end
end

function [desired] = processWaypoints(lat_long)
[x, y, zone] = ll2utm(lat_long);
desired = [x y];
end

function snapshot = summarize(x, utm_zone, steeringAngle)
[lat, lon] = utm2ll(x(1), x(2), utm_zone);
snapshot = [x; x(1); x(2); steeringAngle];
end

function a = clampAngle(a)
while (a < -pi)
a = a + 2*pi;
end
while (a > pi)
a = a - 2*pi;
end
end

function b = updateSteering(b, u)
global steering_vel
global dt

if(b < u)
b = b + steering_vel*dt;
end
if(b > u)
b = b - steering_vel*dt;
end
end

function a = clampSteeringAngle(a)
if(a < -deg2rad(10))
a = -deg2rad(10);
end
if(a > deg2rad(10))
a = deg2rad(10);
end
end

function [A] = model(x, steering)
global wheel_base
global dt

A = [1, 0, dt*cos(x(4)), 0, 0;
0, 1, dt*sin(x(4)), 0, 0;
0, 0, 1, 0, 0;
0, 0, 0, 1, dt;
0, 0, tan(steering)/wheel_base, 0, 0];
end

function [u] = control(desired_traj, X)
pos = X(1:2)';
b = repmat(pos, size(desired_traj, 1), 1);
delta = 15*15;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic numbers being used again

possible = find(sum((desired_traj-b).^2, 2) < delta);
if isempty(possible)
u = 0;
else
target = desired_traj(possible(end), :);
deltaPath = target - pos;
u = atan2(deltaPath(2), deltaPath(1))-X(4);
end
u = clampSteeringAngle(clampAngle(u));
end



48 changes: 48 additions & 0 deletions offline/controller/controller_analysis.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
% graph results

clear;
close all;

addpath('../localizer/latlonutm/Codes/matlab');
addpath('../localizer/altmany-export_fig');

file = 'controller_v2.mat';
load(file, 'trajectory');
save_plot = false;
show_maps = true;

load('./waypoints_course_v2.mat');
[x, y, zone] = ll2utm(logs);
desired = [x y];
desired = desired(112:(end-50), :);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic number


k = 1000;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic number

if show_maps
wmline(trajectory(6,1:k:end), trajectory(7,1:k:end), 'Color', 'r')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic number!

end

heading = trajectory(4,1:k:end);
figure();
hold on;
plot(trajectory(1,1:k:end), trajectory(2,1:k:end))
quiver(trajectory(1,1:k:end), trajectory(2,1:k:end), cos(heading), sin(heading))
plot(desired(:,1), desired(:,2), 'g')
hold off;
title(['Map ', file]);

headingd = rad2deg(heading);
figure();
hold on;
plot(1:length(headingd), headingd)
title(['Heading ', file]);

figure();
p = k/20;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic number

plot(1:p:size(trajectory,2), trajectory(8,1:p:end))
title('Control input');

% plot on google maps
if show_maps
xy = [trajectory(6,1:k:end); trajectory(7,1:k:end)];
fprintf(1, '%5.20f, %5.20f\n', xy);
end
137 changes: 137 additions & 0 deletions offline/controller/controller_pure.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
function [trajectory] = controller_pure()
% https://www.ri.cmu.edu/pub_files/2009/2/Automatic_Steering_Methods_for_Autonomous_Automobile_Path_Tracking.pdf
% section 2.2

addpath('../localizer/latlonutm/Codes/matlab');
global wheel_base
global velocity
global steering_vel
global dt

save_data = true;
wheel_base = 1.13;
utm_zone = 17;
first_heading = deg2rad(250);
lat_long = [40.442867, -79.9427395]; % [40.441670, -79.9416362];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic numbers

dt = 0.001; % 1000Hz
m = 50; % 20Hz
velocity = 8; % m/s, 17.9mph, forward velocity
steering_vel = deg2rad(40); % 40deg/s, reaction speed to control cmds
% full range in 0.5s

[x, y, ~] = ll2utm(lat_long(1), lat_long(2));

X = [x; % X, m, UTM coors
y; % Y, m, UTM coors
velocity; % d_Yb, body velocity
first_heading; % heading, rad, world frame
0]; % d_heading, rad/s

load('./waypoints_tri.mat');
desired_traj = processWaypoints(logs);
% time = linspace(0, 240, size(trajectory,2));
time = 0:dt:60; % 240;
u = 0; % commanded steering angle
steering = u; % steering angle
trajectory = [X; lat_long(1); lat_long(2); steering];

for i = 1:size(time, 2)
t = time(i);
A = model(X, steering);
X = A*X;
steering = updateSteering(steering, u);

X(4) = clampAngle(X(4));
X(5) = clampAngle(X(5));

if(mod(i, m) == 0)
u = control(desired_traj, X);
end

% trajectory = [trajectory, X];
snapshot = summarize(X, utm_zone, steering);
trajectory = [trajectory, snapshot];
end

if save_data
save('controller_tri_v1.mat', 'trajectory');
end
end

function [desired] = processWaypoints(lat_long)
[x, y, zone] = ll2utm(lat_long);
desired = [x y];
end

function snapshot = summarize(x, utm_zone, steeringAngle)
[lat, lon] = utm2ll(x(1), x(2), utm_zone);
snapshot = [x; x(1); x(2); steeringAngle];
end

function a = clampAngle(a)
while (a < -pi)
a = a + 2*pi;
end
while (a > pi)
a = a - 2*pi;
end
end

function b = updateSteering(b, u)
global steering_vel
global dt

if(b < u)
b = b + steering_vel*dt;
end
if(b > u)
b = b - steering_vel*dt;
end
end

function a = clampSteeringAngle(a)
if(a < -deg2rad(10))
a = -deg2rad(10);
end
if(a > deg2rad(10))
a = deg2rad(10);
end
end

function [A] = model(x, steering)
global wheel_base
global dt

A = [1, 0, dt*cos(x(4)), 0, 0;
0, 1, dt*sin(x(4)), 0, 0;
0, 0, 1, 0, 0;
0, 0, 0, 1, dt;
0, 0, tan(steering)/wheel_base, 0, 0];
end

function [u] = control(desired_traj, X)
global wheel_base

pos = X(1:2)';
pos_b = repmat(pos, size(desired_traj, 1), 1);
delta = 15;
cutoff = 100;
delta = delta * delta;

distances = sum((desired_traj - pos_b).^2, 2);
[~, closest_idx] = min(distances);
last_idx = min([length(distances), closest_idx + cutoff]);
possible = find(distances(1:last_idx) < delta);
if isempty(possible)
u = 0;
else
target = desired_traj(possible(end), :);
deltaPath = target - pos;

k = 0.8;
a = atan2(deltaPath(2), deltaPath(1))-X(4);
u = atan2(2*wheel_base*sin(a), k*X(3));
end
u = clampSteeringAngle(clampAngle(u));
end

Loading