-
Notifications
You must be signed in to change notification settings - Fork 110
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
❗Algorithm for computing hexapod orientation does not account for all cases #75
Comments
This seems like it would choose the triangle most parallel to the hexapod body, but it seems like it has a few problems (eg. it ignores more angled planes that are also valid and or more stable). I think that a more robust option might be to do the following instead: Take all sets of any three points and their corresponding triangle where:
This could also iterate through all valid sets of points (using the yield keyword to return valid solutions), form a polygon from the ground contacts that occur when choosing the points, and then the user could choose a solution which:
A score could be computed like so (a smaller score = better):
distance_above should find the length of a vector perpendicular to the polygon which touches the c.o.g.. distance_from_center should project the c.o.g. onto the polygon, and find the distance from the projected point to the center. distance_from_edge should project the c.o.g. onto the polygon, and find the minimum distance from the projected point to any edge in the polygon. Being closer to the center of the polygon is rewarded, but being close to any edge is punished (eg. for small polygon, you might be very close to both the edge and center) - and we add a small perturbation to ensure that the hexapod is still stable even if it moves inside the polygon. We also reward the center of gravity being close to the ground, since this is also more stable. |
@philippeitis Thanks for your input, I'll take note of it. |
For documentation purposes, here's another WRONG algorithm
|
New Algorithm I implementedThis might also be a wrong algorithm but right now it's the best one i can think of
|
Fixed with this commit I think so, yes |
The foot tip should be the ground contact (z=0) and NOT the femur point ( z= 26)The algorithm in theory is correct but there is a bug somewhere because it works okay in the javascript implementation: https://github.com/mithi/hexapod/blob/master/src/hexapod/solvers/orient/orientSolverGeneral.js |
❗❗❗
The old algorithm rests upon the assumption that it knows which point of the each leg is in contact with the ground. This assumption seems to be true for all possible cases for
leg-patterns page and inverse-kinematics page.
But this is not true for all possible angle combinations (18 angles) that can be defined in
the kinematics page.
This current algorithm will still be used for the leg-patterns page, and the inverse-kinematics page. A more general algorithm will be used for the kinematics page
The following algorithm can be used for the leg-patterns page and inverse-kinematics page.
(How to find the ground contact points, tilt, and height of the hexapod)
hexapod-robot-simulator/hexapod/ground_contact_solver.py
Line 1 in 45acb5a
But this can't be used in general.
This is because how we determine the ground contact ie
Linkage.compute_ground_contact()
doesn't always yield the correct result.hexapod-robot-simulator/hexapod/linkage.py
Line 162 in 45acb5a
Here's the new algorithm that accounts for most cases
hexapod-robot-simulator/hexapod/ground_contact_solver/ground_contact_solver2.py
Line 52 in 531fbb3
The text was updated successfully, but these errors were encountered: