Git Product home page Git Product logo

allan_variance_ros's People

Contributors

dwisth avatar flex-transformer avatar goldbattle avatar mauricefallon avatar mintar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

allan_variance_ros's Issues

IMU Data Collection

Hello. I am a newbie to IMU.
Can you help me out in collecting data from IMU using Rosbag?

Do we need to collect data by exciting all IMU axes (rotation and translation)?

In the description it is given collect data for 3 hrs on damped surface. Can you explain in detail?

Csv dont created

Hello after i running this command `geo@geo:rosrun allan_variance_ros allan_variance /home/geo/allan_ws/cooked.bag /home/geo/allan_ws/src/allan_variance_ros/config/xsens.yaml

i have this

[ INFO] [1693522390.065245857]: Computed 23 bins for sampling period 999.8 out of 4728000 measurements.
[ INFO] [1693522390.065276365]: Computed 23 bins for sampling period 999.9 out of 4728000 measurements.
[ INFO] [1693522390.124736774]: Total computation time: 727.674321 s
[ INFO] [1693522390.124794165]: Data written to allan_variance.csv

but there is no csv or other file created.

allan_variance.txt
AllanVarianceComputor.txt

Is there something wrong?
Thanks in advance

EDIT

Running original.bag using rostopic echo /imu/data i had the following

`header: 
  seq: 14269
  stamp: 
    secs: 1693464526
    nsecs: 514156465
  frame_id: "imu_link"
orientation: 
  x: -0.00373723677363
  y: 0.00251957299416
  z: -0.01746058324
  w: 0.999837393203
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
angular_velocity: 
  x: 0.00422149919905
  y: 0.0120803716127
  z: 3.27825546265e-05
angular_velocity_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
linear_acceleration: 
  x: -0.0884681791067
  y: -0.0697058513761
  z: 9.7687997818
linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

`

doing the same thing for the cooked bag i have data showing but after a time.Cooked rosbag info.

`geo@geo-X570-GAMING-X:~/allan_ws$ rosbag info cooked.bag 
path:         cooked.bag
version:      2.0
duration:     4hr 1:50s (14510s)
start:        Aug 31 2023 09:48:10.83 (1693464490.83)
end:          Aug 31 2023 13:50:01.66 (1693479001.66)
size:         1.1 GB
messages:     34926585
compression:  bz2 [6423/6423 chunks; 14.20%]
uncompressed:   4.7 GB @ 340.0 KB/s
compressed:   684.3 MB @  48.3 KB/s (14.20%)
types:        geometry_msgs/QuaternionStamped [e57f1e547e0e1fd13504588ffc8334e2]
              geometry_msgs/Vector3Stamped    [7b324c7325e683bf02a9b14b01090ec7]
              rosgraph_msgs/Log               [acffd30cd6b6de30f120938c17c593fb]
              sensor_msgs/Imu                 [6a62c6daae103f4ff57a132d6f95cec2]
              sensor_msgs/NavSatFix           [2d3a8cd499b9b4a0249fb98fd05cfa48]
              sensor_msgs/TimeReference       [fded64a0265108ba86c3d38fb11c0c16]
              tf2_msgs/TFMessage              [94810edda583a504dfda3829e70d7eec]
topics:       /filter/quaternion      5792134 msgs    : geometry_msgs/QuaternionStamped
              /gnss                     57920 msgs    : sensor_msgs/NavSatFix          
              /imu/acceleration       5792134 msgs    : geometry_msgs/Vector3Stamped   
              /imu/angular_velocity   5792136 msgs    : geometry_msgs/Vector3Stamped   
              /imu/data               5792135 msgs    : sensor_msgs/Imu                
              /imu/time_ref           5907974 msgs    : sensor_msgs/TimeReference      
              /rosout                      17 msgs    : rosgraph_msgs/Log              
              /rosout_agg                   1 msg     : rosgraph_msgs/Log              
              /tf                     5792134 msgs    : tf2_msgs/TFMessage
`

The new error

geo@geo-X570-GAMING-X:~/allan_ws$ rosrun allan_variance_ros allan_variance /home/geo/allan_ws/cooked.bag /home/geo/allan_ws/src/allan_variance_ros/config/xsens.yaml
[ INFO] [1693563181.691655459]: Bag Folder = /home/geo/allan_ws/cooked.bag
[ INFO] [1693563181.692535029]: Config File = /home/geo/allan_ws/src/allan_variance_ros/config/xsens.yaml
[ INFO] [1693563181.692582439]: Bag filenames count: 1
[ INFO] [1693563181.692805242]: Successfully read config file: /home/geo/allan_ws/src/allan_variance_ros/config/xsens.yaml
[ INFO] [1693563181.692833686]: imu_topic: /imu/data
[ INFO] [1693563181.692877239]: imu_rate: 400
[ INFO] [1693563181.692898018]: measure_rate: 400
[ INFO] [1693563181.692914810]: sequence_time: 14400
[ INFO] [1693563181.692940599]: Batch computor constructed
[ INFO] [1693563181.692955136]: Processing rosbag /home/geo/allan_ws/cooked.bag
[ INFO] [1693563181.692971107]: Processing /home/geo/allan_ws/cooked.bag ...
[ INFO] [1693563181.692988800]: Writing output to: /home/geo/allan_ws/cooked.bag/allan_variance.csv
[ERROR] [1693563181.693018898]: Could not open the file for writing: /home/geo/allan_ws/cooked.bag/allan_variance.csv
[ INFO] [1693563181.693045909]: Total computation time: 0.000599 s
[ INFO] [1693563181.693060216]: Data written to allan_variance.csv

why it tries to create csv inside the bag ? 😕

compile err

  1. uint64_t
    catkin_build/src/allan_variance_ros/include/allan_variance_ros/ImuMeasurement.hpp:14:3: error: ‘uint64_t’ does not name a type uint64_t t{}; ///< ROS time message received (nanoseconds).

add #include <stdint.h> in ImuMeasurement.hpp file.

  1. error: expected unqualified-id before ‘using’
    catkin_build/src/allan_variance_ros/include/allan_variance_ros/AllanVarianceComputor.hpp:17:1: error: expected unqualified-id before ‘using’
    using EigenVector = std::vector<T, Eigen::aligned_allocator>;

analysis.py:25: RuntimeWarning: divide by zero encountered in log

Hello author,
I have recorded 3hr 37:31s (13051s) 2021-11-18-14-38-03.bag, it only contains imu data which published by gazebo libgazebo_ros_imu_sensor.so. cooked_rosbag_2021-11-18-14-38-03.bag is located in /home/jxl/jxl/allan_ws/. gazebo_husky.yaml is

imu_topic: "/imu/data"
imu_rate: 50
measure_rate: 50
sequence_time: 13050 #bag in seconds
rosrun allan_variance_ros cookbag.py  --input /home/jxl/2021-11-18-14-38-03.bag  --output  cooked_rosbag_2021-11-18-14-38-03.bag
rosrun allan_variance_ros allan_variance  /home/jxl/jxl/allan_ws/ /home/jxl/jxl/allan_ws/src/allan_variance_ros/config/gazebo_husky.yaml

When createing allan_variance.csv, it reminds me many imu msgs timestamp have somewrong, this is only part of the information output by the terminal.

[ERROR] [1637290175.093369303]: Skipped imu messages 614547
[ INFO] [1637290175.093390054]: 12291 / 13050 seconds loaded
[ERROR] [1637290175.093418470]: IMU message before last imu time. IMU time: 13077039999998 last imu time 93877317622759
[ERROR] [1637290175.093438070]: Skipped imu messages 614548
[ INFO] [1637290175.093457149]: 12291 / 13050 seconds loaded
[ERROR] [1637290175.093483640]: IMU message before last imu time. IMU time: 13077059999998 last imu time 93877317622759
[ERROR] [1637290175.093503903]: Skipped imu messages 614549
[ERROR] [1637290175.093530664]: IMU message before last imu time. IMU time: 13077079999998 last imu time 93877317622759
[ERROR] [1637290175.093551317]: Skipped imu messages 614550
[ INFO] [1637290175.093572197]: 12291 / 13050 seconds loaded
[ERROR] [1637290175.093600659]: IMU message before last imu time. IMU time: 13077099999998 last imu time 93877317622759

[ INFO] [1637290176.968499108]: Computed 0 averages for period 985.5
[ INFO] [1637290176.968519090]: Computed 0 averages for period 985.6
[ INFO] [1637290176.968539519]: Computed 0 averages for period 985.7
[ INFO] [1637290176.968559882]: Computed 0 averages for period 985.8
[ INFO] [1637290176.968580278]: Computed 0 averages for period 985.9
[ INFO] [1637290176.968600411]: Computed 0 averages for period 986
[ INFO] [1637290176.968620740]: Computed 0 averages for period 986.1
[ INFO] [1637290176.968641282]: Computed 0 averages for period 986.2
[ INFO] [1637290176.968661284]: Computed 0 averages for period 986.3
[ INFO] [1637290176.968681675]: Computed 0 averages for period 986.4
[ INFO] [1637290176.968701987]: Computed 0 averages for period 986.5
[ INFO] [1637290176.968721859]: Computed 0 averages for period 986.6
[ INFO] [1637290176.968742431]: Computed 0 averages for period 986.7
[ INFO] [1637290176.968763563]: Computed 0 averages for period 986.8
[ INFO] [1637290176.968783902]: Computed 0 averages for period 986.9
[ INFO] [1637290176.968804266]: Computed 0 averages for period 987
[ INFO] [1637290176.968824155]: Computed 0 averages for period 987.1
[ INFO] [1637290176.968844767]: Computed 0 averages for period 987.2
[ INFO] [1637290176.968865573]: Computed 0 averages for period 987.3

When i rosrun allan_variance_ros analysis.py --data /home/jxl/jxl/allan_ws/allan_variance.csv, program is terminated. Is there something i missing? Every imu msg has a timestamp, does it mean cookbag.py do nothing actually ? Thanks for any your suggestion and help.

➜  [/home/jxl/jxl/allan_ws] rosrun allan_variance_ros analysis.py --data  /home/jxl/allan_variance.csv 
/home/jxl/jxl/allan_ws/src/allan_variance_ros/scripts/analysis.py:25: RuntimeWarning: divide by zero encountered in log
  logy = np.log(y)
Traceback (most recent call last):
  File "/home/jxl/jxl/allan_ws/src/allan_variance_ros/scripts/analysis.py", line 84, in <module>
    accel_wn_intercept_x, xfit_wn = get_intercept(period[0:white_noise_break_point], acceleration[0:white_noise_break_point,0], -0.5, 1.0)
  File "/home/jxl/jxl/allan_ws/src/allan_variance_ros/scripts/analysis.py", line 26, in get_intercept
    coeffs, _ = curve_fit(line_func, logx, logy, bounds=([m, -np.inf], [m + 0.001, np.inf]))
  File "/home/jxl/.local/lib/python3.8/site-packages/scipy/optimize/minpack.py", line 735, in curve_fit
    ydata = np.asarray_chkfinite(ydata, float)
  File "/usr/lib/python3/dist-packages/numpy/lib/function_base.py", line 495, in asarray_chkfinite
    raise ValueError(
ValueError: array must not contain infs or NaNs
➜  [/home/jxl/jxl/allan_ws] 

This is csv file's part info.

0.5 -0 -0 -0 -0 -0 -0 
0.6000000238418579102 -0 -0 -0 -0 -0 -0 
0.6999999880790710449 -0 -0 -0 -0 -0 -0 
0.8000000119209289551 -0 -0 -0 -0 -0 -0 
0.8999999761581420898 -0 -0 -0 -0 -0 -0 
1 -0 -0 -0 -0 -0 -0 
1.10000002384185791 -0 -0 -0 -0 -0 -0 
1.20000004768371582 -0 -0 -0 -0 -0 -0 
1.29999995231628418 -0 -0 -0 -0 -0 -0 
1.39999997615814209 -0 -0 -0 -0 -0 -0 
1.5 -0 -0 -0 -0 -0 -0 

Realsense D435i IMU

Hi, I run the data Realsense D435i IMU,the result is not as same as yours,
acceleration
gyro

below is my configure,is any problem with it

imu_topic: "/camera/imu"
imu_rate: 500
measure_rate: 500 # Rate to which imu data is subsampled
sequence_time: 11392 # 3 hours in seconds

                                                                                                                                                                      Best regards!

About units of params Accel Random Walk and Rate Random Walk

Hi author,
Thanks for your sharing so convient tool to community very much.
In code we average three axis Accel Random Walk to get accelerometer_random_walk of kalibr. accelerometer_random_walk's unit is m/s^3/sqrt(HZ), namely m/s^2/sqrt(s), but the Accel Random Walk's unit is m/s^2, is there a typo ? The same question exist about Rate Random Walk. Velocity Random Walk and Angle Random Walk units are equal to accelerometer_noise_density and gyroscope_noise_densityof kalibr. Thanks for your help and time!

yaml_file.write("accelerometer_random_walk: " + repr(average_abi) + " \n")

The diagram does not match the result

Hello, in allan _ variance _ ros, why the data corresponding to the acceleration circle and the star can match the output result, while the data corresponding to the angular velocity circle and the star cannot match the output result, even several orders of magnitude worse.

My results:
acceleration

gyro

My results:
#Accelerometer
accelerometer_noise_density: 0.0008376248418885106
accelerometer_random_walk: 2.591042775935633e-05

#Gyroscope
gyroscope_noise_density: 1.0752236145252607e-05
gyroscope_random_walk: 6.9924971907009525e-09

rostopic: '/sensors/imu' #Make sure this is correct
update_rate: 400.0 #Make sure this is correct

ps:I modified the name and frequency of IMU topics in the yaml file, but obviously nothing changed in the results

Does the orientation of placement matter?

I would like to clarify this statement: "Place your IMU on some damped surface and record your IMU data to a rosbag", Is there any difference how I place the camera on the damped surface, I mean up side down or standing vertically or just laying horizontally?

Do I need to take into account how the axes are oriented like in the picture?

image

what should i do

terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
what(): boost::filesystem::directory_iterator::construct: No such file or directory: "/home/zdz/cookbag"

analysis.py code question, unused variable

In analysis.py, from lines 97-107, you calculate white_noise_break_point and use it as an index to limit the interval where the white noise fit is calculated on. You also calculate random_rate_breakpoint (shouldn't this be at a period of 10^3 = 300 instead of 10^1=10?), but it remains an unused variable, you do not use it for the random rate fit. Is that intended, and if so, why?

Code:

white_noise_break_point = np.where(period == 10)[0][0]
random_rate_break_point = np.where(period == 10)[0][0]

accel_wn_intercept_x, xfit_wn = get_intercept(period[0:white_noise_break_point], acceleration[0:white_noise_break_point,0], -0.5, 1.0)
accel_wn_intercept_y, yfit_wn = get_intercept(period[0:white_noise_break_point], acceleration[0:white_noise_break_point,1], -0.5, 1.0)
accel_wn_intercept_z, zfit_wn = get_intercept(period[0:white_noise_break_point], acceleration[0:white_noise_break_point,2], -0.5, 1.0)

accel_rr_intercept_x, xfit_rr = get_intercept(period, acceleration[:,0], 0.5, 3.0)
accel_rr_intercept_y, yfit_rr = get_intercept(period, acceleration[:,1], 0.5, 3.0)
accel_rr_intercept_z, zfit_rr = get_intercept(period, acceleration[:,2], 0.5, 3.0)

Unable to use allan_variance

I am following the instructions on how to use your system and I was able to output the information into a new bag using step 2. However, when I true to do step 3 I get the following error if I have roscore running

Error
ig-handle@ig-handle:~/catkin_ws/src/allan_variance_ros$ rosrun allan_variance_ros allan_variance /home/ig-handle/catkin_ws/src/ig_handle/scripts/cooked_rosbag.bag

/home/ig-handle/catkin_ws/src/ig_handle/scripts/allan_imu_config.yaml
[ INFO] [1674847354.590778010]: Bag Folder = /home/ig-handle/catkin_ws/src/ig_handle/scripts/cooked_rosbag.bag

[ INFO] [1674847354.591459928]: Config File = /home/ig-handle/catkin_ws/src/ig_handle/scripts/allan_imu_config.yaml

terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
what(): boost::filesystem::directory_iterator::construct: Not a directory: "/home/ig-handle/catkin_ws/src/ig_handle/scripts/cooked_rosbag.bag"

Aborted (core dumped)

If i do not have roscore running then I get the following error

Error

[ERROR] [1674847344.161721965]: [registerPublisher] Failed to contact master at [localhost:11311]. Retrying...

Now in both instances I know the file exists because i see in the directory and when I press tab it selects the file in the terminal. Do you know how to fix this problem

How long should this take to run?

Not complaining - trying to plan - but approx. how long should the allan_variance computation process take for say ~3hr long data?

I have a rosbag ~3hrs (11214s) long being processed.
The message Computed X averages for period Y is progressing through 1-unit of "period" every ~3.5s real-time.
If I take "period" to mean the seconds in the rosbag it looks like my computer will take >10hrs to process... Is just how it is or am I missing something?

Obviously this is dependant on my hardware. I'm on a Ryzen 3600X based machine 16GB if that helps.

Understanding IMU Calibration and Allan Variance calculation

I was referring to calculation of gyro and accel white noise and random walk using the video Visual-Inertial Sensor Calibration - A Complete Tutorial and Discussion for my Intel Realsense. I have following doubts:

  1. At timestamp 25:48, video says, typically we dont use values generated by Allan Variance ROS directly and we inflate them by order of 10 times, may be by 20. Why is it so?
  2. I read we can obtain Angle Random Walk, Bias Instability, and Rate Random Walk from Allan Variance plot by reading Allan Variance value at T=1, Slope=0, T=3 respectively. Why exactly Angle Random Walk is read at T=1 and Rate Random Walk at T=3 and not at some other values? Is it that these types of noise are "empirically observed" to most dominant in Allan Variance plot at these cluster interval values?
  3. How often and when we have to calibrate IMU and calculate gyro and accel white noise and random walk (if we are flying drone in different temperature environment)? Do we have to calculate gyro and accel white noise and random walk every time we calibrate the IMU?

Simulation Accuracy

I am getting the following on the example simulation:

#Accelerometer
accelerometer_noise_density: 0.0025019929573561175 #true
accelerometer_noise_density: 0.0017989768146338795 

accelerometer_random_walk: 6.972435158192731e-05 #true
accelerometer_random_walk: 5.073249247970349e-05 

#Gyroscope
gyroscope_noise_density: 0.0001888339269965301  #true
gyroscope_noise_density: 0.00013494835013762752 

gyroscope_random_walk: 2.5565313322052523e-06 #true
gyroscope_random_walk: 2.324462789522549e-06 

rostopic: '/sensors/imu' 
update_rate: 400 

The accelerometer_noise_density seems to be almost half what it should be here.
acceleration

Here is the script I am using to generate this result: simulate_imu.sh.txt

path_to_config_file help

Hi,

thanks for sharing your work. I'd really like to use this toolset but I'm not familiar with ROS - can you
help me with the "path_to_config_file" arg mentioned in the following line from your instructions?

rosrun allan_variance_ros allan_variance [path_to_rosbags] [path_to_config_file]

Thanks!

Earth rotation

Question:
is earth's angular velocity (0.004°/s) considered somehow?
Because after 3 hours measurement, this would add up to 45° in total.

about analysis.py

I have a problem.

I ran the analysis.py

but the biases about accelerometer and gyroscope x,y, and z have nan value.

What should I do???

results
.
.
acceleration
.
.
gyro
.
.
.
.
.
.
And I modified the code in analysis.py

logx = np.log(x) and logy = np.log(y) ----> add logx = np.nan_to_num(logx) and logy = np.nan_to_num(logy)

coeffs, _ = curve_fit(line_func, logx, logy, bounds=~~~~~~ ----> coeffs, _ = curve_fit(line_func, logx, logy)

.bag format

hi,

I want to find values of my own IMU data and i need to know
1- what is the format needed to make a .bag file that can be used by the tool.
2- how to convert my own file into bag format suggestions.

Thanks

Only getting Accelerometer data not gyroscope

Hello
I am using this package to generate config file for the kalibr imu-camera calibration.
But when I run the package
rosrun allan_variance_ros allan_variance bags imu.config

and when I analyze the .csv file with
rosrun allan_variance_ros analysis.py --data allan_variance.csv

It only shows the Accelerometer values.
ACCELEROMETER:
X Velocity Random Walk: 0.00214 m/s/sqrt(s) 0.12869 m/s/sqrt(hr)
Y Velocity Random Walk: 0.00285 m/s/sqrt(s) 0.17109 m/s/sqrt(hr)
Z Velocity Random Walk: 0.00211 m/s/sqrt(s) 0.12644 m/s/sqrt(hr)
X Bias Instability: 0.00090 m/s^2 11706.92482 m/hr^2
Y Bias Instability: 0.00117 m/s^2 15211.83888 m/hr^2
Z Bias Instability: 0.00059 m/s^2 7607.42798 m/hr^2
X Accel Random Walk: 0.00058 m/s^2/sqrt(s)
Y Accel Random Walk: 0.00076 m/s^2/sqrt(s)
Z Accel Random Walk: 0.00039 m/s^2/sqrt(s)

What could be the problem ?

Getting ValueError: array must not contain infs or NaNs while running analysis.py

I am trying to calculate accel and gyro noise and random walk for Intel realsense. I quickly generated imu csv in the format specified here using custom CPP script for just 3 seconds. I wanted to check if it will work or not before recording 20 hours of IMU data.

I created ros bag from csv by running:

rosrun kalibr kalibr_bagcreater --folder ./data/imu_data --output-bag ./data/newbag.bag

Checking the bag created:

root@e9408da6622e:/data# rosbag info /data/data/newbag.bag  
path:        /data/data/newbag.bag 
version:     2.0 
duration:    2.4s 
start:       Dec 30 2023 18:41:25.42 (1703961685.42) 
end:         Dec 30 2023 18:41:27.84 (1703961687.84) 
size:        312.7 KB 
messages:    830 
compression: none [1/1 chunks] 
types:       sensor_msgs/Imu [6a62c6daae103f4ff57a132d6f95cec2] 
topics:      /imu0   830 msgs    : sensor_msgs/Imu 

Then I converted it to allan variance compliant bag by running:

rosrun allan_variance_ros cookbag.py --input /data/data/imu_data/newbag.bag --output /data/data/imu_data/cooked_bag.bag 

Checking the bag created:

root@e9408da6622e:/catkin_ws# rosbag info /data/data/imu_data/cooked_bag.bag  
path:         /data/data/imu_data/cooked_bag.bag 
version:      2.0 
duration:     2.4s 
start:        Dec 30 2023 18:41:25.42 (1703961685.42) 
end:          Dec 30 2023 18:41:27.84 (1703961687.84) 
size:         41.7 KB 
messages:     830 
compression:  lz4 [1/1 chunks; 8.47%] 
uncompressed: 296.1 KB @ 122.5 KB/s 
compressed:    25.1 KB @  10.4 KB/s (8.47%) 
types:        sensor_msgs/Imu [6a62c6daae103f4ff57a132d6f95cec2] 
topics:       /imu0   830 msgs    : sensor_msgs/Imu

I created allan variance config file imu_confog.yaml:

imu_topic: "/imu0"
imu_rate: 346
measure_rate: 346 # since bag contains 830 messages / 2.4 seconds = 345.8333 approx 346
sequence_time: 3 # since bag contains 2.4 seconds worth of data

(I also tried with both rates 400, no luck.)

Here is how my data folder looks like:

image

Then I run allan variance:

root@e9408da6622e:/catkin_ws# rosrun allan_variance_ros allan_variance /data/data/imu_data /data/data/allan_variance/imu_config.yaml

And finally run Analyse.py:

root@e9408da6622e:/catkin_ws# rosrun allan_variance_ros analysis.py --data /data/data/imu_data/allan_variance.csv --config /data/data/allan_variance/imu_config.yaml
/catkin_ws/src/allan_variance_ros/scripts/analysis.py:23: RuntimeWarning: divide by zero encountered in log
  logy = np.log(y)
Traceback (most recent call last):
  File "/catkin_ws/src/allan_variance_ros/scripts/analysis.py", line 101, in <module>
    accel_wn_intercept_x, xfit_wn = get_intercept(period[0:white_noise_break_point], acceleration[0:white_noise_break_point,0], -0.5, 1.0)
  File "/catkin_ws/src/allan_variance_ros/scripts/analysis.py", line 24, in get_intercept
    coeffs, _ = curve_fit(line_func, logx, logy, bounds=([m, -np.inf], [m + 0.001, np.inf]))
  File "/usr/lib/python3/dist-packages/scipy/optimize/minpack.py", line 708, in curve_fit
    ydata = np.asarray_chkfinite(ydata, float)
  File "/usr/lib/python3/dist-packages/numpy/lib/function_base.py", line 495, in asarray_chkfinite
    raise ValueError(
ValueError: array must not contain infs or NaNs

But as you can see it is giving error array must not contain infs or NaNs. Turns out there are some NaNs in allan_variance.csv file generated. What I am doing wrong here?

I have uploaded all bags and csv file on drive here.

Solutions for errors i face while i tried to install the package

Today i tried to install the allan_variance_ros and i face a lot os issues.

1st error
User geo@geo:~/allan_ws$ rosrun allan_variance_ros cookbag.py --input /home/geo/allan_ws/original.bag --output /home/geo/allan_ws/cooked.bag Traceback (most recent call last): File "/home/geo/allan_ws/src/allan_variance_ros/scripts/cookbag.py", line 4, in <module> import rosbag File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 33, in <module> from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedException File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 56, in <module> import gnupg ModuleNotFoundError: No module named 'gnupg'

Solution

pip install python-gnupg
pip install python

even if iinstall them still had the same error so i installed for python3 even if i am using 2.7 and the error has gone.
pip3 install python-gnupg

2nd error
geo@geo:~/allan_ws$ rosrun allan_variance_ros cookbag.py --input /home/geo/allan_ws/original.bag --output /home/geo/allan_ws/cooked.bag Traceback (most recent call last): File "/home/geo/allan_ws/src/allan_variance_ros/scripts/cookbag.py", line 4, in <module> import rosbag File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 33, in <module> from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedException File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 68, in <module> import roslib.names # still needed for roslib.names.canonicalize_name() File "/opt/ros/melodic/lib/python2.7/dist-packages/roslib/__init__.py", line 50, in <module> from roslib.launcher import load_manifest # noqa: F401 File "/opt/ros/melodic/lib/python2.7/dist-packages/roslib/launcher.py", line 42, in <module> import rospkg ModuleNotFoundError: No module named 'rospkg'

Solution
again i tried first pip install -U rospkg
but the real solution was pip3 install -U rospkg

3rd error

geo@geo:~/allan_ws$ rosrun allan_variance_ros cookbag.py --input /home/geo/allan_ws/original.bag --output /home/geo/allan_ws/cooked.bag Failed to load Python extension for LZ4 support. LZ4 compression will not be available. Traceback (most recent call last): File "/home/geo/allan_ws/src/allan_variance_ros/scripts/cookbag.py", line 14, in <module> with rosbag.Bag(args.output, 'w', compression='lz4') as outbag: File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 445, in __init__ raise ValueError('compression must be one of: %s' % ', '.join(allowed_compressions)) ValueError: compression must be one of: none, bz2

Solution

Firsty i check if i had the library pip install lz4
but then i notice that in python2.7 there is no lz4 compression method so i use bz2, you can use none too but my bag was too large.

`#!/usr/bin/env python3

import rosbag
import argparse

parser = argparse.ArgumentParser()

parser.add_argument("--input", type=str, default=None)
parser.add_argument("--output", type=str, default=None)

args = parser.parse_args()

with rosbag.Bag(args.output, 'w', compression='lz4') as outbag:
    for topic, msg, t in rosbag.Bag(args.input).read_messages():
        # This also replaces tf timestamps under the assumption 
        # that all transforms in the message share the same timestamp
        if topic == "/tf" and msg.transforms:
            outbag.write(topic, msg, msg.transforms[0].header.stamp)
        else:
            outbag.write(topic, msg, msg.header.stamp if msg._has_header else t)`

If you fix this error and the 1st step is running you will notice that in terminal you will have a message like this

User geo@geo:~/allan_ws$ rosrun allan_variance_ros cookbag.py --input /home/geo/allan_ws/original.bag --output /home/geo/allan_ws/cooked.bag Failed to load Python extension for LZ4 support. LZ4 compression will not be available.
the cooked.bag file will be 90 bytes but it needs time to become larger so be patient.

4th error
Finally, my last issue was

geo@geo:~/allan_ws$ rosrun allan_variance_ros allan_variance /home/geo/allan_ws/cooked.bag /home/geo/allan_ws/src/allan_variance_ros/config/xsens.yaml [ INFO] [1693519129.931957167]: Bag Folder = /home/geo/allan_ws/cooked.bag [ INFO] [1693519129.932655760]: Config File = /home/geo/allan_ws/src/allan_variance_ros/config/xsens.yaml terminate called after throwing an instance of 'boost::filesystem::filesystem_error' what(): boost::filesystem::directory_iterator::construct: Not a directory: "/home/geo/allan_ws/cooked.bag" Aborted (core dumped)

Solution

i change some lines in /home/geo/allan_ws/src/allan_variance_ros/src/allan_variance.cpp

copy and paste it to your cpp

new_allan_cpp.txt

SOS

dont forget to catkin_build again before run the command.

I hope to help you.

results interpret

hi!
i got calibration papers:
acceleration
gyro

this is cheap mpu-650 (GY-521).
how to understand is it good or not ?
what "stars", "circles", "triangles" mean ?

Units from my IMU

Hi,

I record a video and extract IMU metadata like shown below. I need to know the units so i can easily use your tool. Please help !!

"Doc1961:Accelerometer": {
"id": "Accelerometer",
"table": "QuickTime::Stream",
"val": "0.97705078125 -0.775634765625 -0.63134765625"
},
"Doc1961:AngularVelocity": {
"id": "AngularVelocity",
"table": "QuickTime::Stream",
"val": "-0.711596667766571 -0.207726567983627 -0.145941227674484"

ValueError with cookbag.py and analysis.py

  • Hi, I've recorded IMU data (all topics) with SBG Ellipse. When I turn on cookbag. py, I get this error:
> magda@magda-VirtualBox:~$ cd catkin_ws
> magda@magda-VirtualBox:~/catkin_ws$ source devel/setup.bash
> magda@magda-VirtualBox:~/catkin_ws$ rosrun allan_variance_ros cookbag.py --input /home/magda/catkin_ws/src/allan_variance_ros/2022-08-12-12-14-04.bag --output cooked_rosbag
> Failed to load Python extension for LZ4 support. LZ4 compression will not be available.
> Traceback (most recent call last):
>   File "/home/magda/catkin_ws/src/allan_variance_ros/scripts/cookbag.py", line 14, in <module>
>     with rosbag.Bag(args.output, 'w', compression='lz4') as outbag:
>   File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 445, in __init__
>     raise ValueError('compression must be one of: %s' % ', '.join(allowed_compressions))  
> **ValueError: compression must be one of: none, bz2**
  • But then I run normally

> rosrun allan_variance_ros allan_variance /home/magda/catkin_ws/src/allan_variance_ros/ /home/magda/catkin_ws/src/allan_variance_ros/config/ellipse.yaml

  • this works great and I get allan_variance.csv. Unfortunatelly the next step doesn't work again. I see this error:
> magda@magda-VirtualBox:~/catkin_ws$ rosrun allan_variance_ros analysis.py --data /home/magda/catkin_ws/src/allan_variance_ros/allan_variance.csv
> 
> /home/magda/catkin_ws/src/allan_variance_ros/scripts/analysis.py:23: RuntimeWarning: divide by zero encountered in log
>   logy = np.log(y)
> Traceback (most recent call last):
>   File "/home/magda/catkin_ws/src/allan_variance_ros/scripts/analysis.py", line 101, in <module>
>     accel_wn_intercept_x, xfit_wn = get_intercept(period[0:white_noise_break_point], acceleration[0:white_noise_break_point,0], -0.5, 1.0)
>   File "/home/magda/catkin_ws/src/allan_variance_ros/scripts/analysis.py", line 24, in get_intercept
>     coeffs, _ = curve_fit(line_func, logx, logy, bounds=([m, -np.inf], [m + 0.001, np.inf]))
>   File "/home/magda/.local/lib/python3.6/site-packages/scipy/optimize/minpack.py", line 734, in curve_fit
>     ydata = np.asarray_chkfinite(ydata, float)
>   File "/home/magda/.local/lib/python3.6/site-packages/numpy/lib/function_base.py", line 486, in asarray_chkfinite
>     "array must not contain infs or NaNs")
> **ValueError: array must not contain infs or NaNs**
  • Additionally I have created a launch file in which I show IMU topic and frequency. In this topic IMU status, sensors values and computed orientation using Quaternion are listed.

Do you know where is the problem?
Thank you very much for the answer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.