# How to programatically set the 2D pose on a map?

How do I programatically set the the initial 2D pose estimate on a map when running acml and move_base - equivalent to the "2D pose estimate" button within Rviz ?

Originally posted by JediHamster on ROS Answers with karma: 995 on 2011-04-09

Post score: 5

## 2 Answers

Just to add a little more information. You can set the inital pose of the robot by publishing to the "initialpose" topic used by AMCL and documented here: http://www.ros.org/wiki/amcl#Subscribed_Topics. This is, in fact, what RVIZ does when you use the "2D Pose Estimate" button. You can always user "rostopic echo initialpose" to see exactly what it's sending.

Hope this helps.

Originally posted by eitan with karma: 2743 on 2011-04-11

This answer was ACCEPTED on the original site

Post score: 6

Hello,

We have done like below:

We used ar_pose_estimate to get pattern position from the robot and then subsribe to ar pose topic and get the robot pose.

msg_mark is the message received from ar_pose_marker

msg.header.frame_id = "/map";
msg.pose.pose.position.x = msg_mark->pose.pose.position.x;
msg.pose.pose.position.y = msg_mark->pose.pose.position.y;
msg.pose.pose.position.z = 0.0;
msg.pose.pose.orientation.w = msg_mark->pose.pose.orientation.w;

double theta;
btQuaternion quat;
quat.setRPY(0.0, 0.0, theta);


tf::quaternionTFToMsg(quat, pose.pose.pose.orientation);

msg.pose.covariance[6*0+0] = 0.5 * 0.5;

msg.pose.covariance[6*1+1] = 0.5 * 0.5;

msg.pose.covariance[6*3+3] = m_pi/12.0 * m_pi/12.0;

Regards,

Prasad

Originally posted by Prasad with karma: 79 on 2011-04-10

This answer was NOT ACCEPTED on the original site

Post score: 2

### Original comments

Comment by FuerteNewbie on 2014-01-02:
Does this answer the question? Sorry but i really cant understand the ar pose topic.

Comment by achmad_fathoni on 2018-06-16:
@FuerteNewbie Here some detail about ar_pose_estimate. Anyway I have similar problem, so how you solve it?