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

Odom Axes not in line with base_link

asked 2015-02-13 03:16:45 -0500

RND gravatar image

updated 2015-02-13 03:44:47 -0500

Hi,

I am using Powerbot to be able to build a map using gmapping algorithm. To setup my robot, I am using the ROSARIA package to be able to have control on the motors, get pose estimates from odometry etc. This is an ROS wrapper for the ARIA library provided by ActivMedia mobilerobots.

I am aware that I need some tf configuration in order to align the odometry frame with the base_link and to align the laser frame with base_link frame. I have followed the tutorials and I have understood the concept. I came across this tutorial and followed it to be able to create my transforms while using ROSARIA. However, in doing so, I have noticed that the odometry axes is not aligned with the base_link axes. The laser axes are aligned perfectly as can be seen in this screenshot. The odometry axes as the ones far off from the other two.

I am aware that ROSARIA publishes its own tf as can be seen from rosgraph.png. The current transform tree according to my code is this. The code that I am using to build the transformations is the following:

#include <ros/ros.h>
#include <tf/transform_broadcaster.h>
#include <nav_msgs/Odometry.h>


void poseCallback(const nav_msgs::Odometry::ConstPtr& odomsg)
{
   //TF odom=> base_link

     static tf::TransformBroadcaster odom_broadcaster;
    odom_broadcaster.sendTransform(
      tf::StampedTransform(
                tf::Transform(tf::Quaternion(odomsg->pose.pose.orientation.x,
                                     odomsg->pose.pose.orientation.y,
                                     odomsg->pose.pose.orientation.z,
                                     odomsg->pose.pose.orientation.w),
        tf::Vector3(odomsg->pose.pose.position.x/1000.0, 
                    odomsg->pose.pose.position.y/1000.0, 
                    odomsg->pose.pose.position.z/1000.0)),
                odomsg->header.stamp, "/odom", "/base_link"));
      ROS_DEBUG("odometry frame sent");
      ROS_INFO("odometry frame sent: y=[%f]", odomsg->pose.pose.position.y/1000.0);
}

int main(int argc, char** argv){
    ros::init(argc, argv, "pioneer_tf");
    ros::NodeHandle n;

    ros::Rate r(100);

    tf::TransformBroadcaster broadcaster;

  //subscribe to pose info
    ros::Subscriber pose_sub = n.subscribe<nav_msgs::Odometry>("RosAria/pose", 100, poseCallback);

    while(n.ok()){
    //base_link => laser
        broadcaster.sendTransform(
            tf::StampedTransform(
                tf::Transform(tf::Quaternion(0, 0, 0), tf::Vector3(/*0.034, 0.0, 0.250*/0.385, 0, 0.17)),
                ros::Time::now(), "/base_link", "/laser"));

    ros::spinOnce();        
    r.sleep();
    }
}

Of course, the maps created using this setup are a mess. This happens after I move the robot with the joystick for a bit. Initially, on starting up ROSARIA and the transform node the axes are aligned. It is only after the robot moves that they lose their alignment. Can someone help me understand what is wrong with my transform tree and how can I fix this? Thanks!

EDIT

This is a typical example of what happens to my robot's odometry when I drive it around a little bit. Basically, it moved forwards, then turned around a desk and then moved forwards some more. I do not expect such bad odometry.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-02-13 13:13:20 -0500

tfoote gravatar image

When the robot starts up the base_link and odom frames are alligned since that's the default initial position. After that as you drive around the odom frame should stay still while the robot moves relative to that position. See REP 105 for more information.

edit flag offensive delete link more

Comments

ok that makes sense thanks! Does that mean that my odometry is correct then? Also, are my transforms correct to be able to run gmapping?

RND gravatar image RND  ( 2015-02-14 02:18:39 -0500 )edit

Also, in the last EDIT of my post, I have attached a screenshot of what happens to my robot's odometry in rviz (red arrows) when driving it around...I cannot understand what happened there and why I could see so many arrows all over the place.

RND gravatar image RND  ( 2015-02-14 02:31:17 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-02-13 03:16:45 -0500

Seen: 1,556 times

Last updated: Feb 13 '15