### Build and Run ROS 1 Example Simulation in Docker Source: https://github.com/rpng/open_vins/blob/master/docs/dev-docker.dox Inside the Docker bash shell, navigate to the workspace, build the project, source the setup, and run an example simulation. This assumes a ROS 1 environment. ```shell cd catkin_ws catkin build source devel/setup.bash rosrun ov_eval plot_trajectories none src/open_vins/ov_data/sim/udel_gore.txt roslaunch ov_msckf simulation.launch ``` -------------------------------- ### Install Valgrind and Run Profiling Source: https://github.com/rpng/open_vins/blob/master/docs/dev-profiling.dox Install Valgrind and then run a ROS node with callgrind profiling enabled. This is useful for analyzing the call stack of your application. ```shell sudo apt install valgrind roslaunch ov_msckf pgeneva_serial_eth.launch ``` -------------------------------- ### Install Docker on Ubuntu Source: https://github.com/rpng/open_vins/blob/master/docs/dev-docker.dox Installs Docker CE, CLI, and containerd.io on Ubuntu systems. Ensure you have `lsb_release` available. ```shell curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io ``` -------------------------------- ### Install ROS2 bag2 plugins Source: https://github.com/rpng/open_vins/blob/master/docs/dev-ros1-to-ros2.dox Install the necessary ROS2 bag2 plugins for bag conversion. This requires both ROS1 and ROS2 to be installed and sourced. ```shell sudo apt-get install ros-$ROS2_DISTRO-ros2bag ros-$ROS2_DISTRO-rosbag2* sudo apt install ros-$ROS2_DISTRO-rosbag2-bag-v2-plugins ``` -------------------------------- ### Build and Run ROS 2 Example Simulation in Docker Source: https://github.com/rpng/open_vins/blob/master/docs/dev-docker.dox Inside the Docker bash shell, build and run a simulation using ROS 2 tools. This involves 'colcon build' and sourcing the install space. ```shell cd catkin_ws colcon build --event-handlers console_cohesion+ source install/setup.bash ros2 run ov_eval plot_trajectories none src/open_vins/ov_data/sim/udel_gore.txt ros2 run ov_msckf run_simulation src/open_vins/config/rpng_sim/estimator_config.yaml ``` -------------------------------- ### Install Visualization Tools and Process Profiling Data Source: https://github.com/rpng/open_vins/blob/master/docs/dev-profiling.dox Install necessary Python and Graphviz packages, then use gprof2dot to convert Valgrind's callgrind output to an xdot file, and finally visualize it with xdot. ```shell // install viz programs apt-get install python3 graphviz apt-get install gir1.2-gtk-3.0 python3-gi python3-gi-cairo graphviz pip install gprof2dot xdot // actually process and then viz call file gprof2dot --format callgrind --strip /tmp/callgrind.txt --output /tmp/callgrind.xdot xdot /tmp/callgrind.xdot ``` -------------------------------- ### YAML Configuration Example for OpenVINS Source: https://context7.com/rpng/open_vins/llms.txt Example of a YAML configuration file for OpenVINS. This file specifies parameters such as verbosity level, feature estimation method, integration type, and camera configuration. ```yaml # config/euroc_mav/estimator_config.yaml (key options shown) verbosity: "INFO" # ALL | DEBUG | INFO | WARNING | ERROR | SILENT use_fej: true # First-Estimate Jacobians for filter consistency integration: "rk4" # discrete | rk4 | analytical use_stereo: true max_cameras: 2 # 1=mono, 2=stereo, >2=binocular ``` -------------------------------- ### Install NVIDIA Container Toolkit Source: https://github.com/rpng/open_vins/blob/master/docs/dev-docker.dox Installs nvidia-docker2 to enable Docker containers to utilize NVIDIA GPUs. Restarts the Docker service after installation. ```shell distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \ && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update sudo apt-get install -y nvidia-docker2 sudo systemctl restart docker ``` -------------------------------- ### Install Latest Clang and Set Environment Variables Source: https://github.com/rpng/open_vins/blob/master/docs/dev-profiling.dox Install the latest Clang compiler using an auto-install script and set the CC and CXX environment variables to use Clang 11 for compilation. ```shell sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" export CC=/usr/bin/clang-11 export CXX=/usr/bin/clang++-11 ``` -------------------------------- ### Build and Install OpenVINS (ROS-Free) Source: https://github.com/rpng/open_vins/blob/master/docs/gs-installing-free.dox Clones the OpenVINS repository, navigates to the msckf module, and builds it using CMake with ROS disabled. This process includes compilation and installation of the library. ```shell cd ~/github/ git clone https://github.com/rpng/open_vins/ cd open_vins/ov_msckf/ mkdir build && cd build cmake -DENABLE_ROS=OFF .. make -j4 sudo make install ``` -------------------------------- ### Install System Dependencies (Ubuntu) Source: https://github.com/rpng/open_vins/blob/master/docs/gs-installing-free.dox Installs essential libraries required for a ROS-free build on Ubuntu systems. Ensure you have OpenCV 3 or 4, Eigen3, and Ceres installed. ```shell sudo apt-get install libeigen3-dev libboost-all-dev libceres-dev ``` -------------------------------- ### Setup OpenVINS Launch Nodes Source: https://github.com/rpng/open_vins/blob/master/docs/gs-tutorial.dox Sets up the OpenVINS nodes based on the provided launch configuration. It checks for the availability of the specified configuration and defines the ROS2 node with its parameters. ```python def launch_setup(context): configs_dir=os.path.join(get_package_share_directory('ov_msckf'),'config') available_configs = os.listdir(configs_dir) config = LaunchConfiguration('config').perform(context) if not config in available_configs: return[LogInfo(msg='ERROR: unknown config: \'{}\' - Available configs are: {} - not starting OpenVINS'.format(config,', '.join(available_configs)))] config_path = os.path.join(get_package_share_directory('ov_msckf'),'config',config,'estimator_config.yaml') node1 = Node(package = 'ov_msckf', executable = 'run_subscribe_msckf', namespace = LaunchConfiguration('namespace'), parameters =[{'verbosity': LaunchConfiguration('verbosity')}, {'use_stereo': LaunchConfiguration('use_stereo')}, {'max_cameras': LaunchConfiguration('max_cameras')}, {'config_path': config_path}]) return [node1] ``` -------------------------------- ### Build and Install Ceres Solver from Source Source: https://github.com/rpng/open_vins/blob/master/docs/gs-installing.dox Clones the Ceres Solver repository, checks out a specific version, builds it using CMake and Make, and installs it system-wide. This method is useful if system packages are outdated or unavailable. ```shell CERES_VERSION="2.0.0" git clone https://ceres-solver.googlesource.com/ceres-solver cd ceres-solver git checkout tags/${CERES_VERSION} mkdir build && cd build cmake .. make sudo make install ``` -------------------------------- ### Install ROS2 Galactic Desktop Source: https://github.com/rpng/open_vins/blob/master/docs/gs-installing.dox Installs the ROS2 Galactic distribution, including the desktop environment. This is for Ubuntu 20.04 systems. It also installs rosbag utilities. ```shell sudo apt update && sudo apt install curl gnupg lsb-release sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null sudo apt-get update export ROS2_DISTRO=galactic # dashing=18.04, galactic=20.04 sudo apt install ros-$ROS2_DISTRO-desktop sudo apt-get install ros-$ROS2_DISTRO-ros2bag ros-$ROS2_DISTRO-rosbag2* # rosbag utilities (seems to be separate) sudo apt-get install libeigen3-dev libboost-all-dev libceres-dev ``` -------------------------------- ### Flame Graph Example Output (Shell) Source: https://github.com/rpng/open_vins/blob/master/docs/eval-timing.dox Example output from the timing_flamegraph script, showing statistical summaries (mean, std, 99th percentile, max) for different system components. ```shell [TIME]: loaded 2817 timestamps from file (7 categories)!! mean_time = 0.0037 | std = 0.0011 | 99th = 0.0063 | max = 0.0254 (tracking) mean_time = 0.0004 | std = 0.0001 | 99th = 0.0006 | max = 0.0014 ( propagation) mean_time = 0.0032 | std = 0.0022 | 99th = 0.0083 | max = 0.0309 (msckf update) mean_time = 0.0034 | std = 0.0013 | 99th = 0.0063 | max = 0.0099 (slam update) mean_time = 0.0012 | std = 0.0017 | 99th = 0.0052 | max = 0.0141 (slam delayed) mean_time = 0.0009 | std = 0.0003 | 99th = 0.0015 | max = 0.0027 (marginalization) mean_time = 0.0128 | std = 0.0035 | 99th = 0.0208 | max = 0.0403 (total) ``` -------------------------------- ### Verify NVIDIA Container Toolkit Installation Source: https://github.com/rpng/open_vins/blob/master/docs/dev-docker.dox Runs a CUDA base image container to verify that GPU access is correctly configured. ```shell sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi ``` -------------------------------- ### Example Folder Structure for Trajectories Source: https://github.com/rpng/open_vins/blob/master/docs/eval-error.dox This illustrates the assumed folder structure for storing trajectories, separating groundtruth files from algorithm-generated runs organized by dataset. ```txt truth/ dateset_name_1.txt dateset_name_2.txt algorithms/ open_vins/ dataset_name_1/ run1.txt run2.txt run3.txt dataset_name_2/ run1.txt run2.txt run3.txt okvis_stereo/ dataset_name_1/ run1.txt run2.txt run3.txt dataset_name_2/ run1.txt run2.txt run3.txt vins_mono/ dataset_name_1/ run1.txt run2.txt run3.txt dataset_name_2/ run1.txt run2.txt run3.txt ``` -------------------------------- ### Install ROS1 Noetic Desktop Full Source: https://github.com/rpng/open_vins/blob/master/docs/gs-installing.dox Installs the ROS1 Noetic distribution with the full desktop environment. This includes all necessary packages for a complete ROS1 experience. Ensure your system is Ubuntu 20.04 for Noetic. ```shell sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 sudo apt-get update export ROS1_DISTRO=noetic # kinetic=16.04, melodic=18.04, noetic=20.04 sudo apt-get install ros-$ROS1_DISTRO-desktop-full sudo apt-get install python-catkin-tools # ubuntu 16.04, 18.04 sudo apt-get install python3-catkin-tools python3-osrf-pycommon # ubuntu 20.04 sudo apt-get install libeigen3-dev libboost-all-dev libceres-dev ``` -------------------------------- ### Configure ROS1 Environment Aliases Source: https://github.com/rpng/open_vins/blob/master/docs/gs-installing.dox Sets up aliases for sourcing ROS1 and workspace setup files in bashrc. Run 'ros2_source' to load ROS1 variables and 'source_install' to load workspace variables. ```shell echo "alias ros2_source=\"source /opt/ros/$ROS2_DISTRO/setup.bash\"" >> ~/.bashrc echo "alias source_install=\"source install/setup.bash\"" >> ~/.bashrc source ~/.bashrc ``` -------------------------------- ### Build ROS Package with Time Trace Enabled Source: https://github.com/rpng/open_vins/blob/master/docs/dev-profiling.dox Clean the catkin build environment, start the ClangBuildAnalyzer profiler, build the ROS package with the -ftime-trace flag, and then stop and analyze the profiling data. ```shell (WS) cd ~/workspace/ (WS) catkin clean -y && mkdir build (CBA) ./ClangBuildAnalyzer --start ~/workspace/build/ (WS) export CC=/usr/bin/clang-11 && export CXX=/usr/bin/clang++-11 (WS) catkin build ov_msckf -DCMAKE_CXX_FLAGS="-ftime-trace" (CBA) ./ClangBuildAnalyzer --stop ~/workspace/build/ capture_file.bin (CBA) ./ClangBuildAnalyzer --analyze capture_file.bin > timing_results.txt ``` -------------------------------- ### Build OpenCV from Source Source: https://github.com/rpng/open_vins/blob/master/docs/gs-installing.dox Clones OpenCV and opencv_contrib, then builds and installs OpenCV from source. This is a fallback if ROS-provided OpenCV or cv_bridge causes issues. ```shell git clone https://github.com/opencv/opencv/ git clone https://github.com/opencv/opencv_contrib/ mkdir opencv/build/ cd opencv/build/ cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules .. make -j8 sudo make install ``` -------------------------------- ### ClangBuildAnalyzer Timing Results Source: https://github.com/rpng/open_vins/blob/master/docs/dev-profiling.dox Example output from ClangBuildAnalyzer's timing_results.txt file, detailing compilation times, file parsing durations, function compilation costs, and expensive header inclusions. ```text Analyzing build trace from 'capture_file.bin'... **** Time summary: Compilation (86 times): Parsing (frontend): 313.9 s Codegen & opts (backend): 222.9 s **** Files that took longest to parse (compiler frontend): 13139 ms: /build//ov_msckf/CMakeFiles/ov_msckf_lib.dir/src/update/UpdaterSLAM.cpp.o 12843 ms: /build//ov_msckf/CMakeFiles/run_serial_msckf.dir/src/ros_serial_msckf.cpp.o ... **** Functions that took longest to compile: 1639 ms: main (/src/open_vins/ov_eval/src/error_comparison.cpp) 1337 ms: ov_core::BsplineSE3::get_acceleration(double, Eigen::Matrix> ~/.bashrc echo "alias source_devel=\"source devel/setup.bash\"" >> ~/.bashrc source ~/.bashrc ``` -------------------------------- ### ROS 1 Launch and Execution Commands Source: https://github.com/rpng/open_vins/blob/master/docs/gs-tutorial.dox Commands to launch the OpenVINS system in ROS 1. This includes starting the roscore, sourcing the environment, launching the estimator node with a specific configuration, and running RVIZ and rosbag play in separate terminals. ```shell roscore # term 0 source devel/setup.bash # term 1 roslaunch ov_msckf subscribe.launch config:=euroc_mav ``` ```shell rviz -d ov_msckf/launch/display.rviz # term 2 rosbag play V1_01_easy.bag # term 3 ``` -------------------------------- ### Launch ROS Docker Container with Bash Source: https://github.com/rpng/open_vins/blob/master/docs/dev-docker.dox Starts a ROS container and drops you into a bash shell inside it, allowing manual command execution. Useful for launching tools like rviz. ```shell docker run -it --net=host --gpus all \ --env="NVIDIA_DRIVER_CAPABILITIES=all" \ --env="DISPLAY" \ --env="QT_X11_NO_MITSHM=1" \ --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ osrf/ros:noetic-desktop-full \ bash ``` -------------------------------- ### Build and Run OpenVINS with ROS 1 Source: https://context7.com/rpng/open_vins/llms.txt Instructions for building the `ov_msckf` ROS 1 package in a catkin workspace and launching the `subscribe_msckf` node for processing datasets like EuRoC MAV and TUM-VI. Includes options for serial playback and simulation runs. ```bash # ── Build (ROS 1 catkin workspace) ─────────────────────────────────────────── cd ~/catkin_ws/src git clone https://github.com/rpng/open_vins cd ../ catkin build ov_msckf source devel/setup.bash # ── Run on EuRoC MAV dataset (ROS 1) ───────────────────────────────────────── roslaunch ov_msckf subscribe.launch \ config:=euroc_mav \ dataset:=V1_01_easy \ dobag:=true \ bag:=/data/euroc/V1_01_easy.bag \ bag_start:=0 \ dosave:=true \ path_est:=/tmp/traj_estimate.txt # ── Run on TUM-VI dataset ───────────────────────────────────────────────────── roslaunch ov_msckf subscribe.launch \ config:=tum_vi \ dataset:=dataset-room1_512_16 \ dobag:=true \ bag:=/data/tumvi/dataset-room1_512_16.bag # ── Serial (ROS-bag playback without ROS, ROS 1 only) ──────────────────────── roslaunch ov_msckf serial.launch \ config:=euroc_mav \ bag:=/data/euroc/V1_01_easy.bag # ── Simulation run ──────────────────────────────────────────────────────────── roslaunch ov_msckf simulation.launch \ config:=rpng_sim ``` -------------------------------- ### ROS launch file key parameters Source: https://context7.com/rpng/open_vins/llms.txt Key parameters for `subscribe.launch` that can be overridden on the command line. ```xml ``` -------------------------------- ### Install Ceres Solver Dependencies Source: https://github.com/rpng/open_vins/blob/master/docs/gs-installing.dox Installs necessary development libraries for Ceres Solver on Debian/Ubuntu-based systems. This is a prerequisite for building Ceres from source. ```shell sudo apt-get install -y cmake libgoogle-glog-dev libgflags-dev libatlas-base-dev libeigen3-dev libsuitesparse-dev ``` -------------------------------- ### Initialize and Use TrackKLT Tracker Source: https://context7.com/rpng/open_vins/llms.txt Set up camera calibration, construct a KLT tracker, feed stereo frames, and retrieve feature data. Visualization functions are also included. ```cpp #include "track/TrackKLT.h" #include "track/TrackDescriptor.h" #include "cam/CamRadtan.h" #include "cam/CamEqui.h" // ── Set up camera calibration objects ──────────────────────────────────────── // [fx, fy, cx, cy, k1, k2, k3, k4] Eigen::VectorXd cam_calib(8); cam_calib << 458.654, 457.296, 367.215, 248.375, -0.28340, 0.07395, 0.0, 0.0; auto cam0 = std::make_shared(752, 480); cam0->set_value(cam_calib); std::unordered_map> camera_calib; camera_calib[0] = cam0; camera_calib[1] = cam0; // same model for cam1 // ── Construct a KLT tracker ────────────────────────────────────────────────── int num_features = 200; int num_aruco = 1024; // max aruco id (features start above this) bool use_stereo = true; auto tracker = std::make_shared( camera_calib, num_features, num_aruco, use_stereo, TrackBase::HistogramMethod::HISTOGRAM); // ── Feed a new stereo frame ─────────────────────────────────────────────────── CameraData msg; msg.timestamp = 1.6034e9; msg.sensor_ids = {0, 1}; msg.images = {left_img, right_img}; msg.masks = {cv::Mat(), cv::Mat()}; tracker->feed_new_camera(msg); // ── Retrieve feature database ──────────────────────────────────────────────── auto db = tracker->get_feature_database(); printf("Tracking %zu features\n", db->size()); // ── Visualization ──────────────────────────────────────────────────────────── cv::Mat viz_active, viz_history; tracker->display_active(viz_active, 255, 0, 0, 0, 255, 0); // red=new, green=old tracker->display_history(viz_history, 0, 255, 255, 255, 0, 0); cv::imshow("Active", viz_active); ``` -------------------------------- ### Install Python Dependencies for Plotting Source: https://github.com/rpng/open_vins/blob/master/docs/gs-installing.dox Installs necessary Python 2.7 or 3 development headers and libraries for matplotlib and psutil. Essential for visualization utilities. ```shell sudo apt-get install python2.7-dev python-matplotlib python-numpy python-psutil # for python2 systems sudo apt-get install python3-dev python3-matplotlib python3-numpy python3-psutil python3-tk # for python3 systems ``` -------------------------------- ### Error Comparison Script Output Example Source: https://github.com/rpng/open_vins/blob/master/docs/eval-error.dox This is an example of the console output generated by the error_comparison script, showing processing progress and intermediate results for different datasets and algorithms. ```shell [ INFO] [1583425216.054023187]: [COMP]: 2895 poses in V1_01_easy.txt => length of 58.35 meters [ INFO] [1583425216.092355692]: [COMP]: 16702 poses in V1_02_medium.txt => length of 75.89 meters [ INFO] [1583425216.133532429]: [COMP]: 20932 poses in V1_03_difficult.txt => length of 78.98 meters [ INFO] [1583425216.179616651]: [COMP]: 22401 poses in V2_01_easy.txt => length of 36.50 meters [ INFO] [1583425216.225299463]: [COMP]: 23091 poses in V2_02_medium.txt => length of 83.23 meters [ INFO] [1583425216.225660364]: ====================================== [ INFO] [1583425223.560550101]: [COMP]: processing mono_ov_vio algorithm [ INFO] [1583425223.560632706]: [COMP]: processing mono_ov_vio algorithm => V1_01_easy dataset [ INFO] [1583425224.236769465]: [COMP]: processing mono_ov_vio algorithm => V1_02_medium dataset [ INFO] [1583425224.855489521]: [COMP]: processing mono_ov_vio algorithm => V1_03_difficult dataset [ INFO] [1583425225.659183593]: [COMP]: processing mono_ov_vio algorithm => V2_01_easy dataset [ INFO] [1583425226.442217424]: [COMP]: processing mono_ov_vio algorithm => V2_02_medium dataset [ INFO] [1583425227.366004330]: ====================================== .... [ INFO] [1583425261.724448413]: ============================================ [ INFO] [1583425261.724469372]: ATE LATEX TABLE [ INFO] [1583425261.724481841]: ============================================ & \textbf{V1_01_easy} & \textbf{V1_02_medium} & \textbf{V1_03_difficult} & \textbf{V2_01_easy} & \textbf{V2_02_medium} & \textbf{Average} \\hline mono_ov_slam & 0.699 / 0.058 & 1.675 / 0.076 & 2.542 / 0.063 & 0.773 / 0.124 & 1.538 / 0.074 & 1.445 / 0.079 \\ mono_ov_vio & 0.642 / 0.076 & 1.766 / 0.096 & 2.391 / 0.344 & 1.164 / 0.121 & 1.248 / 0.106 & 1.442 / 0.148 \\ .... [ INFO] [1583425261.724647970]: ============================================ [ INFO] [1583425261.724655060]: ============================================ [ INFO] [1583425261.724661046]: RPE LATEX TABLE [ INFO] [1583425261.724666910]: ============================================ & \textbf{8m} & \textbf{16m} & \textbf{24m} & \textbf{32m} & \textbf{40m} & \textbf{48m} \\hline mono_ov_slam & 0.661 / 0.074 & 0.802 / 0.086 & 0.979 / 0.097 & 1.061 / 0.105 & 1.145 / 0.120 & 1.289 / 0.122 \\ mono_ov_vio & 0.826 / 0.094 & 1.039 / 0.106 & 1.215 / 0.111 & 1.283 / 0.132 & 1.342 / 0.151 & 1.425 / 0.184 \\ .... [ INFO] [1583425262.514587296]: ============================================ ``` -------------------------------- ### Load Configuration and Initialize VioManager Source: https://context7.com/rpng/open_vins/llms.txt Loads configuration from a YAML file and initializes the VioManager with the specified parameters. Ensure the YAML file path is correct and contains the necessary configuration keys. ```cpp #include "core/VioManager.h" #include "core/VioManagerOptions.h" #include "utils/opencv_yaml_parse.h" #include "utils/sensor_data.h" using namespace ov_msckf; using namespace ov_core; // ── 1. Load configuration from YAML ────────────────────────────────────────── auto parser = std::make_shared("/path/to/config/euroc_mav/estimator_config.yaml"); std::string verbosity = "INFO"; parser->parse_config("verbosity", verbosity); Printer::setPrintLevel(verbosity); // ── 2. Build options and create the estimator ──────────────────────────────── VioManagerOptions params; params.print_and_load(parser); // reads all YAML keys auto sys = std::make_shared(params); ``` -------------------------------- ### Configure UpdaterZeroVelocity with Options Source: https://context7.com/rpng/open_vins/llms.txt Initialize UpdaterZeroVelocity with parameters for chi-squared gating, IMU noise, gravity magnitude, and thresholds for velocity, noise multiplier, and disparity. Requires UpdaterOptions and other system parameters. ```cpp #include "update/UpdaterZeroVelocity.h" UpdaterOptions zupt_opts; zupt_opts.chi2_multipler = 1.0; auto zupt = std::make_shared( zupt_opts, imu_noises, db, propagator, /*gravity_mag=*/9.81, /*zupt_max_velocity=*/0.1, // m/s /*zupt_noise_multiplier=*/10.0, /*zupt_max_disparity=*/0.5 // pixels ); ``` -------------------------------- ### Run Gazebo GUI in Docker Source: https://github.com/rpng/open_vins/blob/master/docs/dev-docker.dox Launches a ROS container and runs Gazebo with an empty world, displaying the GUI on the host. Requires X11 forwarding and NVIDIA Container Toolkit. ```shell docker run -it --net=host --gpus all \ --env="NVIDIA_DRIVER_CAPABILITIES=all" \ --env="DISPLAY" \ --env="QT_X11_NO_MITSHM=1" \ --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ osrf/ros:noetic-desktop-full \ bash -it -c "roslaunch gazebo_ros empty_world.launch" ``` -------------------------------- ### Configure UpdaterMSCKF with Options Source: https://context7.com/rpng/open_vins/llms.txt Set up UpdaterMSCKF with parameters for pixel noise, chi-squared gating, and feature initialization settings. Requires UpdaterOptions and FeatureInitializerOptions. ```cpp #include "update/UpdaterMSCKF.h" #include "update/UpdaterOptions.h" #include "feat/FeatureInitializerOptions.h" // ── Options ─────────────────────────────────────────────────────────────────── UpdaterOptions msckf_opts; msckf_opts.sigma_pix = 1.0; // pixel noise standard deviation msckf_opts.chi2_multipler = 1.0; // 1.0 = 95th percentile chi2 gate FeatureInitializerOptions feat_init_opts; feat_init_opts.triangulate_1d = false; feat_init_opts.refine_features = true; feat_init_opts.max_runs = 5; feat_init_opts.lambda = 1e-3; feat_init_opts.max_lamda = 1e10; auto updaterMSCKF = std::make_shared(msckf_opts, feat_init_opts); ``` -------------------------------- ### Set up ROS2 Environment Variables Source: https://github.com/rpng/open_vins/blob/master/docs/gs-installing.dox Appends ROS2 environment setup to bashrc for terminal sessions. Ensure to source bashrc after modification. ```shell echo "source /opt/ros/$ROS2_DISTRO/setup.bash" >> ~/.bashrc source ~/.bashrc ``` -------------------------------- ### Convert ROS1 bag to ROS2 using rosbags Source: https://github.com/rpng/open_vins/blob/master/docs/dev-ros1-to-ros2.dox Use this command to convert a ROS1 bag file to ROS2 format. Ensure you have the 'rosbags' utility installed. ```shell pip3 install rosbags>=0.9.11 rosbags-convert V1_01_easy.bag --dst ``` -------------------------------- ### Launch OpenVINS with Configuration Source: https://github.com/rpng/open_vins/blob/master/docs/gs-tutorial.dox Launches the OpenVINS system using the generated launch file. This command assumes the ROS2 environment is sourced and specifies the configuration to use. ```shell-session source install/setup.bash ros2 launch ov_msckf subscribe.launch.py config:=euroc_mav ``` -------------------------------- ### Get Next Clone to Marginalize Source: https://context7.com/rpng/open_vins/llms.txt Determine the timestamp of the oldest pose clone in the sliding window that is designated for marginalization. This is part of the sliding window optimization strategy. ```cpp // ── Next clone to marginalize ──────────────────────────────────────────────── double marg_time = state->margtimestep(); ``` -------------------------------- ### Valgrind Memory Leak Detection Output Source: https://github.com/rpng/open_vins/blob/master/docs/dev-profiling.dox Example output from Valgrind's memcheck tool indicating memory leaks. This helps identify where memory is being lost in the codebase. ```text ==5512== 1,578,860 (24 direct, 1,578,836 indirect) bytes in 1 blocks are definitely lost in loss record 6,585 of 6,589 ==5512== at 0x4C3017F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) .... ==5512== by 0x543F868: operator[] (unordered_map.h:973) ==5512== by 0x543F868: ov_core::TrackKLT::feed_stereo(double, cv::Mat&, cv::Mat&, unsigned long, unsigned long) (TrackKLT.cpp:165) ==5512== by 0x4EF8C52: ov_msckf::VioManager::feed_measurement_stereo(double, cv::Mat&, cv::Mat&, unsigned long, unsigned long) (VioManager.cpp:245) ==5512== by 0x1238A9: main (ros_serial_msckf.cpp:247) ``` -------------------------------- ### Clone KAIST2BAG Repositories Source: https://github.com/rpng/open_vins/blob/master/docs/gs-datasets.dox Clone the necessary repositories for converting KAIST dataset formats to ROS bag. Ensure you have ROS1 installed if using ROS2, as conversion to ROS1 is a prerequisite. ```shell git clone https://github.com/irapkaist/irp_sen_msgs.git git clone https://github.com/rpng/kaist2bag.git ``` -------------------------------- ### Configure Project to Link OpenVINS Library Source: https://github.com/rpng/open_vins/blob/master/docs/gs-installing-free.dox Sets up CMake variables for OpenVINS include directories and library names. This is necessary for linking the installed OpenVINS library into your own C++ projects. ```cmake # headers: /usr/local/include/open_vins/ # library: /usr/local/lib/libov_msckf_lib.so set(OPENVINS_INCLUDE_DIR /usr/local/include/open_vins/) set(OPENVINS_LIBRARIES ov_msckf_lib) ``` -------------------------------- ### Initialize InertialInitializer with Options Source: https://context7.com/rpng/open_vins/llms.txt Configure InertialInitializer with specific options for data collection time, IMU thresholds, feature limits, and dynamic initialization. Requires a feature database. ```cpp #include "init/InertialInitializer.h" #include "init/InertialInitializerOptions.h" // ── Options ─────────────────────────────────────────────────────────────────── InertialInitializerOptions init_opts; init_opts.init_window_time = 2.0; // seconds of data to collect init_opts.init_imu_thresh = 1.5; // accel variance threshold for jerk detection init_opts.init_max_disparity = 10.0; // max pixel disparity for static check init_opts.init_max_features = 50; init_opts.init_dyn_use = false; // set true for dynamic init auto db = tracker->get_feature_database(); auto initializer = std::make_shared(init_opts, db); ``` -------------------------------- ### Get Marginal Covariance with StateHelper Source: https://context7.com/rpng/open_vins/llms.txt Retrieve the marginal covariance for a specified subset of variables within the state. Pass the state pointer and a vector of shared pointers to the desired types. ```cpp // ── Get marginal covariance for a subset of variables ──────────────────────── std::vector> vars = {state->_imu}; Eigen::MatrixXd P_imu = StateHelper::get_marginal_covariance(state, vars); ``` -------------------------------- ### Build ROS-free OpenVINS Source: https://context7.com/rpng/open_vins/llms.txt Steps to build the `ov_msckf` component without ROS dependencies. ```bash mkdir build && cd build cmake ../ov_msckf/ make -j4 ``` -------------------------------- ### ROS 1 Launch File Configuration Source: https://github.com/rpng/open_vins/blob/master/docs/gs-tutorial.dox This XML launch file configures the OpenVINS MSCKF estimator node for ROS 1. It sets parameters like verbosity, configuration path, stereo usage, and maximum cameras, demonstrating how to override default settings. ```xml ```