Friday, October 21, 2011

Dōmo arigatō, Mr. Roboto


"Robotics has always fascinated man, because let's face it, it's awesome to play god... We humans are vain fuckers. "
~ Me on Robotics

Robots are awesome, don't let anyone tell you otherwise, from evil science fiction police robots to awesome real robots that rock all day long, robotics is full of winning. I dare you name one lame robot in  history... ok, C3PO sucked ass but hey, even him could speak 6 million languages.

"woo arrrr moo ar gah" (that's "fuck you" in wookie)

Truth is that we were born too soon and we won't live long enough to see robots like C3PO saving any galaxy. However, we have pretty impressive machines right now, like robots that wonder in other planets just like you do in your living room, or creepy robotic hands that cut you open and play with your insides.

"Yep,  straight out of your favorite horror movie"

Sadly, robotics is not all beer and strippers, sometimes robots can be as fun as a handbag full of snakes. For instance: isn't frustrating when yor are at your first robotics class and can't even find a robot's location from a camera point of view?... Well, maybe not, but in case you're reading this, you probably ended up here googling how to resolve that tricky stuff.
 
Let's get started

First, it's very common in robotics to use two or more coordinate frames to solve a problem. Industrial robots for example, use cartesian coordinates (height, width and depth) to move an object across the space.

Now, let's say you have a camera looking to a robot's 3 dimensional workspace from above (there you have the camera axis and the robot's axis) and you want the robot to move to a certain point in the workspace knowing only the point coordinates from the camera's point of view.

Yes, this blog can get serious sometimes.

Of course, you'll need to transform these "camera coordinates" into the coordinates from the point of view of the robot... damn how to do that? Simple, you use a type of transformation matrix called Perspective Matrix.

 

We will need at least 3 known points from both the robot and the camera points of view to be able to resolve the system. Suppose Robot coordinates are (Xr1,Yr1,Zr1), (Xr2,Yr2,Zr2) and (Xr3,Yr3,Zr3) and camera are (Xc1,Yc1), (Xc2,Yc2) and (Xc3,Yc3). We should get  a set of nine equations with nine variables (our perspective matrix).

(a*Xr1) + (b*,Yr1) + (c*Zr1)  = Xc1
(d*Xr1) + (e*,Yr1) + (f*Zr1)  = Yc1
(g*Xr1) + (h*,Yr1) + (i*Zr1)  = 1

(a*Xr2) + (b*,Yr2) + (c*Zr2)  = Xc2
(d*Xr2) + (e*,Yr2) + (f*Zr2)  = Yc2
(g*Xr2) + (h*,Yr2) + (i*Zr2)  = 1

(a*Xr3) + (b*,Yr3) + (c*Zr3)  = Xc3
(d*Xr3) + (e*,Yr3) + (f*Zr3)  = Yc3
(g*Xr3) + (h*,Yr3) + (i*Zr3)  = 1

Resolve this system and there you go... you have your Perspective Matrix

Once obtained the values ​​of the perspective matrix, it is easy to do conversions by multiplying the robot coordinates by the perspective matrix to obtain camera coordinates. Or the camera coordinates for the  the inverse of the perspective matrix to obtain robot coordinates.


I hope this helps some tormented soul someday... cheers.

Hey baby, wanna kill all humans?
To  know more:
      - Introduction to Homogeneous Transformations & Robot Kinematics

No comments:

Post a Comment