• Stars
    star
    508
  • Rank 86,941 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created over 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Elevation Mapping on GPU.

Elevation Mapping cupy

Overview

This is a ROS package for elevation mapping on GPU. The elevation mapping code is written in python and uses cupy for GPU computation. The plane segmentation is done independently and runs on CPU. When the plane segmentation is generated, local convex approximations of the terrain can be efficiently generated. screenshot gif

Citing

Takahiro Miki, Lorenz Wellhausen, Ruben Grandia, Fabian Jenelten, Timon Homberger, Marco Hutter
Elevation Mapping for Locomotion and Navigation using GPU arXiv

@misc{mikielevation2022,
  doi = {10.48550/ARXIV.2204.12876},
  author = {Miki, Takahiro and Wellhausen, Lorenz and Grandia, Ruben and Jenelten, Fabian and Homberger, Timon and Hutter, Marco},
  keywords = {Robotics (cs.RO), FOS: Computer and information sciences, FOS: Computer and information sciences},
  title = {Elevation Mapping for Locomotion and Navigation using GPU},
  publisher = {International Conference on Intelligent Robots and Systems (IROS)},
  year = {2022},
}

Installation

CUDA & cuDNN

The tested versions are CUDA10.2, 11.6

CUDA
cuDNN.

Check how to install here.

Python dependencies

You will need

For traversability filter, either of

Optionally, OpenCV for inpainting filter.

Install numpy, scipy, shapely, opencv-python with the following command.

pip3 install -r requirements.txt

Cupy

cupy can be installed with specific CUDA versions. (On jetson, only "from source" i.e. pip install cupy could work)

For CUDA 10.2 pip install cupy-cuda102

For CUDA 11.0 pip install cupy-cuda110

For CUDA 11.1 pip install cupy-cuda111

For CUDA 11.2 pip install cupy-cuda112

For CUDA 11.3 pip install cupy-cuda113

For CUDA 11.4 pip install cupy-cuda114

For CUDA 11.5 pip install cupy-cuda115

For CUDA 11.6 pip install cupy-cuda116

(Install CuPy from source) % pip install cupy

Traversability filter

You can choose either pytorch, or chainer to run the CNN based traversability filter.
Install by following the official documents.

Pytorch uses ~2GB more GPU memory than Chainer, but runs a bit faster.
Use parameter use_chainer to select which backend to use.

ROS package dependencies

sudo apt install ros-noetic-pybind11-catkin
sudo apt install ros-noetic-grid-map-core ros-noetic-grid-map-msgs

On Jetson

CUDA CuDNN

CUDA and cuDNN can be installed via apt. It comes with nvidia-jetpack. The tested version is jetpack 4.5 with L4T 32.5.0.

python dependencies

On jetson, you need the version for its CPU arch:

wget https://nvidia.box.com/shared/static/p57jwntv436lfrd78inwl7iml6p13fzh.whl -O torch-1.8.0-cp36-cp36m-linux_aarch64.whl
pip3 install Cython
pip3 install numpy==1.19.5 torch-1.8.0-cp36-cp36m-linux_aarch64.whl

Also, you need to install cupy with

pip3 install cupy

This builds the packages from source so it would take time.

ROS dependencies

sudo apt install ros-melodic-pybind11-catkin
sudo apt install ros-melodic-grid-map-core ros-melodic-grid-map-msgs

Also, on jetson you need fortran (should already be installed).

sudo apt install gfortran

If the Jetson is set up with Jetpack 4.5 with ROS Melodic the following package is additionally required:

git clone [email protected]:ros/filters.git -b noetic-devel

Plane segmentation dependencies

OpenCV

sudo apt install libopencv-dev

Eigen

sudo apt install libeigen3-dev

CGAL

CGAL5 is required. It will be automatically downloaded and installed into the catkin workspace by the cgal5_catkin package. Make sure you have the third-party libaries installed on you machine:

sudo apt install libgmp-dev
sudo apt install libmpfr-dev
sudo apt install libboost-all-dev

Usage

Build

catkin build elevation_mapping_cupy
catkin build convex_plane_decomposition_ros

Errors

If you get error such as

Make Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find PythonInterp: Found unsuitable version "2.7.18", but
  required is at least "3" (found /usr/bin/python)

Build with option.

catkin build elevation_mapping_cupy -DPYTHON_EXECUTABLE=$(which python3)

Run

Basic usage.

roslaunch elevation_mapping_cupy elevation_mapping_cupy.launch

For the plane segmentation node

roslaunch convex_plane_decomposition_ros convex_plane_decomposition.launch

Errors

If you build with the install flag under ros melodic, you might get issues with the modules not found:

terminate called after throwing an instance of 'pybind11::error_already_set'
  what():  ModuleNotFoundError: No module named 'elevation_mapping_cupy'

This is because python3 modules are installed into a different location.

This can be fixed by including also the python3 modules location in the PYTHONPATH by adding following line into the launch file:

<env name="PYTHONPATH" value="<path_to_your_install>/lib/python3/dist-packages:$(env PYTHONPATH)" />

Run TurtleBot example

First, install turtlebot simulation.

sudo apt install ros-noetic-turtlebot3-gazebo ros-noetic-turtlebot3-teleop

Then, you can run the examples. For the basic version:

export TURTLEBOT3_MODEL=waffle
roslaunch elevation_mapping_cupy turtlesim_example.launch

Or, for the version including plane segmentation:

catkin build convex_plane_decomposition_ros
export TURTLEBOT3_MODEL=waffle
roslaunch elevation_mapping_cupy turtlesim_segmentation_example.launch

To control the robot with a keyboard, a new terminal window needs to be opened.
Then run

export TURTLEBOT3_MODEL=waffle
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

Velocity inputs can be sent to the robot by pressing the keys a, w, d, x. To stop the robot completely, press s.

Subscribed Topics

  • topics specified in pointcloud_topics in elevation_mapping_cupy/config/parameters.yaml ([sensor_msgs/PointCloud2])

    The distance measurements.

  • /tf ([tf/tfMessage])

    The transformation tree.

  • The plane segmentation node subscribes to an elevation map topic ([grid_map_msg/GridMap]). This can be configured in convex_plane_decomposition_ros/config/parameters.yaml

Published Topics

For elevation_mapping_cupy, topics are published as set in the rosparam.
You can specify which layers to publish in which fps.

Under publishers, you can specify the topic_name, layers basic_layers and fps.

publishers:
  your_topic_name:
    layers: [ 'list_of_layer_names', 'layer1', 'layer2' ]             # Choose from 'elevation', 'variance', 'traversability', 'time' + plugin layers
    basic_layers: [ 'list of basic layers', 'layer1' ]                # basic_layers for valid cell computation (e.g. Rviz): Choose a subset of `layers`.
    fps: 5.0                                                        # Publish rate. Use smaller value than `map_acquire_fps`.

Example setting in config/parameters.yaml.

  • elevation_map_raw ([grid_map_msg/GridMap])

    The entire elevation map.

  • elevation_map_recordable ([grid_map_msg/GridMap])

    The entire elevation map with slower update rate for visualization and logging.

  • elevation_map_filter ([grid_map_msg/GridMap])

    The filtered maps using plugins.

The plane segmentation node publishes the following:

  • planar_terrain ([convex_plane_decomposition_msgs/PlanarTerrain])

    A custom message that contains the full segmentation as a map together with the boundary information.

  • filtered_map ([grid_map_msg/GridMap])

    A grid map message to visualize the segmentation and some intermediate results. This information is also part of planar_terrain.

  • boundaries ([visualization_msgs/MarkerArray])

    A set of polygons that trace the boundaries of the segmented region. Holes and boundaries of a single region are published as separate markers with the same color.

  • insets ([visualization_msgs/PolygonArray])

    A set of polygons that are at a slight inward offset from boundaries. There might be more insets than boundaries since the inward shift can cause a single region to break down into multiple when narrow passages exist.

Plugins

You can create your own plugin to process the elevation map and publish as a layer in GridMap message.

Let's look at the example.

First, create your plugin file in elevation_mapping_cupy/script/plugins/ and save as example.py.

import cupy as cp
from typing import List
from .plugin_manager import PluginBase


class NameOfYourPlugin(PluginBase):
    def __init__(self, add_value:float=1.0, **kwargs):
        super().__init__()
        self.add_value = float(add_value)

    def __call__(self, elevation_map: cp.ndarray, layer_names: List[str],
            plugin_layers: cp.ndarray, plugin_layer_names: List[str])->cp.ndarray:
        # Process maps here
        # You can also use the other plugin's data through plugin_layers.
        new_elevation = elevation_map[0] + self.add_value
        return new_elevation

Then, add your plugin setting to config/plugin_config.yaml

example:                                      # Name of your filter
  type: "example"                             # Specify the name of your plugin (the name of your file name).
  enable: True                                # weather to load this plugin
  fill_nan: True                              # Fill nans to invalid cells of elevation layer.
  is_height_layer: True                       # If this is a height layer (such as elevation) or not (such as traversability)
  layer_name: "example_layer"                 # The layer name.
  extra_params:                               # This params are passed to the plugin class on initialization.
    add_value: 2.0                            # Example param
    
example_large:                                # You can apply same filter with different name.
  type: "example"                             # Specify the name of your plugin (the name of your file name).
  enable: True                                # weather to load this plugin
  fill_nan: True                              # Fill nans to invalid cells of elevation layer.
  is_height_layer: True                       # If this is a height layer (such as elevation) or not (such as traversability)
  layer_name: "example_layer_large"           # The layer name.
  extra_params:                               # This params are passed to the plugin class on initialization.
    add_value: 100.0                          # Example param with larger value.

Finally, add your layer name to publishers in config/parameters.yaml. You can create a new topic or add to existing topics.

  plugin_example: # Topic name
    layers: [ 'elevation', 'example_layer', 'example_layer_large' ]
    basic_layers: [ 'example_layer' ]
    fps: 1.0        # The plugin is called with this fps.

More Repositories

1

darknet_ros

YOLO ROS: Real-Time Object Detection for ROS
C++
2,158
star
2

ros_best_practices

Best practices, conventions, and tricks for ROS
C++
1,477
star
3

legged_gym

Isaac Gym Environments for Legged Robots
Python
1,188
star
4

ocs2

Optimal Control for Switched Systems
C++
802
star
5

open3d_slam

Pointcloud-based graph SLAM written in C++ using open3D library.
C++
503
star
6

rsl_rl

Fast and simple implementation of RL algorithms, designed to run fully on GPU.
Python
487
star
7

se2_navigation

Pure Pursuit Control and SE(2) Planning
C++
439
star
8

free_gait

An Architecture for the Versatile Control of Legged Robots
C++
397
star
9

traversability_estimation

Traversability mapping for mobile rough terrain navigation
C++
352
star
10

raisimLib

RAISIM, A PHYSICS ENGINE FOR ROBOTICS AND AI RESEARCH
325
star
11

xpp

Visualization of Motions for Legged Robots in ros-rviz
C++
293
star
12

graph_msf

A graph-based multi-sensor fusion framework. It can be used to fuse various relative or absolute measurments with IMU readings in real-time.
C++
259
star
13

icp_localization

This package provides localization in a pre-built map using ICP and odometry (or the IMU measurements).
C++
258
star
14

viplanner

ViPlanner: Visual Semantic Imperative Learning for Local Navigation
Python
236
star
15

delora

Self-supervised Deep LiDAR Odometry for Robotic Applications
Python
232
star
16

iPlanner

iPlanner: Imperative Path Planning. An end-to-end learning planning framework using a novel unsupervised imperative learning approach
Python
200
star
17

SimBenchmark

Physics engine benchmark for robotics applications: RaiSim vs Bullet vs ODE vs MuJoCo vs DartSim
C++
193
star
18

learning_quadrupedal_locomotion_over_challenging_terrain_supplementary

Supplementary materials for "Learning Locomotion over Challenging Terrain"
C++
173
star
19

raisimGym

Python
141
star
20

art_planner

Local Navigation Planner for Legged Robots
C++
132
star
21

perceptive_mpc

Code for "Perceptive Model Predictive Control for Continuous Mobile Manipulation"
C++
129
star
22

wild_visual_navigation

Wild Visual Navigation: A system for fast traversability learning via pre-trained models and online self-supervision
Python
126
star
23

tensorflow-cpp

Pre-built TensorFlow for C/C++ and CMake.
Shell
114
star
24

terrain-generator

Python
108
star
25

vitruvio

Vitruvio is a framework for rapid leg design analysis and optimization for legged robots. The purpose of the simulation framework is to guide the early stages of legged robot design. The end effectors track an input trajectory and the necessary joint speed, torque, power and energy for the tracking is computed.
MATLAB
88
star
26

L3E

Learning-based localizability estimation for robust LiDAR localization.
87
star
27

elmo_ethercat_sdk

C++
80
star
28

MPC-Net

Accompanying code for the publication "MPC-Net: A First Principles Guided Policy Search"
Python
79
star
29

tree_detection

This package implements a simple tree detector from point cloud data. It makes no assumptions about the ground plane and can handle arbitrary terrains.
C++
69
star
30

rayen

Imposition of Hard Convex Constraints on Neural Networks
Python
68
star
31

raisimOgre

https://rsl.ethz.ch/partnership/spinoff/raisim.html
67
star
32

smug_planner

C++
59
star
33

noesis

A Reinforcement Learning Software Toolbox for Robotics
C++
53
star
34

RSLGym

Reinforcement learning framework from RSL for policy training with RaiSim.
Python
48
star
35

hardware_time_sync

Guidelines on how to hardware synchronize the time of multiple sensors, e.g., IMU, cameras, etc.
46
star
36

anomaly_navigation

Anomaly Navigation - ANNA
Python
41
star
37

cerberus_darpa_subt_datasets

Datasets collected by Team CERBERUS during the DARPA Subterranean Challenge
39
star
38

RaiSimUnity

A visualizer for RaiSim based on Unity
31
star
39

raw_image_pipeline

Image processing pipeline for cameras that provide raw data
C++
31
star
40

soem_interface

This software package serves as a C++ interface for one or more EtherCAT devices running on the same bus. The lower level EtherCAT communication is handled by the SOEM library.
C
28
star
41

tcan

A library to communicate to devices connected through CAN, EtherCat, USB or TCP/IP.
C++
28
star
42

swerve_steering

C++
26
star
43

workflows

Collection of workflows, best-practices and guidelines for software development.
Python
26
star
44

radiance_field_ros

Implementation of Radiance Fields for Robotic Teleoperation
Python
25
star
45

terra

A grid world environment for high-level earthworks planning in JAX for RL.
Python
22
star
46

urdf2robcogen

A tool that translates a robot URDF description into the kindsl format that can be processed by RobCoGen.
C++
21
star
47

maxon_epos_ethercat_sdk

Implementation of an ethercat device driver for the maxon epos 4
C++
18
star
48

self_supervised_segmentation

Python
17
star
49

ocs2_robotic_assets

Various robotic assets for OCS2 Toolbox
CMake
17
star
50

cerberus_anymal_locomotion

C++
16
star
51

cuda_ue4_linux

C++
15
star
52

ethercat_sdk_master

A wrapper around SOEM to allow multiple masters and devices on EtherCAT
C++
14
star
53

ethercat_device_configurator

Manages setup yaml files for the RSL ethercat infrastructure
C++
14
star
54

lunar_planner

Python
14
star
55

pytictac

Simple Timing Utils
Python
13
star
56

catkin_create_rqt

An RQT plugin generator script, supporting several arguments to generate a rqt plugin for ROS, similar to catkin_create_pkg
Python
12
star
57

rl-blindloco

Project page for Science Robotics paper "Learning Quadrupedal Locomotion over Challenging Terrain"
HTML
11
star
58

learning_docker

Shell
9
star
59

any_ping_indicator

An Ubuntu indicator applet to show the ping status.
Python
8
star
60

plr-exercise

Python
7
star
61

terra-baselines

Train, visualize, and evaluate RL policies for the Terra environment.
Python
7
star
62

rsl_heap

CMake
7
star
63

anymal_brax

Python
7
star
64

perfectlyconstrained

Official implementations from the paper "Should We Relax a Bit? A Study on Degeneracy Mitigation in Point Cloud Registration"
7
star
65

unity_ros_teleoperation

C#
6
star
66

gtsam_catkin

Catkinized version of gtsam.
CMake
4
star
67

digbench

Benchmarks and map generation for the Terra environment.
Python
4
star
68

mobile_manipulation

Under construction
3
star
69

realsense_eth_robotics_summer_school_2019

Launch files and utility nodes for running the Realsense on SMB
CMake
2
star
70

xpp-release

Release repository of the xpp repo, necessary for ros hosting.
1
star
71

rsl_panoptic_mapping

C++
1
star
72

rsl_panoptic

Python
1
star
73

pretrained_depth_embedders

Python
1
star
74

darknet_ros-release

1
star
75

webapp-container

Scripts and tools to containerize a PHP-FPM, Nginx, Redis web-application ⚙️
Dockerfile
1
star