Giter VIP home page Giter VIP logo

mfkiwl / gtsam_fusion Goto Github PK

View Code? Open in Web Editor NEW

This project forked from paulkemppi/gtsam_fusion

0.0 1.0 0.0 69 KB

Estimates pose, velocity, and accelerometer / gyroscope biases by fusing GPS position and/or 6DOF pose with IMU data. The fusion is done using GTSAM's sparse nonlinear incremental optimization (ISAM2). The ROS (rospy) node is implemented using GTSAM's python3 inteface.

License: BSD 3-Clause "New" or "Revised" License

CMake 15.07% Python 84.93%

gtsam_fusion's Introduction

gtsam_fusion

Estimates pose, velocity, and accelerometer / gyroscope biases by fusing GPS position and/or 6DOF pose with IMU data. The fusion is done using GTSAM's sparse nonlinear incremental optimization (ISAM2). The ROS (rospy) node is implemented using GTSAM's python3 inteface.

Contents

gtsam_fusion_core.py: Contains the core functionality related to the sensor fusion done using GTSAM ISAM2 (incremental smoothing and mapping using the bayes tree) without any dependency to ROS.

gtsam_fusion_ros.py: ROS node to run the GTSAM FUSION. The pose estimation is done in IMU frame and IMU messages are always required as one of the input. Additionally, either GPS (NavSatFix) or 6DOF pose (PoseWithCovarianceStamped) messages are required to constrain the drift in the IMU preintegration. The output is published as PoseWithCovarianceStamped messages with the frame rate defined by the IMU.

plots.py: Contains code to plot input and output of the GTSAM FUSION using matplotlib.

Installation (ROS Melodic)

As this module is implemented using python3 and ROS Melodic uses python2 by default, few steps need to be taken to be able to run python3 code. This installation assumes that ROS Melodic is already installed on a PC running Ubuntu 18.04LTS

Install the required dependencies

sudo apt-get install python3-pip python3-yaml python-catkin-tools python3-dev python3-numpy

Install the required python modules

pip3 install rospkg catkin_pkg empy pycryptodomex gnupg

Install already the modules required by gtsam slam:

pip3 install gtsam utm matplotlib

Create a new (separate) workspace for ROS packages using Python3

mkdir ~/python3_ws && cd ~/python3_ws
catkin config -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so
catkin config --install

Create a folder for the source and clone the two problematic ROS modules (tf2, vision_opencv, and ros_comm due to rosbag API)

mkdir ~/python3_ws/src && cd ~/python3_ws/src
git clone -b melodic https://github.com/ros-perception/vision_opencv.git
git clone -b melodic-devel https://github.com/ros/geometry2.git
git clone -b melodic-devel https://github.com/ros/ros_comm.git

Compile and source the workspace

cd ~/python3_ws
catkin build
source install/setup.bash --extend

In order to test that everything works, open the python3 intepreter

python3

Type the following import commands. If no errors show up, everything is setup correctly.

import rospy
import tf2_ros
import cv_bridge
import rosbag
import gtsam

Remember to source the python3_ws before using nodes from it:

source ~/python3_ws/install/setup.zsh --extend

Running

GPS & IMU FUSION offline via rosbag API

Download the sample bag file from: gtsam_fusion.bag

Launch the node giving the bag file path as input argument:

roslaunch gtsam_fusion rosbag_sample_gps_imu.launch

The bag file will be processed via rosbag API and the fusion results will be plotted at the end.

6DOF POSE & IMU FUSION offline via rosbag API

Download the sample bag file from: gtsam_fusion.bag

Launch the node giving the bag file path as input argument:

roslaunch gtsam_fusion rosbag_sample_gps_pose.launch

The bag file will be processed via rosbag API and the fusion results will be plotted at the end.

Online usage (GPS + IMU):

To run GTSAM_FUSION offline or online by subscribing to input topics:

rosrun gtsam_fusion gtsam_fusion_ros.py _imu_topic:=<imu_topic> _gps_topic:=<gps_topic> _use_pose:=false _use_gps:=true

Start nodes that publish <gps_topic> and <imu_topic> and additionally adjust the other parameters defined in gtsam_fusion_ros.py.

The fused pose will be published in topic /base_pose_in_map_100hz (remap the topic name if needed).

gtsam_fusion's People

Contributors

paulkemppi avatar

Watchers

 avatar

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.