Robotics StackExchange | Archived questions

Issue with converting laser scan readings from base_scan frame to odom frame

ROS developers and robotic enthusiasts

Recently I was involved in some assignments of tracking robots as a part of cooperative robots project. The major task was to cluster the readings of a master robot to identify a slave robot and track its position. In order to do so one would have a base idea to convert the reading from base_Scan frame of the master robot to the odom frame of the master and then track the centre of the slave robot. The following library has been used

try:
            transform = self.tf_buffer.lookup_transform(self.odom_frame, self.laser_frame, rospy.Time(0), rospy.Duration(0.5))
        except(tf2_ros.LookupException, tf2_ros.ExtrapolationException):
            rospy.loginfo('Cannot transform')
        transformed = do_transform_cloud(cloud_out, transform)
        xyz_array = ros_numpy.point_cloud2.pointcloud2_to_xyz_array(transformed)

So basically what it does is, listening to the transform between laser frame to the odom frame and converts the point cloud data (cloudout) from laser frame to odom frame. where cloudout is the projected point cloud data from the laser scan data.

Now the issue I observe is that the transformed point cloud readings are not coinciding with the laser scan data when I plot it in rviz. As and when the master robot moves there is an offset created with respect to the laser scan data.

Looking forward to get some this msytery solved...

Asked by Vignesh_93 on 2021-04-22 08:32:37 UTC

Comments

Answers

Closing this as the issue was with the frame id. When publishing the point cloud, it is always advised to publish the point clouds with respect to a fixed frame. In my case it was the odom frame..

Asked by Vignesh_93 on 2021-06-05 08:58:02 UTC

Comments