ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

how to transform local position to global?

asked 2016-03-03 12:56:18 -0600

Knowledge gravatar image

I want to create to nodes and make them communicate on the same topic of type position,

http://wiki.ros.org/ROS/Tutorials/Und...

This tutorial helped me how to create two nodes and make them communicate on a topic. Using turtlesim i can detect the turtle position but how can i convert that position from local to global reference frame? The tutorial only shows how to make nodes and topics and use turtlesim_node as first node and turtle_teleop_key as other, turtle1/pose as the topic, but i can't get how this node can convert the coordinates that is x,y and theta and change them into global reference frame?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-06-20 00:46:31 -0600

sunpochin gravatar image

http://www.inf.ed.ac.uk/teaching/cour...

page 17: Rotation, Translation The matrix of rotation and then translation is often used so it may be worth to remember it.

the codes will look like this:

    double rotatedX = ptLocal.x * cos(ThetaRadian) 
      - ptLocal.y * sin(ThetaRadian);
    double rotatedY = ptLocal.x * sin(ThetaRadian) 
      + ptLocal.y * cos(ThetaRadian);

    rotate_translate_x = rotatedX
        + info_.GetGlobalPose2D().x;
    rotate_translate_y = rotatedY
        + info_.GetGlobalPose2D().y;
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-03-03 12:56:18 -0600

Seen: 1,886 times

Last updated: Mar 03 '16