elevation_mapping_cupy on Orin

Follow https://github.com/leggedrobotics/elevation_mapping_cupyhttps://github.com/leggedrobotics/elevation_mapping_cupy

mkdir -p ws_em/src && cd ws_em/src
git clone https://github.com/leggedrobotics/elevation_mapping_cupy.git

Install python dependencies

Install pip first

sudo apt install python3-pip
cd elevation_mapping_cupy
pip3 install -r requirements.txt
pip3 install cupy==11.4.0
pip3 install Cython

If some version related error occured, reinstall the corresponding packages of the correct versions using the format of pip3 install shapely==1.7.1

Be sure to install cupy 1.14.0. Otherwise some incompatibility issue may occur.

Install ROS dependencies

Install ROS first following noetic/Installation/Ubuntu - ROS Wiki

Setup the Tsinghua mirrors following ros | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

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

It's better to sudo apt install ros-noetic-grid-map*, otherwise, an error will occur later about missing grid-map packages.

Other dependencies

sudo apt install libopencv-dev libeigen3-dev libgmp-dev libmpfr-dev libboost-all-dev
sudo apt install libopenblas-dev
sudo apt install gfortran
sudo apt install libcgal-dev

Install torch for arm achitecture

pip3 install torch-1.12.0a0+2c916ef.nv22.3-cp38-cp38-linux_aarch64.whl

Need to install the version matching the python version, python3.8 in this case.

Install opencv from source

following How to install OpenCV on Ubuntu 20.04 - VITUXOpenCV is a library of computer vision abbreviated as Open Source Computer Vision Library. Open means it is an open-source library with bindings for python, C++…https://vitux.com/opencv_ubuntu/

sudo apt install build-essential cmake git pkg-config libgtk-3-dev \
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \
gfortran openexr libatlas-base-dev python3-dev python3-numpy \
libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev \
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
mkdir ~/opencv_build && cd ~/opencv_build
git clone https://github.com/opencv/opencv.git
git clon
elevation mapping using CuPy for GPU-accelerated terrain modeling 是一种利用 GPU 的强大计算能力加速地形建模过程的技术。CuPy 是一个与 NumPy 兼容的 GPU 加速数组库,能够无缝地将计算任务从 CPU 转移到 GPU,从而显著提升大规模数据处理的性能。 在地形建模中,elevation mapping 通常涉及对大规模高程数据进行插值、滤波、网格化以及表面重建等操作。这些操作在 CPU 上处理可能会受到性能瓶颈的限制,尤其是在处理高分辨率遥感数据或实时地形感知应用(如机器人导航、自动驾驶或虚拟现实)中,需要快速生成或更新地形模型。利用 CuPy 可以将这些计算密集型操作在 GPU 上高效执行,从而实现加速效果。 例如,可以使用 CuPy 对点云数据进行快速插值,生成规则的高程网格(Digital Elevation Model, DEM),也可以实现基于 GPU 的地形滤波算法,如移动平均滤波、中值滤波或高斯滤波,以去除噪声或提取地形特征。此外,CuPy 还可以与 CUDA 内核结合使用,通过自定义内核进一步优化地形建模的关键算法,从而实现更高的性能提升。 以下是一个使用 CuPy 实现简单高程插值的示例代码: ```python import cupy as cp import numpy as np # 假设我们有一组不规则的 (x, y, z) 高程点 x = np.random.rand(10000) * 100 y = np.random.rand(10000) * 100 z = np.sin(x / 10) + np.cos(y / 10) # 转换为 CuPy 数组 x_gpu = cp.array(x) y_gpu = cp.array(y) z_gpu = cp.array(z) # 定义网格分辨率 grid_size = 100 x_grid = cp.linspace(0, 100, grid_size) y_grid = cp.linspace(0, 100, grid_size) X, Y = cp.meshgrid(x_grid, y_grid) # 使用最近邻插值方法进行高程映射 from cupyx.scipy.interpolate import griddata Z_gpu = griddata((x_gpu, y_gpu), z_gpu, (X, Y), method='linear') # 将结果转移到 CPU Z = cp.asnumpy(Z_gpu) ``` 通过这种方式,可以在 GPU 上实现高效的 elevation mapping,从而加速地形建模过程。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值