-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed relative loc formula so we take buggy frame into account
- Loading branch information
1 parent
9c746ca
commit c84e0f9
Showing
3 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,29 @@ | ||
function new_delta = avoid_collision(x, delta, relative_locs) | ||
|
||
% define tolderance, step size, max iter, etc | ||
|
||
% initialize new_delta to max right | ||
% todo run this again but use full left as well, see if they converge in | ||
% the same place | ||
|
||
% while we haven't reached max iterations | ||
% determine the gradient | ||
|
||
% get the radius of the circle drawn with delta' | ||
|
||
% use the circle formula on each landmark to figure out if it's on the path | ||
|
||
% if it's within the tolerance, consider it in the way | ||
|
||
% use the difference as the input to the derivative of the gaussian | ||
|
||
% calculate the derivative and scale according to distance away (prioritize | ||
% closer objects) | ||
|
||
% add the difference between delta' and delta for the regularizer | ||
|
||
% run gradient step | ||
|
||
% once we exhaust iterations, return the new delta | ||
|
||
end |
20 changes: 19 additions & 1 deletion
20
Software/offline/Collision_Avoidance/get_relative_object_locs.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
function relative_locs = get_relative_object_locs(x, obstacle_locs) | ||
|
||
% TODO figure out how to get relative INCLUDING the buggy's orientation | ||
xloc = [ x(1) x(2) ]; | ||
num_obstacles = size(obstacle_locs, 1); | ||
|
||
% get the world frame's relative locations | ||
relative_locs_world_frame = obstacle_locs - ones(num_obstacles,1)*xloc; | ||
|
||
% but we need the relative locations from the point of view from the | ||
% buggy's frame | ||
% see the docs.pdf on relative coordinates for the terminology | ||
d = sum(relative_locs_world_frame .^ 2, 2); | ||
|
||
psi = x(4); | ||
theta = atan2(relative_locs_world_frame(:,2), relative_locs_world_frame(:,1)); | ||
phi = theta - ones(size(theta))*psi; | ||
|
||
a = d .* cos(phi); | ||
b = d .* sin(phi); | ||
|
||
relative_locs = [ a b ]; | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters