-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
[Proposal] Reduce internal dependancy #303
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
Conversation
This pull request introduces 2 alerts when merging 7473907 into 4093b64 - view on LGTM.com new alerts:
|
@Chachay Thank you for your PR!!. It looks simpler. Please fix some minor points to merge as below. |
Please fix the issues reported by lgtm-com. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL.
|
||
self.length = s[-1] | ||
|
||
def yaw(self, s): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calc_yaw is better? function should be start by a verb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
dx, dy = self.dX(s), self.dY(s) | ||
return np.arctan2(dy, dx) | ||
|
||
def curvature(self, s): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calc_curvature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
ddx, ddy = self.ddX(s), self.ddY(s) | ||
return (ddy * dx - ddx * dy) / ((dx ** 2 + dy ** 2)**(3 / 2)) | ||
|
||
def __findClosestPoint(self, s0, x, y): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use snake-case based on pep8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
return (ddy * dx - ddx * dy) / ((dx ** 2 + dy ** 2)**(3 / 2)) | ||
|
||
def __findClosestPoint(self, s0, x, y): | ||
def f(_s, *args): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make the function name more explicit?
_x, _y= self.X(_s), self.Y(_s) | ||
return (_x - args[0])**2 + (_y - args[1])**2 | ||
|
||
def jac(_s, *args): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make the function name more explicit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
named calc distance & its jacobian
minimum = optimize.fmin_cg(f, s0, jac, args=(x, y), full_output=True, disp=False) | ||
return minimum | ||
|
||
def TrackError(self, x, y, s0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be calc_track_error
|
||
return e, k, yaw, s | ||
|
||
def PIDControl(target, current): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change pid_control
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
self.yaw = self.yaw + self.v / L * math.tan(delta) * dt | ||
self.v = self.v + a * dt | ||
|
||
class TrackSpline: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CubicSplinePath is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
- rename functions - add target speed controller (as the substitute of calc speed profile)
- remove unnecessary else case
Thank you for your review. I added "switching direction" in addition to the function name fixes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
target_speed = 10.0 / 3.6 | ||
|
||
sp = calc_speed_profile(cx, cy, cyaw, target_speed) | ||
track = CubicSplinePath(ax, ay) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
track -> cubic_spline_path ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't this object be better to have the name detached from the interpolation method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this object mean a spline path object? What do you imply the "track" name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the name could be any of reference_track, reference_path, target_track and target_path or even only path or track, but it isn't necessary to be cubic spline as long as class C2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh ok. I got it. i feel reference_path is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
ind, e = calc_nearest_index(state, cx, cy, cyaw) | ||
|
||
k = ck[ind] | ||
def rear_wheel_feedback_control(state, e, k, yaw_r): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yaw_r -> yaw_ref ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will rename this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you!!
Other proposal (not implemented):