Skip to content

Conversation

@Andrew-Lowitt
Copy link
Collaborator

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.

Copy link
Contributor

@AC408 AC408 left a comment

Choose a reason for hiding this comment

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

few comments

from enum import Enum


def ackerman_calculations (steer_ang, left_ang, right_ang, outside_ang, inside_ang, track_width, wheel_base, steering_ration):
Copy link
Contributor

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?

Copy link
Collaborator Author

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

Copy link
Contributor

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:
Copy link
Contributor

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

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,
Copy link
Contributor

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?

steering_ratio):
#calculate ideal wheel angle

ackerman_percentage = 0 #This value needs to be determined by mechanical
Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Collaborator

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


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))))
Copy link
Contributor

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)

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) ^
Copy link
Contributor

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?

Copy link
Collaborator Author

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


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,
Copy link
Contributor

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

Copy link
Collaborator Author

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
Copy link
Collaborator

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

data = ackerman_calculations(left_ang, right_ang, inside_ang, wheel_base,
steering_ratio)

#continue to implement
Copy link
Collaborator

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.

Copy link
Collaborator

@AdityaKompella6 AdityaKompella6 left a 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.

@jinlin270 jinlin270 force-pushed the ackerman branch 2 times, most recently from 6fdc5ce to 157d285 Compare March 8, 2024 19:40
- 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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants