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](http://www.ist.tugraz.at/robotics/bin/view/Main/Poineer_mapping) 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](/upfiles/14238183324878828.png). 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](/upfiles/14238185341661154.png). The current transform tree according to my code is [this](/upfiles/14238187038679438.png). The code that I am using to build the transformations is the following:
#include
#include
#include
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("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](/upfiles/1423820617525082.png) 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.
↧