Drive unicycle kinematics equations through the geometry - Robotics Stack Exchange most recent 30 from robotics.stackexchange.com 2022-01-21T04:17:38Z https://robotics.stackexchange.com/feeds/question/22717 https://creativecommons.org/licenses/by-sa/4.0/rdf https://robotics.stackexchange.com/q/22717 1 Drive unicycle kinematics equations through the geometry sci9 https://robotics.stackexchange.com/users/16865 2021-10-03T08:43:09Z 2021-10-04T06:06:29Z <p>The unicycle dynamics in discrete-time is given by:</p> <p><span class="math-container">$$\begin{array}{l} {x_{k + 1}} = {x_k} + \Delta {s_{k + 1}} \times \cos ({\theta _{k + 1}})\\ {x_{k + 1}} = {x_k} + \Delta {s_{k + 1}} \times \sin ({\theta _{k + 1}})\\ {\theta _{k + 1}} = {\theta _{k }} + \Delta {\theta _{k + 1}} \end{array}$$</span></p> <p>However, some researchers have introduced an additional term to the argument of the trigonometric functions above; for example see: <a href="https://books.google.com/books?id=iEYnnQeOaaIC&amp;pg=PA29" rel="nofollow noreferrer">Autonomous Land Vehicles: Steps towards Service Robots By Karsten Berns, and Ewald Puttkamer</a></p> <p><span class="math-container">$$\begin{array}{l} {x_{k + 1}} = {x_k} + \Delta {s_{k + 1}} \times \cos ({\theta _{k }} + \frac{{\Delta {\theta _{k + 1}}}}{2})\\ {x_{k + 1}} = {x_k} + \Delta {s_{k + 1}} \times \sin ({\theta _{k }} + \frac{{\Delta {\theta _{k + 1}}}}{2})\\ {\theta _{k + 1}} = {\theta _{k }} + \Delta {\theta _{k + 1}} \end{array}$$</span></p> <p>I was wondering which one is geometrically correct? In other words, how we can show that <span class="math-container">$\cos ({\theta _k} + \frac{{\Delta {\theta _{k + 1}}}}{2}) = \cos ({\theta _{k + 1}})$</span>?</p> <p>According to the following figure, we have</p> <p><span class="math-container">$$\Delta {x_{k + 1}} = \Delta {s_{k + 1}} \times \sin (\frac{{\Delta {\theta _{k + 1}}}}{2})$$</span></p> <p>This may seem to be a strange result, since we said that</p> <p><span class="math-container">$$\Delta {x_{k + 1}} = \Delta {s_{k + 1}} \times \cos ({\theta _{k + 1}} + \frac{{\Delta {\theta _{k + 1}}}}{2})$$</span></p> <h2>Edit</h2> <p>The solution of unicycle's system of ODEs with MIDPOINT METHOD:</p> <h2><span class="math-container">$$\begin{array}{l} {t_{k + 1}} = {t_k} + \frac{T}{2}\\ {\theta _{mid}} = {\theta _k} + \omega \frac{T}{2}\\ \begin{array}{*{20}{l}} {{x_{k + 1}} = {x_k} + v \times \cos ({\theta _{mid}}) \times T = {x_k} + v \times \cos ({\theta _k} + \omega \frac{T}{2}) \times T}\\ {{y_{k + 1}} = {y_k} + v \times \sin ({\theta _k} + \omega \frac{T}{2}) \times T}\\ {{\theta _{k + 1}} = {\theta _k} + \omega T} \end{array} \end{array}$$</span></h2> <p><a href="https://i.stack.imgur.com/DgmGU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DgmGU.jpg" alt="Autonomous Land Vehicles: Steps towards Service Robots By Karsten Berns, Ewald Puttkamer" /></a></p> https://robotics.stackexchange.com/questions/22717/-/22722#22722 2 Answer by r-bryan for Drive unicycle kinematics equations through the geometry r-bryan https://robotics.stackexchange.com/users/27618 2021-10-03T20:15:22Z 2021-10-03T20:15:22Z <p>tl;dr: don't worry about it</p> <p>Your system really operates in continuous time, described by differential equations. It's a convenient, even necessary, approximation to use discrete time and difference equations. The dynamics solution would result from integrating the differential equations; the difference equations approximately solve the problem by doing numeric integration.</p> <p>As it happens, our predecessors over the previous two centuries have left us a rich literature about numeric integration methods, and approaches to difference equations. I spent some time refreshing my undergrad training by browsing Wikipedia for &quot;Numerical methods for ordinary differential equations&quot;, &quot;Euler method&quot;, &quot;Midpoint method&quot;, &quot;Runge-Kutta methods&quot;, etc. Recall that in the 18th and 19th centuries, computation was <em>vastly</em> more expensive than now, so there was a big payoff for seeking every last bit of computational efficiency. There is no One Method to Rule Them All.</p> <p>Some variants evaluate integrand terms in the middle of the discrete interval. I haven't bothered to actually crank through the math, but I expect the geometric formulation you show (with the angle bisector being perpendicular to the chord) winds up equivalent to the midpoint method -- giving rise to <span class="math-container">$\Delta \theta/2$</span>. That's only one of several methods and variants that may (or may not) be the very best compromise between compute time and accuracy. When our predecessors fiddled the equations to improve convergence (or something), that is equivalent to fiddling the details of the geometry.</p> <p>Nowadays, computation is cheap enough that we don't need to struggle to find the very best method -- any of them would probably work fine for us. We just need one that is adequate, and if you find you need more accuracy, burn some compute cycles by using a smaller discrete step size.</p> <p>At the risk of seeming to be an overly pragmatic roboticist, I would suggest &quot;don't worry about it&quot;.</p>