Autoliv-Research / allan_variance_ros2

ROS2 compatible tool to generate Allan Deviation plots
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Allan Variance ROS 2 tool not processing data from STIM 300 bag file #5

Open SrOdranoel opened 1 week ago

SrOdranoel commented 1 week ago

Issue: Allan Variance ROS 2 tool not processing data from STIM 300 bag file

I am using an IMU STIM 300 and recorded a ROS 2 bag file of 13,210 seconds using the following command:

ros2 bag record -s mcap /imu/data_raw

When trying to process the bag file with the Allan Variance ROS 2 tool, I encounter the following issue:

voris@VOR04:~/ros2_ws$ ros2 run allan_variance_ros2 allan_variance /home/voris/bag/rosbag2_2024_10_03-14_22_11 /home/voris/bag/configfile/2000125.yaml
[INFO] [1727992974.201386723] [rclcpp]: Bag Path = /home/voris/bag/rosbag2_2024_10_03-14_22_11
[INFO] [1727992974.201408333] [rclcpp]: Config File = /home/voris/bag/configfile/2000125.yaml
[INFO] [1727992974.201410619] [rclcpp]: Output folder = data/output
[INFO] [1727992974.209353758] [rclcpp]: imu_topic: /imu/data_raw
[INFO] [1727992974.209384209] [rclcpp]: imu_rate: 2000
[INFO] [1727992974.209390811] [rclcpp]: measure_rate: 2000
[INFO] [1727992974.209395243] [rclcpp]: sequence_duration: 0
[INFO] [1727992974.209398210] [rclcpp]: sequence_offset: 0
[INFO] [1727992974.209409982] [rclcpp]: Computor constructed
[INFO] [1727992974.209412727] [rclcpp]: Processing rosbag /home/voris/bag/rosbag2_2024_10_03-14_22_11
[INFO] [1727992974.209415106] [rclcpp]: Processing /home/voris/bag/rosbag2_2024_10_03-14_22_11 ...
[INFO] [1727992974.229970896] [rclcpp]: Topic /imu/data_raw found in the bag!
[INFO] [1727992974.230847005] [rclcpp]: Finished buffering data. 0 measurements
[ERROR] [1727992974.230854228] [rclcpp]: No IMU messages to process, is your topic right?
[INFO] [1727992974.230858245] [rclcpp]: Total computation time: 0.021701 s
[INFO] [1727992974.230862778] [rclcpp]: Data written to allan_variance.csv

I have verified that the topic /imu/data_raw is present, and the bag contains data:

voris@VOR04:~/bag/rosbag2_2024_10_03-14_22_11$ ros2 bag info rosbag2_2024_10_03-14_22_11_0.mcap 

Files:             rosbag2_2024_10_03-14_22_11_0.mcap
Bag size:          9.1 GiB
Storage id:        mcap
Duration:          13210.486822950s
Start:             Oct  3 2024 14:22:11.475807670 (1727976131.475807670)
End:               Oct  3 2024 18:02:21.962630620 (1727989341.962630620)
Messages:          26420640
Topic information: Topic: /imu/data_raw | Type: sensor_msgs/msg/Imu | Count: 26420640 | Serialization Format: cdr

Additionally, when I run:

bash ros2 topic hz /imu/data_raw or

bash ros2 topic echo /imu/data_raw

I get reasonable IMU values that seem correct. These values would likely work if the bag had been recorded in ROS 1. However, in ROS 2, despite using the correct paths for both the bag and configuration file, the tool fails to process any messages.

I have tried providing both the full path to the bag file and to the calibration configuration file as arguments, but the error persists. Can you help identify what might be causing this issue, or if additional configuration is needed when using this program on ros2?

christian-nils commented 1 week ago

Hi!

Thanks for reporting the issue. Did you set a duration in your configuration file?

I can see that the duration is set to 0

[INFO] [1727992974.209395243] [rclcpp]: sequence_duration: 0

Can you post the content of your configuration file?

I have modified the configuration file schema to account for an offset, the original option sequence_time is now named sequence_duration.

SrOdranoel commented 1 week ago

It was that. I was using the same as in the ros 1 version. but now i came across the variable sequence_offset and I wanted to clarify its exact meaning. Could you explain what this variable represents in this context? Specifically, is it a delay intended to ignore data from the first few seconds, or is it related to something else?

Thank you for your help!

christian-nils commented 1 week ago

You are correct, it will ignore sequence_offset seconds from the beginning of the recording. I will update the readme accordingly. Thanks for reporting the issue.

SrOdranoel commented 1 day ago

One other thing: When I play my bag, I receive the following messages at the end of the computation:

[INFO] [1728927439.298125525] [rclcpp]: Total computation time: 60616.890604 s
[INFO] [1728927439.298137596] [rclcpp]: Data written to allan_variance.csv

However, I cannot find the generated .csv file anywhere. I left the terminal running the program for over an hour after receiving this message, thinking that it might still be writing the file, but nothing appeared.

After I investigated the allan_variance.cpp file and noticed that the output file is set to be placed in the directory specified by: std::string output_path = "data/output";.

I attempted to specify an output path using the following command, and it worked successfully:

ros2 run allan_variance_ros2 allan_variance ~/bag/rosbag2_2024_10_10-20_14_02 ~/bag/configfile/2000125.yaml ~/bag

I would recommend updating the README to inform users that a specified output path is required or that the default path is data/output.

Lastly, would you mind if I create a video tutorial explaining how to use the AllanVariance ROS 2 and post it on YouTube? And i can send a commit on the read me to post the video?