Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Feb 22, 2024
2 parents c5911a3 + 0eb7d8b commit fc42a5e
Show file tree
Hide file tree
Showing 30 changed files with 888 additions and 205 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version:
# - "3.8"
- "3.11"
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- name: Checkout source code
Expand Down Expand Up @@ -71,9 +69,8 @@ jobs:
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
env:
PYPI_USERNAME: ${{ secrets.pypi_username }}
PYPI_PASSWORD: ${{ secrets.pypi_password }}
PYPI_API_TOKEN: ${{ secrets.pypi_api_token }}
run: |
python -m pip install twine
cd build/lib/python_package
python -m twine upload -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} pip_package/*
python -m twine upload -u "__token__" -p ${PYPI_API_TOKEN} pip_package/*
5 changes: 2 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
working-directory: ${{ env.build_dir }}/lib/python_package
env:
PYPI_USERNAME: ${{ secrets.pypi_username }}
PYPI_PASSWORD: ${{ secrets.pypi_password }}
PYPI_API_TOKEN: ${{ secrets.pypi_api_token }}
run: |
python -m pip install twine
python -m twine upload -u $env:PYPI_USERNAME -p $env:PYPI_PASSWORD pip_package/*
python -m twine upload -u "__token__" -p $env:PYPI_API_TOKEN pip_package/*
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FROM nvidia/cuda:11.4.0-devel-ubuntu20.04
FROM nvidia/cuda:11.7.1-devel-ubuntu20.04

WORKDIR /work/cupoch

Expand Down Expand Up @@ -39,4 +39,5 @@ RUN mkdir build \
COPY . .
RUN cd build \
&& cmake .. -DCMAKE_BUILD_TYPE=Release \
&& make install-pip-package
&& make pip-package \
&& pip install lib/python_package/pip_package/*.whl
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This repository is based on [Open3D](https://github.com/intel-isl/Open3D).
* [flann](https://github.com/flann-lib/flann)
* Point cloud registration
* ICP
* [Symmetric ICP](https://gfx.cs.princeton.edu/pubs/Rusinkiewicz_2019_ASO/symm_icp.pdf) (Implemented by [@eclipse0922](https://github.com/eclipse0922))
* [Colored Point Cloud Registration](https://ieeexplore.ieee.org/document/8237287)
* [Fast Global Registration](http://vladlen.info/papers/fast-global-registration.pdf)
* [FilterReg](https://arxiv.org/abs/1811.10136)
Expand Down Expand Up @@ -83,7 +84,7 @@ You can also install cupoch using pip on Jetson Nano.
Please set up Jetson using [jetpack](https://developer.nvidia.com/embedded/jetpack) and install some packages with apt.

```
sudo apt-get install libxinerama-dev libxcursor-dev libglu1-mesa-dev
sudo apt-get install xorg-dev libxinerama-dev libxcursor-dev libglu1-mesa-dev
pip3 install cupoch
```

Expand All @@ -107,27 +108,6 @@ sudo make install-pip-package

### Use Docker

Setting default container runtime to nvidia-container-runtime.
Edit or create the `/etc/docker/daemon.json`.

```sh
{
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
},
"default-runtime": "nvidia"
}
```

Restart docker daemon.

```sh
sudo systemctl restart docker
```

```sh
docker-compose up -d
# xhost +
Expand All @@ -147,11 +127,31 @@ The environment tested on has the following specs:

You can get the result by running the example script in your environment.

```
```sh
cd examples/python/basic
python benchmarks.py
```

If you get the following error when executing an example that includes 3D drawing, please start the program as follows.

```sh
$ cd examples/basic
$ python visualization.py
Load a ply point cloud, print it, and render it
MESA: warning: Driver does not support the 0xa7a0 PCI ID.
libGL error: failed to create dri screen
libGL error: failed to load driver: iris
MESA: warning: Driver does not support the 0xa7a0 PCI ID.
libGL error: failed to create dri screen
libGL error: failed to load driver: iris
Error: unknown error phong_shader.cu:330
```

```sh
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia python visualization.py
```


![speedup](https://raw.githubusercontent.com/neka-nat/cupoch/master/docs/_static/speedup.png)

### Visual odometry with intel realsense D435
Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

class CupochConan(ConanFile):
name = "cupoch"
version = "0.2.8.1"
version = "0.2.10.0"
package_type = "library"

license = "MIT"
Expand Down
18 changes: 15 additions & 3 deletions src/cupoch/geometry/boundingvolume.cu
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct check_within_oriented_bounding_box_functor {
const std::array<Eigen::Vector3f, 8> box_points_;
__device__ float test_plane(const Eigen::Vector3f &a,
const Eigen::Vector3f &b,
const Eigen::Vector3f c,
const Eigen::Vector3f &c,
const Eigen::Vector3f &x) const {
Eigen::Matrix3f design;
design << (b - a), (c - a), (x - a);
Expand All @@ -51,7 +51,7 @@ struct check_within_oriented_bounding_box_functor {
__device__ bool operator()(
const thrust::tuple<int, Eigen::Vector3f> &x) const {
const Eigen::Vector3f &point = thrust::get<1>(x);
return (test_plane(box_points_[0], box_points_[1], box_points_[3],
return ((test_plane(box_points_[0], box_points_[1], box_points_[3],
point) <= 0 &&
test_plane(box_points_[0], box_points_[5], box_points_[3],
point) >= 0 &&
Expand All @@ -62,7 +62,19 @@ struct check_within_oriented_bounding_box_functor {
test_plane(box_points_[3], box_points_[4], box_points_[5],
point) <= 0 &&
test_plane(box_points_[0], box_points_[1], box_points_[7],
point) >= 0);
point) >= 0) ||
(test_plane(box_points_[0], box_points_[1], box_points_[3],
point) >= 0 &&
test_plane(box_points_[0], box_points_[5], box_points_[3],
point) <= 0 &&
test_plane(box_points_[2], box_points_[5], box_points_[7],
point) >= 0 &&
test_plane(box_points_[1], box_points_[4], box_points_[7],
point) <= 0 &&
test_plane(box_points_[3], box_points_[4], box_points_[5],
point) >= 0 &&
test_plane(box_points_[0], box_points_[1], box_points_[7],
point) <= 0));
}
};

Expand Down
5 changes: 5 additions & 0 deletions src/cupoch/geometry/laserscanbuffer.cu
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ template LaserScanBuffer& LaserScanBuffer::AddRanges(
const Eigen::Matrix4f& transformation,
const utility::pinned_host_vector<float>& intensities);

template LaserScanBuffer& LaserScanBuffer::AddRanges(
const thrust::host_vector<float>& ranges,
const Eigen::Matrix4f& transformation,
const thrust::host_vector<float>& intensities);


class ContainerLikePtr {
public:
Expand Down
11 changes: 11 additions & 0 deletions src/cupoch/geometry/occupancygrid.cu
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,17 @@ OccupancyGrid& OccupancyGrid::Insert(
return Insert(dev_points, viewpoint, max_range);
}

OccupancyGrid& OccupancyGrid::Insert(
const thrust::host_vector<Eigen::Vector3f>& points,
const Eigen::Vector3f& viewpoint,
float max_range) {
utility::device_vector<Eigen::Vector3f> dev_points(points.size());
cudaSafeCall(cudaMemcpy(
thrust::raw_pointer_cast(dev_points.data()), thrust::raw_pointer_cast(points.data()),
points.size() * sizeof(Eigen::Vector3f), cudaMemcpyHostToDevice));
return Insert(dev_points, viewpoint, max_range);
}

OccupancyGrid& OccupancyGrid::Insert(const geometry::PointCloud& pointcloud,
const Eigen::Vector3f& viewpoint,
float max_range) {
Expand Down
4 changes: 4 additions & 0 deletions src/cupoch/geometry/occupancygrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ class OccupancyGrid : public DenseGrid<OccupancyVoxel> {
const utility::pinned_host_vector<Eigen::Vector3f>& points,
const Eigen::Vector3f& viewpoint,
float max_range = -1.0);
OccupancyGrid& Insert(
const thrust::host_vector<Eigen::Vector3f>& points,
const Eigen::Vector3f& viewpoint,
float max_range = -1.0);
OccupancyGrid& Insert(const PointCloud& pointcloud,
const Eigen::Vector3f& viewpoint,
float max_range = -1.0);
Expand Down
6 changes: 2 additions & 4 deletions src/cupoch/integration/scalable_tsdfvolume.cu
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ __global__ void OpenVolumeUnitKernel(const Eigen::Vector3f *points,
struct extract_pointcloud_functor {
extract_pointcloud_functor(
const VolumeUnitsMap &volume_units,
const stdgpu::device_indexed_range<const VolumeUnitsMap::value_type>
&range,
int resolution,
float voxel_length,
float volume_unit_length,
Expand All @@ -135,7 +133,7 @@ struct extract_pointcloud_functor {
Eigen::Vector3f *normals,
Eigen::Vector3f *colors)
: volume_units_(volume_units),
range_(range),
range_(volume_units.device_range()),
resolution_(resolution),
voxel_length_(voxel_length),
half_voxel_length_(0.5 * voxel_length_),
Expand Down Expand Up @@ -363,7 +361,7 @@ std::shared_ptr<geometry::PointCloud> ScalableTSDFVolume::ExtractPointCloud() {
pointcloud->normals_.resize(3 * n_total, nanvec);
pointcloud->colors_.resize(3 * n_total, nanvec);
extract_pointcloud_functor func(
impl_->volume_units_, impl_->volume_units_.device_range(),
impl_->volume_units_,
resolution_, voxel_length_, volume_unit_length_, color_type_,
thrust::raw_pointer_cast(pointcloud->points_.data()),
thrust::raw_pointer_cast(pointcloud->normals_.data()),
Expand Down
Loading

0 comments on commit fc42a5e

Please sign in to comment.