-
Notifications
You must be signed in to change notification settings - Fork 0
Ackerman calculations for wheel angles #155
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
base: main
Are you sure you want to change the base?
Conversation
AC408
left a comment
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.
few comments
electrical/breakbeam.py
Outdated
| from enum import Enum | ||
|
|
||
|
|
||
| def ackerman_calculations (steer_ang, left_ang, right_ang, outside_ang, inside_ang, track_width, wheel_base, steering_ration): |
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.
is there a reason this is in breakbeam.py?
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.
No, I must have forgot to switch branches when working on the break-beam
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.
lets remove this then
| def ackerman_calculations (steer_ang, left_ang, right_ang, outside_ang, inside_ang, track_width, wheel_base, steering_ration): | ||
| pass | ||
|
|
||
| class Breakbeam: |
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.
breakbeam class changes not relevant to current pr; remove from current pr
engine/robot_logic/traversal.py
Outdated
| if not robot_state.is_sim: | ||
| robot_state.motor_controller.spin_motors(0, 0) | ||
|
|
||
| def ackerman_calculations (left_ang, right_ang, inside_ang, wheel_base, |
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.
do we have specs for these functions?
engine/robot_logic/traversal.py
Outdated
| steering_ratio): | ||
| #calculate ideal wheel angle | ||
|
|
||
| ackerman_percentage = 0 #This value needs to be determined by mechanical |
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 we document what this is?
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.
for that matter, what the other vars mean in this func
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 we also make that a global variable since I assume it will stay constant
engine/robot_logic/traversal.py
Outdated
|
|
||
| track_width = wheel_base * ((1/np.tan(left_ang) - (1/np.tan(right_ang)))) | ||
| ackerman_ratio = (inside_ang / steering_ratio) | ||
| new_left_ang = 1/ np.tan((wheel_base * np.tan(ackerman_ratio)) / (wheel_base + (.5 * track_width )(np.tan(ackerman_ratio)))) |
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 dont believe tan^-1(x) = 1/tan(x)
engine/robot_logic/traversal.py
Outdated
| ackerman_ratio = (inside_ang / steering_ratio) | ||
| new_left_ang = 1/ np.tan((wheel_base * np.tan(ackerman_ratio)) / (wheel_base + (.5 * track_width )(np.tan(ackerman_ratio)))) | ||
| new_right_ang = 1/ np.tan((wheel_base * np.tan(ackerman_ratio)) / (wheel_base - (.5 * track_width )(np.tan(ackerman_ratio)))) | ||
| new_inside = new_left_ang #(change to new_right_ang based on above logic) ^ |
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.
is this accurate for both left and right turns?
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.
Yes, you resolve this based on the dependency of a left or right turn
engine/robot_logic/traversal.py
Outdated
|
|
||
| return [track_width, ackerman_ratio, new_left_ang, new_right_ang, new_inside, outside_ang] | ||
|
|
||
| def parallel_ackerman_right (left_ang, right_ang, inside_ang, wheel_base, |
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.
for now, it might be a good idea to throw an error that the function is unimplemented
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.
Ok
| FULL2 = 24 | ||
| # class BEAM_PINS(Enum): | ||
| # HALF1 = 17 | ||
| # HALF2 = 22 |
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.
You might want to remove this commented code if its not needed. It seems BEAM_PINS is in the class now so its not needed
engine/robot_logic/traversal.py
Outdated
| data = ackerman_calculations(left_ang, right_ang, inside_ang, wheel_base, | ||
| steering_ratio) | ||
|
|
||
| #continue to implement |
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.
Maybe just raise an exception with a comment TODO so you know what parts need to be finished and if you run any test cases with this the exception will tell you you have to finish the function.
AdityaKompella6
left a comment
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.
Overall Good Just some styling things I saw but the refactor seemed correct so it looks good.
6fdc5ce to
157d285
Compare
- Implemented the preliminary step in removing all hard-coded values from the break_beam sensors - The next part entails initializing the sensor with other values that are determined when the bucket/robot are starting a mission
- Created ackerman_calculations which calculates the needed angles to turn the wheels in order to turn - Still to implement: how to actually turn the wheels - What speed to rotate wheels/move - Rotate the wheels at the same time or different times?
…_left, turn_right
References
https://www.mathworks.com/help/vdynblks/ref/kinematicsteering.html
Summary
TLDR: Replace this with 1-3 sentence TLDR
Created the calculation function for Ackerman turning. This calculates the angles the wheel needs to turn in order to make turns to the right and left
Description
Implemented using the trig functions in multiple articles.
Still to implement:
How to actually turn the wheels, what speed to rotate the inner vs outer wheel.