Quote:
Originally Posted by Aaron.Graeve
I disregarded the width and length of the wheelbase because the initial and final coordinates were already based on the center of geometry, meaning I could treat this as an omnidirectional unicycle bot
|
Good move. I put that in there as a distraction.
Actually, since the bot as described does not rotate, any point on the bot could have been used (as long as it was the same point for both the initial and final coords).
Quote:
Phi = arctan((x1-x0)/(y1-y0))
Phi = Alpha + Sigma
Alpha + Sigma = arctan((x1-x0)/(y1-y0))
Sigma = arctan((x1-x0)/(y1-y0)) - Alpha
This is my solution for the posted problem; I trust it has errors, but I am not certain where they are, so any critiques or suggestions are welcome.
|
Nice work. Reps to you. You're 95% there...
The formula you gave gives the "correct" angle if y1>y0, but gives the "reverse" angle (180 degrees off) if y1<y0. If y1=y0, it crashes.
For example:
1) if x0=0, y0=0, x1=10, y1=-1, and alpha=90 degrees, the formula gives sigma= -174.3 degrees instead of +5.7 degrees.
2) if x0=0, y0=0, x1=10, y1=0, and alpha=60 degrees, the formula crashes instead of sigma=30 degrees.
There's a simple way fix the formula that does not involve any conditional logic in your code.
Quote:
|
Additionally, the wheels must be turned Sigma - Beta from their initial configuration
|
Let's call that angle "delta". Is there a simple formula (not involving conditional logic) that will compute the shortest value for delta? (For example if delta is 270 degrees the formula should give -90 degrees).