# Move two wheeled robot from one point to another

The inner circle represents the potential path of the left wheel, and the outer the potential path of the right. The circle in between represents the "midpoint" between these two circles.

Given $A_L, A_R, A_N$ and $B_N$, I need to determine $d_L$ and $d_R$.

Here's what I've got so far:

$$\frac{d_L}{2\pi \cdot \overline {OA_L}} = \frac{d_R}{2\pi \cdot \overline {OA_R}}$$

Where $\overline {OA_L}$ and $\overline {OA_R}$ are the radii of the inner and outer circles respectively.

-
I feel like the title of your question was not chosen well; the question itself is simply a geometry question. –  Greg Martin Sep 27 '11 at 0:16

Assuming all you have are the positions of $A_L$, $A_R$, $A_N$, and $B_N$, that is, you don't even know where $O$ is in advance, this is a cute little geometry problem.

As $A_N$ and $B_N$ are at the same distance from $O$, the latter lies on the perpendicular bisector of the line segment $A_NB_N$. Also, it's clear from the picture that $O$ must lie on the line $A_LA_R$. This fixes the position of $O$. Then you can use Ilmari's answer to find the lengths of the arcs $d_L$ and $d_R$.

For an analytical solution, let $\vec u = \vec A_L - \vec A_R$ and $\vec v = \vec B_N - \vec A_N$. As $O$ lies on the line through $A_N$ parallel to $\vec u$, we can write $\vec O = \vec A_N + c \vec u$ for some scalar $c$. Also, as $O$ is equidistant from $A_N$ and $B_N$, we have $\lVert \vec O - \vec A_N \rVert^2 = \lVert \vec O - \vec B_N \rVert^2$. Substituting $\vec O = \vec A_N + c\vec u$ and using $\lVert \vec x \rVert^2 = \vec x \cdot \vec x$ for any $\vec x$, we get $$(c \vec u) \cdot (c \vec u) = (c \vec u - \vec v)\cdot(c \vec u - \vec v),$$ so $$c = \frac12 \frac{\vec v \cdot \vec v}{\vec u \cdot \vec v}$$ Finally, as $OA_NB_N$ is an isosceles triangle with sides $\lVert c \vec u \rVert$, $\lVert c \vec u \rVert$, and $\lVert \vec v \rVert$, the angle $\theta$ at $O$ satisfies $$2 \sin \frac\theta2 = \frac{\lVert \vec v \rVert}{\lVert c \vec u \rVert},$$ so $$\theta = 2 \sin^{-1} \frac{\lVert \vec v \rVert}{2\lVert c \vec u \rVert} = 2 \sin^{-1} \frac{\vec u \cdot \vec v}{\lVert \vec u \rVert \lVert \vec v \rVert}$$ and that should be you everything you need to compute the quantities in Ilmari's answer.

-

Let $\theta = \angle AOB$ in radians. Then $d_L = \theta r_L$ and $d_R = \theta r_R$, where $r_L$ and $r_R$ are the radii of the inner and outer circles respectively.

-
How do I determine what $\theta$ is? Or $r_L$, for that matter. I've only got $A_L, A_R, A_N$ and $B_N$. –  Mateen Ulhaq Aug 27 '11 at 21:14
@muntoo: $A_L$ and $A_R$ are the starting points of the two wheels, right? In that case, $r_L$ is the distance from $O$ to $A_L$, and $r_R$ is the distance from $O$ to $A_R$. You can calculate $\theta$ e.g. using the law of cosines as $\arccos( (OA \cdot OB) / (|OA|\,|OB|) )$, where $OA$ and $OB$ are the vectors from $O$ to $A$ and $B$, $|v|$ is the length of the vector $v$, and $\cdot$ is the dot product. –  Ilmari Karonen Aug 27 '11 at 21:30

If $\alpha$ is the angle $(\overrightarrow{OA_L},\overrightarrow{OB_L})$, $R_L$ the radius of the inner circle, then the length of the chord $A_L A_R$ is $$2 R_L \sin{\alpha \over 2}$$

The sinus can be obtained from the cosinus. $$\sin{\alpha \over 2} = \pm \sqrt{1-\cos \alpha \over 2}$$ And the cosinus from the scalar product : $$\cos \alpha = \frac{\overrightarrow{OA_L} \cdot \overrightarrow{OB_L}}{||\overrightarrow{OA_L}|| ||\overrightarrow{OB_L}||} = \frac{\overrightarrow{OA_L} \cdot \overrightarrow{OB_L}}{R_L^2}$$ The same can be done for the outer circle.

Edit : If you do not know $O$, you can compute it as the intersection of the two lines $(A_L B_L)$ and $(A_R B_R)$. It will also give you $R_L$ as the distance between $O$ and $A_L$.

Also, if $\alpha$ is small, you can use approximations like the post of Ilmari Karonen.

-
What does $R_L$ represent? <s>And on that last equation - those bars don't represent absolute value, right? (I'm not good at this stuff.)</s> I'm reading this, ATM. –  Mateen Ulhaq Aug 27 '11 at 21:25
I have added the definition of $R_L$, thank you. The two bars are the norm of a vector. –  alex_reader Aug 27 '11 at 21:30
I read the question as asking for the lengths of the arcs from $A_L$ to $B_L$ and $A_R$ to $B_R$, not of the chords. For that, my answer is exact. As you note, though, for small angles the chord and arc lengths are approximately the same. –  Ilmari Karonen Dec 26 '11 at 6:29