0
$\begingroup$

Rosanswers logo

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.


Originally posted by RND on ROS Answers with karma: 133 on 2015-02-13

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by tfoote with karma: 58457 on 2015-02-13

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by RND on 2015-02-14:
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?

Comment by RND on 2015-02-14:
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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.