Closed Bestboy125 closed 1 year ago
or just because of the frequence of camera
From the error, it looks like the messages are out of order. Maybe you should investigate this, and see if there is a driver problem / plot the timestamps to see where this problem is occuring.
Here is a starting point (not sure if that correct, but you can debug)
Script:
import rosbag
import matplotlib.pyplot as plt
bagfile = 'camera_imu_calibration.bag'
topic_time = '/usb_image_rect_raw'
# load bag message timestamps
timestamps = []
for topic, msg, t in rosbag.Bag(bagfile).read_messages():
if topic != topic_time:
continue
timestamps.append(msg.header.stamp.to_sec())
# subtract start time to help viz a bit better
timestart = timestamps[0]
for i in range(0, len(timestamps)):
timestamps[i] = timestamps[i] - timestart
# color invalid points if decreases
colors = ['black']
for i in range(1, len(timestamps)):
if timestamps[i-1] < timestamps[i]:
colors.append('black')
else:
colors.append('red')
# plot!
plt.scatter(range(0, len(timestamps)), timestamps, color=colors)
plt.plot(range(0, len(timestamps)), timestamps, '-k')
plt.xlabel('message number')
plt.ylabel('dataset time (s)')
plt.show()
Thank you for your code and advice! According to your beautiful code,i check my rosbag.it looks like that the imu has no problem and the problem is my camera. i use the usb_cam to connect my camera.i guess i should turn up the frequence of camera to 20hz.or i should check the config of the usb_cam,such as io method.
感谢您的代码和建议! 根据你漂亮的代码,我检查了我的rosbag。看起来imu没有问题,问题是我的相机。 我使用usb_cam连接我的相机。我想我应该将相机的频率调至20hz。或者我应该检查usb_cam的配置,例如io方法。
Hello,may I ask how you resolved the issue in the end?
i just use the kalibr to caliibrate the imu and camera.
my imu is the ttl-485 wit HWT905-485,just one request and one answer.
first i just record a rosbag by subing the /imu and /usb_image_rect_raw.and one is 150hz another is 4hz.
second i can calibrate.
i think my rosbag time has no problem.but it show me that "The time sequence must be nondecreasing".I have no idea.
how can i check it?
my rosbag:https://drive.google.com/file/d/1zHDIAAe0t-u1Fy-oYFS9e21o_LimseFS/view?usp=sharing
while i run
in shell the error will show
so i guess the problem is the time between the imu and camera. i check the rosbag info
and i check the /imu info by using ros_readbagfile this the part of the info
and i check the camera rostopic by using ros_readbagfile this is a part of the info
so i do not know whether it is due to time.if it is true,i guess i should use the message_fliter?just like this:http://wiki.ros.org/message_filters
Thank you!