Giter Site home page Giter Site logo

suchetanrs / traversability_mapping Goto Github PK

View Code? Open in Web Editor NEW
52.0 7.0 5.0 42.54 MB

This repository contains the packages responsible for performing global traversability mapping which can be very easily integrated with any SLAM system.

Shell 0.56% C++ 91.15% CMake 6.78% Python 1.51%

traversability_mapping's Introduction

A Global Traversability Mapping Library easily integratable with any SLAM System.

This repository contains the packages responsible for performing global traversability mapping and can be very easily integrated with any SLAM system.

Image 1 Image 2
Traversability Map generated with the 3D PointCloud and SLAM Gazebo world of the map

Cloning the repository

git clone https://github.com/suchetanrs/traversability_mapping

Building the library.

Run the following to execute a shell script that installs all the dependencies and build the library.

cd <cloned repository>
./build.sh

Adjusting the parameters

The parameter file for the library is in traversability_mapping/params

In this, you need to provide the transform between the lidar frame and camera (SLAM) frame. NOTE: In case you do not intend to provide a LiDAR pointcloud and wish to send your own pointcloud in camera frame, set this transform to 0

CMakeLists

You can include this library in the CMakeLists.txt of your SLAM by doing the following. Here we assume your SLAM system is named as ${PROJECT_NAME}. Change this as you desire.

A compile flag -DWITH_TRAVERSABILITY_MAP is added so that you can enable or disable this library while running your SLAM system.

find_package(traversability_mapping)
if(traversability_mapping_FOUND)
    include_directories(${PROJECT_NAME}
    ${traversability_mapping_INCLUDE_DIRS}
    )
    ADD_DEFINITIONS("-DWITH_TRAVERSABILITY_MAP")
endif(traversability_mapping_FOUND)

if(traversability_mapping_FOUND)
   target_link_libraries(${PROJECT_NAME}
   type_conversion
   traversabilitySystem
   )
endif(traversability_mapping_FOUND)

Using the Traversability Mapping Library

Include headers


#ifdef WITH_TRAVERSABILITY_MAP
#include "traversability_mapping/System.hpp"
#endif

Create an instance (You can also use the smart pointers in C++)


NOTE: THERE SHOULD BE ONLY ONE INSTANCE OF THIS CLASS CREATED

You don't need to worry about running this instance in a seperate thread since it is handled internally by the library.

In case you need access to the traversability class pointer across multiple classes in your SLAM system, pass the newly created pointer to the constructors of the class that needs access. Do not create a new instance for it :p

// private class member
traversability_mapping::System* pTraversability_;

// new instance
pTraversability_ = new traversability_mapping::System();

Creating a new map for traversability mapping.


NOTE: Only one map needs to be created for a single traversability instance. You can create multiple maps in case the SLAM handles loss of tracking by creating a new map.

long unsigned int mapid = 0;
pTraversability_->addNewLocalMap(mapid);

Adding PointClouds to the Buffer.


The library provides a buffer to store the 3D pointclouds. In case you initialize a KeyFrame without the 3D Pointcloud, it handles it by assigning the Pointcloud with the closest timestamp to the keyframe. It is better to do this in the PointCloud callback.

NOTE: This needs to be done continously

// pcl is of type sensor_msgs::msg::PointCloud2
pTraversability_->pushToBuffer(pcl); 

Adding a new KeyFrame.


Once a map is created, you can add keyframes to the map to generate traversability. This is done by giving a keyframe ID along with the timestamp and an already created map ID.

The timestamps can be passed either as a double value of the type seconds.nanoseconds or an unsigned long long value of only nanoseconds.

The keyFrame ID (kfID) must be a non-negative integer. This automatically matches the Keyframe with the PointCloud having the closest timestamp in the buffer.

pTraversability_->addNewKeyFrame(timestamp, kFID, mapid);

In case you also want to assign a pointcloud directly to the keyframe instead of using the Pointclouds in the buffer, you can do it by passing a pointcloud of the type sensor_msgs::msg::PointCloud2

pTraversability_->addNewKeyFrame(timestamp, kFID, mapid, pointCloud);

Updating the pose of the KeyFrame.


The poses can be passed either as Eigen::Affine3d or Sophus::SE3f.

NOTE: The keyframe pose must be in the map frame.

// Eigen::Affine3d pose;
pTraversability_->updateKeyFrame(kFID, pose);

These poses can be updated continously during optimization and loop closing.

Visualization

Visualizing the Occupancy Grid


You can do this after every keyframe update step.

There is an individual occupancy map for every local Map you create. The following lines will return the occupancy map of the currently active Local Map (That is, the map to which you are adding new keyframes.)

if(pTraversability_->getLocalMap() != nullptr)
{
    auto OccupancyGrid = pTraversability_->getLocalMap()->getOccupancyMap();
}

Visualizing the full GridMap.


You can do this after every keyframe update step.

if(pTraversability_->getLocalMap() != nullptr)
{
    auto gridmap = pTraversability_->getLocalMap()->getGridMap();
}

traversability_mapping's People

Contributors

suchetanrs avatar

Stargazers

Akhilesh avatar Giovanni Toffetti avatar  avatar Lucas Hegerath avatar  avatar  avatar  avatar Oussama avatar Alessio Parmeggiani avatar  avatar  avatar LeiZHang avatar  avatar  avatar Viraj Awate avatar JoséLMV avatar Can Altineller avatar Lucas Zhang avatar  avatar  avatar DengQi avatar Mewada Yash avatar Raghav Mishra avatar KimJinwoo avatar james.yookh avatar Wouter Meijer avatar Engin Bozkurt avatar Eren Aydemir avatar Ahmet Faruk GÜMÜŞTAŞ avatar afei avatar Hyungtae Lim avatar Alejandro Serna M avatar Miquel Ramírez avatar  avatar 赵焕峰 avatar  avatar Nical avatar Kinetis avatar Nobel avatar Zihong Yan avatar Gilhwan Kang avatar Juwon Kim avatar  avatar  avatar KasperCJ avatar Vishal Prabhu avatar Hogyun Kim avatar Giseop Kim avatar Morgan Hough avatar Guoqiang Yin avatar Vinny Ruia avatar  avatar

Watchers

Giseop Kim avatar Vinny Ruia avatar james.yookh avatar WangNing avatar Ahmet Faruk GÜMÜŞTAŞ avatar  avatar Hardaat Singh Baath avatar

traversability_mapping's Issues

building error

Firstly, I want to express my gratitude for sharing your remarkable work.

I've encountered an issue while attempting to build your package. Despite diligently following your instructions, I encountered an error.

I'm operating within the Ubuntu 20.04 environment with ROS2 Foxy. Could you kindly advise on resolving this error?

Thank you in advance. Best regards.

Install the project...
-- Install configuration: "Release"
CMake Error at cmake_install.cmake:62 (file):
file cannot create directory: /usr/local/share/sophus/cmake. Maybe need
administrative privileges.

make: *** [Makefile:110: install] Error 1
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/home/tra_ws/src/traversability_mapping/traversability_mapping_common/build
[ 50%] Building CXX object CMakeFiles/type_conversion.dir/src/type_conversion.cpp.o
In file included from /home/home/tra_ws/src/traversability_mapping/traversability_mapping_common/src/type_conversion.cpp:7:
/home/home/tra_ws/src/traversability_mapping/traversability_mapping_common/include/traversability_mapping_common/type_conversion.hpp:12:10: fatal error: sophus/se3.hpp: No such file or directory
12 | #include "sophus/se3.hpp"
| ^~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/type_conversion.dir/build.make:76: CMakeFiles/type_conversion.dir/src/type_conversion.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/type_conversion.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
[ 50%] Building CXX object CMakeFiles/type_conversion.dir/src/type_conversion.cpp.o
In file included from /home/home/tra_ws/src/traversability_mapping/traversability_mapping_common/src/type_conversion.cpp:7:
/home/home/tra_ws/src/traversability_mapping/traversability_mapping_common/include/traversability_mapping_common/type_conversion.hpp:12:10: fatal error: sophus/se3.hpp: No such file or directory
12 | #include "sophus/se3.hpp"
| ^~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/type_conversion.dir/build.make:76: CMakeFiles/type_conversion.dir/src/type_conversion.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/type_conversion.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Reading package lists... Done
Building dependency tree
Reading state information... Done
ros-foxy-sensor-msgs is already the newest version (2.0.5-1focal.20230527.050830).
The following packages were automatically installed and are no longer required:
gconf-service gconf-service-backend gconf2-common libdjvulibre-dev
libgconf-2-4 liblqr-1-0-dev libmagick++-6-headers libmagick++-6.q16-8
libmagickcore-6-arch-config libmagickcore-6-headers libmagickwand-6-headers
librhash0 librsvg2-dev linux-headers-5.15.0-102-generic
linux-hwe-5.15-headers-5.15.0-102 linux-image-5.15.0-102-generic
linux-modules-5.15.0-102-generic linux-modules-extra-5.15.0-102-generic
nsight-compute-2023.3.0
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ros-foxy-grid-map
Reading package lists... Done
Building dependency tree
Reading state information... Done
ros-foxy-nav-msgs is already the newest version (2.0.5-1focal.20230527.050829).
The following packages were automatically installed and are no longer required:
gconf-service gconf-service-backend gconf2-common libdjvulibre-dev
libgconf-2-4 liblqr-1-0-dev libmagick++-6-headers libmagick++-6.q16-8
libmagickcore-6-arch-config libmagickcore-6-headers libmagickwand-6-headers
librhash0 librsvg2-dev linux-headers-5.15.0-102-generic
linux-hwe-5.15-headers-5.15.0-102 linux-image-5.15.0-102-generic
linux-modules-5.15.0-102-generic linux-modules-extra-5.15.0-102-generic
nsight-compute-2023.3.0
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
CMake Error at CMakeLists.txt:12 (find_package):
By not providing "Findtraversability_mapping_common.cmake" in
CMAKE_MODULE_PATH this project has asked CMake to find a package
configuration file provided by "traversability_mapping_common", but CMake
did not find one.

Could not find a package configuration file provided by
"traversability_mapping_common" with any of the following names:

traversability_mapping_commonConfig.cmake
traversability_mapping_common-config.cmake

Add the installation prefix of "traversability_mapping_common" to
CMAKE_PREFIX_PATH or set "traversability_mapping_common_DIR" to a directory
containing one of the above files. If "traversability_mapping_common"
provides a separate development package or SDK, be sure it has been
installed.

-- Configuring incomplete, errors occurred!
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target 'install'. Stop.

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.