• Stars
    star
    455
  • Rank 92,906 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created about 2 years ago
  • Updated 8 days 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,017
star
2

ros_best_practices

Best practices, conventions, and tricks for ROS. Do you want to become a robotics master? Then consider graduating or working at the Robotics Systems Lab at ETH in ZΓΌrich!
C++
1,403
star
3

legged_gym

Isaac Gym Environments for Legged Robots
Python
971
star
4

ocs2

Optimal Control for Switched Systems
C++
731
star
5

open3d_slam

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

se2_navigation

Pure Pursuit Control and SE(2) Planning
C++
402
star
7

free_gait

An Architecture for the Versatile Control of Legged Robots
C++
388
star
8

rsl_rl

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

raisimLib

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

traversability_estimation

Traversability mapping for mobile rough terrain navigation
C++
310
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++
239
star
13

icp_localization

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

delora

Self-supervised Deep LiDAR Odometry for Robotic Applications
Python
226
star
15

SimBenchmark

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

iPlanner

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

learning_quadrupedal_locomotion_over_challenging_terrain_supplementary

Supplementary materials for "Learning Locomotion over Challenging Terrain"
C++
162
star
18

raisimGym

Python
141
star
19

art_planner

Local Navigation Planner for Legged Robots
C++
116
star
20

tensorflow-cpp

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

perceptive_mpc

C++
105
star
22

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
86
star
23

terrain-generator

Python
85
star
24

L3E

Learning-based localizability estimation for robust LiDAR localization.
82
star
25

MPC-Net

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

wild_visual_navigation

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

elmo_ethercat_sdk

C++
74
star
28

rayen

Imposition of Hard Convex Constraints on Neural Networks
Python
67
star
29

raisimOgre

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

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++
66
star
31

noesis

A Reinforcement Learning Software Toolbox for Robotics
C++
52
star
32

hardware_time_sync

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

RSLGym

Reinforcement learning framework from RSL for policy training with RaiSim.
Python
45
star
34

anomaly_navigation

Anomaly Navigation - ANNA
Python
39
star
35

cerberus_darpa_subt_datasets

Datasets collected by Team CERBERUS during the DARPA Subterranean Challenge
37
star
36

RaiSimUnity

A visualizer for RaiSim based on Unity
31
star
37

swerve_steering

C++
26
star
38

smug_planner

C++
26
star
39

workflows

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

tcan

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

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
25
star
42

raw_image_pipeline

Image processing pipeline for cameras that provide RAW data
C++
24
star
43

urdf2robcogen

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

maxon_epos_ethercat_sdk

Implementation of an ethercat device driver for the maxon epos 4
C++
16
star
45

cuda_ue4_linux

C++
15
star
46

ethercat_sdk_master

A wrapper around SOEM to allow multiple masters and devices on EtherCAT
C++
13
star
47

ocs2_robotic_assets

Various robotic assets for OCS2 Toolbox
CMake
13
star
48

cerberus_anymal_locomotion

C++
13
star
49

ethercat_device_configurator

Manages setup yaml files for the RSL ethercat infrastructure
C++
12
star
50

pytictac

Simple Timing Utils
Python
12
star
51

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
52

pinocchio

A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
C++
12
star
53

terra

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

learning_docker

Shell
8
star
55

plr-exercise

Python
7
star
56

terra-baselines

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

viplanner

ViPlanner: Visual Semantic Imperative Learning for Local Navigation
Python
7
star
58

rl-blindloco

Project page for Science Robotics paper "Learning Quadrupedal Locomotion over Challenging Terrain"
HTML
7
star
59

anymal_brax

Python
7
star
60

rsl_heap

CMake
7
star
61

any_ping_indicator

An Ubuntu indicator applet to show the ping status.
Python
7
star
62

self_supervised_segmentation

Python
6
star
63

glimpse_nvblox_ros1

Static fork from Nvidia's Nvblox repo. Converted to ROS-1 and adapted for 3d-LiDAR generated depth images
C++
4
star
64

gtsam_catkin

Catkinized version of gtsam.
CMake
3
star
65

mobile_manipulation

Under construction
3
star
66

digbench

Benchmarks and map generation for the Terra environment.
Python
3
star
67

ros_control_boilerplate

Provides a simple simulation interface and template for setting up a hardware interface for ros_control
C++
3
star
68

serial

Cross-platform, Serial Port library written in C++
C++
2
star
69

realsense_eth_robotics_summer_school_2019

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

rsl_panoptic_mapping

C++
1
star
71

rsl_panoptic

Python
1
star
72

pretrained_depth_embedders

Python
1
star
73

darknet_ros-release

1
star
74

webapp-container

Scripts and tools to containerize a PHP-FPM, Nginx, Redis web-application βš™οΈ
Dockerfile
1
star
75

xpp-release

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