rpng / open_vins

An open source platform for visual-inertial navigation research.
https://docs.openvins.com
GNU General Public License v3.0
2.13k stars 630 forks source link

ov_eval pid_ros recording use error #212

Closed zhhz9706 closed 2 years ago

zhhz9706 commented 2 years ago

Hello, I cannot use the oc_eval module to evaluate the running time of the algorithm. The following questions will be prompted。

$ rosrun ov_eval timing_flamegraph ~/vins_output/euroc/traj_timing.txt 
Setting printing level to: INFO
[TIME]: loaded 189 timestamps from file (0 categories)!!
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
[1]    16210 abort (core dumped)  rosrun ov_eval timing_flamegraph ~/vins_output/euroc/traj_timing.txt

The saved file is as follows

# timestamp(s) summed_cpu_perc summed_mem_perc summed_threads /run_subscribe_msckf_cpu_perc /run_subscribe_msckf_mem_perc /run_subscribe_msckf_threads
1639818643.91219592 0.000 0.430 20 0.000 0.430 20
1639818644.91242695 19.100 1.240 42 19.100 1.240 42
1639818645.91208792 87.600 1.457 42 87.600 1.457 42
1639818646.91155910 81.600 1.499 42 81.600 1.499 42
1639818647.91254997 86.600 1.515 42 86.600 1.515 42
1639818648.90924001 64.500 1.533 42 64.500 1.533 42
1639818649.90958309 68.100 1.554 42 68.100 1.554 42
1639818650.91252494 73.200 1.573 42 73.200 1.573 42
1639818651.91258097 72.500 1.607 42 72.500 1.607 42
1639818652.90929389 36.300 1.607 42 36.300 1.607 42

The ov_eval part of the launch file is as follows

<node name="recorder_timing" pkg="ov_eval" type="pid_ros.py" output="screen">
        <param name="nodes"   type="str" value="/run_subscribe_msckf" />
        <param name="output"  type="str" value="/home/cyber/vins_output/euroc/traj_timing.txt" />
    </node>

Looking forward to your reply, thank you

goldbattle commented 2 years ago

You should use the percentage script for the pid_ros, as it records the percent CPU / MEM usage as compared to actual times. rosrun ov_eval timing_percentages psutil_logs/ https://docs.openvins.com/eval-timing.html#eval-ov-timing-percentages

For the flamegraph, it should be comma separated. This is saved if you enable timing recordings in the config / launch file. https://github.com/rpng/open_vins/blob/d7f4f7515deed83ce7e788029a3c61ecc6cfa921/ov_msckf/launch/subscribe.launch#L39-L41