4

I'm watching this video at 36.00 min. The guy gave an example but I'm not sure what is the problem. He stated that if we want to move a robot then we should to the following

for inhomogeneous case, $$ x' = Rx + t \\ R = \begin{bmatrix} cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix} $$ where $t$ is the translation vector and $x$ is the previous position.

in homogeneous case, $$ x' = \begin{bmatrix} R & \bf{t} \\ \bf{0}^{T} & 1 \end{bmatrix} x $$ Now, he gave an example in which $$ t = \begin{bmatrix} 1 \\ 0 \end{bmatrix} , x = \begin{bmatrix} 0.7 \\ 0.5 \end{bmatrix} $$ My solution is as the following in Matlab

% inhomogeneous case
>> a = 45;
>> R = [cosd(a) -sind(a); sind(a) cosd(a)];
>> t = [1; 0];
>> x = [0.7; 0.5];
>> xnew = R*x + t
xnew =

    1.1414
    0.8485

For homogeneous case

>> xn = [R t; 0 0 1]*[x ; 1]

xn =

    1.1414
    0.8485
    1.0000

Both have same result, but the guy got another result. What exactly he did is

>> xf = [R x; 0 0 1]*[t ; 1]

xf =

    1.4071
    1.2071
    1.0000

Why he did switch $t$ and $x$? I'm aware of the issue that he is trying to calculate the velocity but in fact he is computing the position. This mistake in the notation won't affect the final result.


Second question, why he assumed that the forward movement of the robot in the above example should be $$ t = \begin{bmatrix}1\\0\end{bmatrix} $$ ? He said that because the robot always in the forward movement move in +x axis. Why this is the case? The movement in robot's frame is determined based on the direction of the robot and the distance the robot travels which is specified as hypotenuse length.

Shahbaz
  • 3,250
  • 1
  • 20
  • 38
CroCo
  • 2,453
  • 1
  • 17
  • 40

2 Answers2

1

The problem is that the rotation matrix describes the rotation around the coordinate system center and not around the center of the robot, so here's what happens.

You wish to add to the robot position a vector which is oriented the same as he is (which is described by R), so how do you do this. You take a vector t which is rotated by 0 degrees (that is [1; 0] because of the angle convention), you multiply it by intensity (which is 1 because of 1m/s), you rotate it so it has the same direction as your robot (because it should move forward) and then you add that vector to the current position (which is described by x).

So you in the end you get x'=R*t+x which is the same thing he did.

EDIT: I forgot to mention that this is much easier to remember in homogeneous representation:

S=[R R x; R R y; 0 0 1]

which represents the "state" of the robot (it's position and orientation, as I mentioned, if it's looking to the right along x axis its angle is 0). So when you multiply the state of the robot with transformation matrix you get the new state. Transformation matrix is in the exact shape as the state matrix, so it's A=[R R tx; R R ty; 0 0 1]. So if you want only to translate the robot you make [R R; R R] identity matrix [1 0; 0 1], and if you want only to rotate the robot you make tx=ty=0. You can both rotate and translate the robot at the same time like this but keep in mind that the robot will first translate and then rotate (that is, it will translate with respect to the old orientation, not the new one). If you wish to rotate and then translate it, make a rotation transformation matrix and multiply it by the translation transformation matrix and then use that matrix as the transformation matrix which you will multiply with the state matrix (right side multiply as always). Order of matrices is of course important as matrix multiplication is not commutative.

Regards

Damjan Dakic
  • 850
  • 5
  • 16
0

First of all thanx for sharing a good video i have me first lecture of Computer vision tomorrow so i revised all the matrix and vector operations. Its been a while when i last studied these things

OK your Second Question The assumption is made to simplify the problem to understand .if we have a robot with too many variables changing at the same time it will become complicated. So we assume just for the sake of simplicity When i first studied we used to assume a simple robot just going forward to understand control theory.

Now the First Question Why you answer is wrong

Simple Logic(just plot the values with a graph) : enter image description here robot was at x,y(0.7,0.5).it then moves another 1 Meter forward .which will end up increasing x and y eventually :) If your answer is right then the increased difference in your answer will give answer 1 by Pythagoras theorem

a^2 + b^2 = c^2

We cannot apply this x′=[R0Tt1]x formula straight forward because the teacher in the video said the distance of 1 meter it traveled is Local.

To change that local distance to global he uses the method Matrix multiplication with Vector.

There can be a lot more dicussion that can be done in solving these kind of questions.thats why i am posting the answer to see your response

Neo
  • 119
  • 4
  • I'm sorry but I'm not convinced by either answers. Saying for the sake of simplicity makes no sense to me. If the robot is moving in a planar environment then the robot must be represented as a Cartesian coordinates ($x,y$) or polar coordinates ($p, \theta$). For the forward movement, the direction must be specified in advance whether in global or local frames otherwise the definition of forward should be investigated. The forward movement of a rigid body is simply the distance the rigid body travels in the direction of its heading. – CroCo Feb 06 '14 at 05:11
  • For the first question, I'm not sure but I think the formula should be $x' = Rt + x$ not $x' = Rx + t$ to get same answer. – CroCo Feb 06 '14 at 05:12
  • By the way, I found this formula in another book. this is why once I switch t and x I got the correct result which is the length of hypotenuse by doing $$\sqrt{(1.4071-0.7)^{2} + (1.2071-0.5)^{2}} = 1$$ – CroCo Feb 06 '14 at 05:22
  • You are right "The forward movement of a rigid body is simply the distance the rigid body travels in the direction of its heading" thats why he said its an assumption – Neo Feb 06 '14 at 05:48
  • my friend i think you dont understand Translations.please refer the book where you found the formula – Neo Feb 06 '14 at 05:55
  • and can you tell me where in the video he said t=[1,0], x=[0.7,0.5] – Neo Feb 06 '14 at 06:00
  • Check the video at 36 min. $x$ is the previous location of the robot which is (0.7, 0.5). and the translation is (1,0) – CroCo Feb 06 '14 at 07:18
  • See the following picture http://imgur.com/P2u1QmM now let's go around. $$x_{new} = a + b = a + L_{2}cos\theta \ x' = x + L_{2}cos\theta \ y' = y + L_{2}sin\theta $$ – CroCo Feb 06 '14 at 07:37
  • Now, $$\underbrace{\begin{bmatrix} x' \ y' \end{bmatrix}}{\bf{x'}} = \underbrace{\begin{bmatrix} cos\theta & -sin\theta \ sin\theta & cos\theta \end{bmatrix}}{R} \underbrace{\begin{bmatrix} L_{2}=1 \ 0 \end{bmatrix}}{t} + \underbrace{\begin{bmatrix} x=0.7 \ y=0.5 \end{bmatrix}}{\bf{x}}$$ where $L_{2}$ is the forward movement. It is the length of hypotenuse. $a$ is ($x,y$) – CroCo Feb 06 '14 at 07:50
  • tell me the book where you found it. i would like to read some pages – Neo Feb 06 '14 at 08:35
  • "Game Physics Engine Development: How to Build a Robust Commercial-Grade Physics Engine for your Game" – CroCo Feb 11 '14 at 07:10
  • Actually, I've implemented the project in OpenGL and everything is working as a charm. What I said was correct. – CroCo May 09 '14 at 12:31