Using Transforms to Robot Base View

From wikidb
Jump to: navigation, search

Motivation

One approach is to transform odometry results to a robot base. This would leave use with a speed in the robot's x direction and an angular z component. If the x speed is positive, the robot is moving forward. This simplifies reasoning. This page documents investigations. The investigation of this path is not completed.

Not currently successful

ROS Transforms

Unsuccessful Path

This is a dead end. ROS transforms tell us where we the robot base is in our map space but does not transform to robot space.

ROS Transform References

My Code

 #include <tf/transform_listener.h>

And added the following to the main loop to test the idea:

   while (ros::ok()) {
       ros::spinOnce();
       loop_rate.sleep();

       tf::StampedTransform transform;
       geometry_msgs::Twist t;
       try {
           // tf_listener.lookupTransform("/odom", "/base_link",
           //				     ros::Time(0), transform);
           tf_listener.lookupTwist("/base_link", "/odom",
                                    ros::Time(0), ros::Duration(0.1), t);
       }
       catch (tf::TransformException ex){
           ROS_ERROR("%s", ex.what());
           ros::Duration(1.0).sleep();
       }

       // ROS_INFO ("x %.2f, y %.2f", transform.getOrigin().x(), transform.getOrigin().y());
       ROS_INFO ("x %.2f, y %.2f", t.linear.x, t.linear.y);

       ...