Hi.
I am trying to run the code on KAIST VIO dataset
and no luck yet.
I used these following config and launch files
[Config file]
# euroc yaml file
cam0:
T_cam_imu:
[0.0403, 0.0263, 0.9988, -0.0364,
-0.9990, -0.0204, -0.0398, -0.1376,
0.0194, -0.9994, 0.0271, -0.0188,
0, 0, 0, 1.0]
camera_model: pinhole
distortion_coeffs: [0.006896928127777268, -0.009144207062654397, 0.000254113977103925, 0.0021434982252719545]
distortion_model: radtan
intrinsics: [380.9229090195708, 380.29264802262736, 324.68121181846755, 224.6741321466431]
resolution: [640, 480]
timeshift_cam_imu: -0.029958533056650416
cam1:
T_cam_imu:
[-0.0391, 0.0250, 0.9989, -0.0366,
-0.9990, -0.0203, -0.0386, -0.1365,
0.0193, -0.9995, 0.0258, 0.0311,
0, 0, 0, 1.0]
# T_cn_cnm1:
# [0.9999992248836708, 0.00006384241340452582, 0.0012434452955667624, -0.049960282472300055,
# -0.00006225102643531651, 0.9999991790958949, -0.0012798173093508036, -0.00005920119010064575,
# -0.001243525981443161, 0.0012797389115975439, 0.9999984079544582, -0.000143160033953494487,
# 0, 0, 0, 1.0]
camera_model: pinhole
distortion_coeffs: [0.007044055287844759, -0.010251485722185347, 0.0006674304399871926, 0.001678899816379666]
distortion_model: radtan
intrinsics: [380.95187095303424, 380.3065956074995, 324.0678433553536, 225.9586983198407]
resolution: [640, 480]
timeshift_cam_imu: -0.030340187355085417
[launch file]
<launch>
<!--For the back-end -->
<arg name="calibration_file" default="$(find ensemble_vio)/config/camchain-imucam-kaistviodataset.yaml"/>
<node pkg="ensemble_vio" type="envio_node" name="envio_node">
<rosparam command="load" file="$(arg calibration_file)" />
<!-- Remapping : put your topics -->
<remap from="/imu" to="/imu_data"/>
<remap from="/left_image" to="/camera/infra1/img"/>
<remap from="/right_image" to="/camera/infra2/img"/>
<!-- Vision processing parameters -->
<param name="nx" value="25" type="int"/>
<param name="ny" value="15" type="int"/>
<param name="min_depth" value="0.5" type="double"/>
<param name="max_depth" value="20" type="double"/>
<param name="min_parallax" value="1" type="double"/>
<param name="ransac_thr" value="1" type="double"/>
<!-- Initial std_dev [rad, m, m/s, m/s^2, rad/s] -->
<param name="P0/attitude" value="0.0175" type="double"/>
<param name="P0/position" value="3e-2" type="double"/>
<param name="P0/velocity" value="1e-1" type="double"/>
<param name="P0/ba" value="0.1962" type="double"/>
<param name="P0/bg" value="2e-3" type="double"/>
<param name="P0/depth" value="1.5" type="double"/>
<param name="P0/idepth" value="0.1" type="double"/>
<param name="num_init_samples" value="600" type="int"/>
<!-- Process noises [rad/s^(1/2), m/s^(3/2), m/s^(5/2), rad/s^(3/2)]-->
<param name="Q/velocity" value="2.3e-2" type="double"/>
<param name="Q/attitude" value="1.0e-4" type="double"/>
<param name="Q/ba" value="2.5e-3" type="double"/>
<param name="Q/bg" value="7e-5" type="double"/>
<!-- Estimator parameters -->
<param name="inverse_depth" value="false" type="bool"/>
<param name="R_std" value="12" type="double"/>
<param name="max_lifetime" value="200" type="int"/>
<param name="thr_stop" value="1e-3" type="double"/>
<param name="max_diff" value="40" type="double"/>
<param name="N_en" value="100" type="int"/>
<param name="use_stochastic_gradient" value="true" type="bool"/>
<param name="thr_weak" value="3" type="double"/>
<!-- Sparse setting -->
<param name="thr_num" value="200" type="int"/>
<param name="uniform_dist" value="15" type="int"/>
<param name="max_iter" value="10" type="int"/>
</node>
</launch>
[compressed to raw image file]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import rospy
import cv2
import numpy as np
import sys
import signal
from sensor_msgs.msg import Image
from sensor_msgs.msg import CompressedImage
from sensor_msgs.msg import Imu
from cv_bridge import CvBridge, CvBridgeError
def signal_handler(signal, frame): # ctrl + c -> exit program
print('You pressed Ctrl+C!')
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
class converter():
def __init__(self):
rospy.init_node('compressed_to_raw', anonymous=True)
self.comp_sub1 = rospy.Subscriber('/camera/infra1/image_rect_raw/compressed',CompressedImage,self.callback1)
self.comp_sub2 = rospy.Subscriber('/camera/infra2/image_rect_raw/compressed',CompressedImage,self.callback2)
self.imu_subscriber = rospy.Subscriber('/mavros/imu/data', Imu, self.imu_callback)
self.img_pub1 = rospy.Publisher('/camera/infra1/img',Image,queue_size=100)
self.img_pub2 = rospy.Publisher('/camera/infra2/img',Image,queue_size=100)
self.imu_publisher = rospy.Publisher('/imu_data', Imu, queue_size=100)
self.bridge = CvBridge()
def callback1(self, data):
try :
np_arr = np.fromstring(data.data, np.uint8)
image_np = cv2.imdecode(np_arr, cv2.IMREAD_COLOR) # OpenCV >= 3.0:
cv_image=cv2.cvtColor(image_np, cv2.COLOR_BGR2GRAY)
img=self.bridge.cv2_to_imgmsg(cv_image, "mono8")
img.header.stamp = data.header.stamp
# img.header.stamp = rospy.Time.now()
self.img_pub1.publish(img)
except CvBridgeError as e:
pass
def callback2(self, data):
try :
np_arr = np.fromstring(data.data, np.uint8)
image_np = cv2.imdecode(np_arr, cv2.IMREAD_COLOR) # OpenCV >= 3.0:
cv_image=cv2.cvtColor(image_np, cv2.COLOR_BGR2GRAY)
img=self.bridge.cv2_to_imgmsg(cv_image, "mono8")
img.header.stamp = data.header.stamp
# img.header.stamp = rospy.Time.now()
self.img_pub2.publish(img)
except CvBridgeError as e:
pass
# def callback(self,data):
# try :
## self.time = time.time()
# cvimage=self.bridge.imgmsg_to_cv2(data,"bgr8")
# cv_image=cv2.cvtColor(cvimage,cv2.COLOR_BGR2GRAY)
# img=self.bridge.cv2_to_imgmsg(cv_image, "mono8")
# img.header.stamp = rospy.Time.now()
# self.img_publisher.publish(img)
# #print(time.time()-self.time)
# except CvBridgeError as e:
# pass
def imu_callback(self,data):
# data.header.stamp = rospy.Time.now()
new_data = data
new_data.header.stamp = data.header.stamp
self.imu_publisher.publish(data)
if __name__=='__main__':
cvt=converter()
time.sleep(1)
while 1:
pass
I am pretty sure the config file (intrinsic and extrinsic) is correct. example video clip with the dataset
But with any bag file of the dataset, envio
diverges even with static starts.
Can you give me some comments to solve this issue?
Thank you in advance.