Re: RTAB-Map and Unity integration
Posted by
matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/RTAB-Map-and-Unity-integration-tp4925p4998.html
Hi,
we need TF to get transform between base and the sensors. Using this python
script:
import rosbag
from tf.msg import tfMessage
with rosbag.Bag('Mapping_run10_out.bag', 'w') as outbag:
for topic, msg, t in rosbag.Bag('Mapping_run10.bag').read_messages():
if topic == "/tf" and msg.transforms:
filteredTransforms = [];
for m in msg.transforms:
if m.header.frame_id != "map" and m.header.frame_id != "hector_map":
filteredTransforms.append(m)
else:
print 'map frame removed!'
if len(filteredTransforms)>0:
msg.transforms = filteredTransforms
outbag.write(topic, msg, t)
else:
outbag.write(topic, msg, t)
I removed only /map and /hector_map frames from the bags. Covariances from hector output odometry are not valid for rtabmap. We must use TF for odom and fix the variance ourself by adding these parameters to rtabmap node:
<node name="rtabmap" ... >
...
<param name="odom_frame_id" value="hector_map"/>
<param name="odom_tf_angular_variance" value="0.001"/>
<param name="odom_tf_linear_variance" value="0.001"/>
</node>
Run:
$ roslaunch build_from_bag.launch
$ rosbag play --clock Mapping_run10_out.bag
Results are as expected (bag 3 here):

but there is still a TF error between base frame and the camera frame. The laser scans don't match exactly with the cloud created from the camera. Here some examples:

Look how the yellow dots from the scan don't match with the cloud from the camera.

Another offset in rotation in the "12" bag:

Following is another problem, this is only one scan. The bottom shows two layers of scans, how did you merge the scans from the 3 lidars? Maybe some TF tuning to get the scans overlaying each other.

cheers,
Mathieu