• Increase font size
  • Default font size
  • Decrease font size

Coordinate systems

Coordinate systems and especially transformations between local and world coordinates are used in robotics very often. Here is a small but practical introduction into the topic.

There are different types of coordinate systems but when we talk about robotic the most popular are:

 

  1. The standard Cartesian coordinates - values x, y specify position of a point as a distance from the coordinate system origin. Origin is the point where coordinate system axis cross each other. These axis are perpendicular. Computer display uses this type of coordinate system.
  2. The standard Polar coordinates - 2D coordinate system in which position of a point in a plane is determined by a distance from a fixed point (r) and an angle (theta) from a fixed direction.
When we want to transform local to world coordinates and vise verse we need to do that in a specific coordinate system. Let's focus on Cartesian coordinate system. In the system we use matrices and vectors to do the job.

 

Transformation matrix - the coordinate system that is rotating while the object remains fixed.  (http://www.continuummechanics.org/cm/coordxforms.html)
Q = [cos(theta), sin(theta); -sin(theta), cos(theta)] = R'
$Q^{-1}$ = $Q'$ = $R$
Let $v_{new}$ and $v_{old}$ be vectors than
$v_{new} = Q * v_{old}$

Rotation matrix - the object rotates while the coordinate system remains fixed.
R = [cos(theta), -sin(theta); sin(theta), cos(theta)] = Q'
$R^{-1}$ = $R'$ = $Q$
Let $v_{new}$ and $v_{old}$ be vectors than
$v_{new} = R * v_{old}$

Transformation from global to local coordinates and vise versa in Octave/Matlab

clear all;
close all;
clc;

offset = 0.1;

%Transformation matrix from global to local coordinates
theta1 = -pi/4;
x1 = 2;
y1 = 2;
R1 = [cos(theta1), - sin(theta1), x1; sin(theta1), cos(theta1), y1; 0, 0, 1];

%Transformation matrix from local to global coordinates
R1_inv = inv(R1);

%Points in global and local coordinate system
Xg = [1;2;1];
Xl = [1;1;1];
%Temp vector used to store temporary math result
TMP = [0;0;0];

%Vector containing data to be plotted - initially filled by min and max values so the plot has dimensions 0 - 10 in x direction and 0 - 10 in y direction
x=[0,0;10,0];
y=[0,0;10,0];

%Display Xg in global CS
printf("Xg in global CS - no transformation needed: ");
TMP = Xg
text (TMP(1,1) + offset,TMP(2,1) - offset, "Xg in\ngl. CS");
hold on
x=[x;TMP(1),0]; %Add result into vector that will be plotted
y=[y;TMP(2),0]; %Add result into vector that will be plotted

%Display Xl in global CS
printf("Xl in global CS - transformed via R1: ");
TMP = R1*Xl
text (TMP(1,1) + offset,TMP(2,1) - offset, "Xl in\ngl. CS");
hold on
x=[x;TMP(1),0];
y=[y;TMP(2),0];

%Display Xg in local CS
printf("Xg in local CS - transformed via R1_inv: ");
TMP = R1_inv*Xg
text (TMP(1,1) + offset,TMP(2,1) - offset, "Xg in local CS\nnote: [0,0] of this view is taken as origin of the local CS for this point");
hold on
x=[x;TMP(1),0];
y=[y;TMP(2),0];

%Plot
stem(x,y);

%Save
print("local_to_global_coords_transforms.png");

----------------------------------------------------------------------

Source code : local_to_global_coords_transforms.m

Result of the local_to_global_coords_transforms.m generated in Octave

Extended source code : local_to_global_coords_transforms_ext.m

Result of the local_to_global_coords_transforms_ext.m generated in Octave

 

Comments  

 
0 #12 Download site 2019-01-30 01:43
Pretty section of content. I just stumbled upon your website and in accession capital to assert that I acquire in fact enjoyed account your blog posts.
Anyway I'll be subscribing to your feeds and even I achievement you access consistently rapidly.


My blog post - Download site: https://www.luo3.top/space.php?uid=189554&do=blog&id=424547
Quote
 
 
0 #11 viagra tablets 2019-01-21 09:28
It's appropriate time to make some plans for the future and
it is time to be happy. I've read this post and if I could I wish to suggest you
some interesting things or advice. Perhaps you could write next articles
referring to this article. I desire to read even more things about
it! viagra tablets: https://www.jewelrycoco.com/answer/5154/the-upside-to-viagra
Quote
 
 
0 #10 profile7980 2018-11-01 13:58
Need cheap hosting? Try webhosting1st, just $10 for an year.

https://pt-br.redes-sociais.com/images/photos/1815/149/a88cc2de92b30a9b1e55e655.jpg
Quote
 
 
0 #9 BeatriceJuicy 2018-08-13 00:22
Hello. I see that you don't update your website too often. I know
that writing posts is time consuming and boring. But did you know that
there is a tool that allows you to create new posts using existing content (from article directories or
other websites from your niche)? And it does it very well.

The new posts are unique and pass the copyscape test.
You should try miftolo's tools
Quote
 
 
0 #8 real edu blog 2018-05-26 01:47
Good day! Do you know if they make any plugins to safeguard against hackers?
I'm kinda paranoid about losing everything I've worked hard on. Any tips?
Quote
 
 
0 #7 waist shaper 2018-03-28 14:14
Excellent blog here! Also your website loads up very fast!
What web host are you using? Can I get your affiliate link to your host?
I wish my website loaded up as quickly as yours lol
Quote
 
 
0 #6 money lender 2018-02-19 22:22
Hi are using Wordpress for your site platform?

I'm new to the blog world but I'm trying to get started and create my own. Do
you require any html coding knowledge to make your own blog?
Any help would be greatly appreciated!
Quote
 
 
0 #5 news houston 2018-01-05 10:21
If that suits you reading news, you will want to make use of an online news aggregate to help you
boost your comprehension skills inside the new vernacular.

Until you buy your feet under you, you have to minimize
the knowledge you eat, and TV news houston: https://mylatestnews.org is the initial to
go. Over the approaching months I'll be writing some articles revealing the techniques for pr (everything a
journalist doesn't really would love you to
know.
Quote
 
 
0 #4 broderie 2017-09-30 17:15
Exceptional post but I was wanting to know if you could write a litte more
on this subject? I'd be very thankful if you could elaborate a little bit further.
Kudos!
Quote
 
 
-1 #3 skyrim 2017-07-21 21:49
Thanks a bunch for sharing this with all folks you actually understand what you
are speaking approximately! Bookmarked. Please additionally talk over with my site =).
We will have a hyperlink exchange contract between us
http://theelderscrolls5skyrimevolution225.ru/
skyrim: http://theelderscrolls5skyrimevolution225.ru
http://theelderscrolls5skyrimevolution225.ru
Quote
 

Add comment

No bad words.


Security code
Refresh


Design by i-cons.ch / etosha-namibia.ch