[ros-users] Subscribing to PR2 Base Odometry

Sebastian Castro sac77 at cornell.edu
Thu Apr 1 00:40:21 UTC 2010


Is there any way to subscribe to the pose of the base of a simulated PR2
robot? Ideally it should look something like this:

  ros::Subscriber sub_odom = n.subscribe("base_pose_ground_truth", 100,
recordOdom);

//callback to store 0dometry data
void recordOdom(const nav_msgs::Odometry::ConstPtr& data){
    xPos=data->pose.pose.position.x;
    yPos=data->pose.pose.position.y;
    //get Quaternion anglular information
    double x=data->pose.pose.orientation.x;
    double y=data->pose.pose.orientation.y;
    double z=data->pose.pose.orientation.z;
    double w=data->pose.pose.orientation.w;
    //convert to pitch
    angle=atan2(2*(y*x+w*z),w*w+x*x-y*y-z*z);
}

The bottom line is, I would like to keep track of the angle of the PR2 robot
base over time, but I cannot figure out how to subscribe to the pose. Any
ideas?

Thanks,

-- 
Sebastian Castro
Mechanical & Aerospace Engineering
Cornell University, Class of 2010
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20100331/106f4246/attachment-0002.html>
-------------- next part --------------
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
-------------- next part --------------
_______________________________________________
ros-users mailing list
ros-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ros-users


More information about the ros-users mailing list