Skip to content

Commit 92f3539

Browse files
committed
Clean and publish
1 parent 47fcd29 commit 92f3539

12 files changed

+134
-108
lines changed

.travis.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
dist: trusty
2+
language: python
3+
matrix:
4+
include:
5+
- python: 3.4
6+
env: NUMPY=1.10
7+
- python: 3.5
8+
env: NUMPY=1.11 RUN_COVERAGE=yes
9+
- python: 3.6
10+
env: NUMPY=1.13
11+
# - os: osx
12+
# python: 3.6
13+
# env: NUMPY=1.12 BUILD_DOC=yes
14+
15+
branches:
16+
only:
17+
- master
18+
# - travis
19+
20+
before_install:
21+
#### Install Miniconda ####
22+
- unamestr=`uname`
23+
- if [[ "$unamestr" == 'Linux' ]]; then
24+
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
25+
elif [[ "$unamestr" == 'Darwin' ]]; then
26+
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
27+
else
28+
echo Error;
29+
fi
30+
- chmod +x miniconda.sh
31+
- ./miniconda.sh -b
32+
- export PATH=$HOME/miniconda3/bin:$PATH
33+
- conda config --set always_yes yes --set changeps1 no
34+
- conda update -q conda
35+
# Useful for debugging any issues with conda
36+
- conda info -a
37+
- conda create -q -n travis python=$TRAVIS_PYTHON_VERSION numpy=$NUMPY pytest cython
38+
- source activate travis
39+
- if [ "$RUN_COVERAGE" == "yes" ]; then pip install coveralls pytest-cov -q; fi
40+
41+
install:
42+
- pip install .
43+
44+
script:
45+
- if [ "$RUN_COVERAGE" == "yes" ]; then
46+
py.test test/ --cov;
47+
else
48+
py.test test/;
49+
fi
50+
51+
after_success:
52+
- if [ "$RUN_COVERAGE" == "yes" ]; then coveralls; fi

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2017, Jacob Zhong
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- [ ] Add unit tests and tests
22
- [ ] Implement official test codes
3-
- [ ] Add conversion between numpy array and Eigen objects
3+
- [x] Add conversion between numpy array and Eigen objects
44
- [ ] Migrate original implementations of pypcl
55
- [ ] Fix TODOs in the code
66
- [ ] Instantiate template classes to given point-type (e.g. PointXYZ)

pcl/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ python_extension_module(PointField)
1919
install(TARGETS PointField LIBRARY DESTINATION pcl)
2020

2121
add_cython_target(PointCloud CXX)
22-
add_library(PointCloud MODULE ${PointCloud} PointCloud_Impl.cxx)
22+
add_library(PointCloud MODULE ${PointCloud})
2323
target_link_libraries(PointCloud ${PCL_LIBRARIES})
2424
python_extension_module(PointCloud)
2525
install(TARGETS PointCloud LIBRARY DESTINATION pcl)

pcl/PointCloud.hpp

Lines changed: 0 additions & 38 deletions
This file was deleted.

pcl/PointCloud.pxd

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,3 @@ cdef public class PointCloud[object CyPointCloud, type CyPointCloud_py]:
1313
cdef Quaternionf _orientation
1414
cdef string _ptype
1515
cdef PCLPointCloud2* ptr(self)
16-
17-
cdef extern from "PointCloud.hpp" namespace "pcl":
18-
cdef cppclass PointCloudFused
19-
void CyTemplatize(PointCloud input, const PointCloudFused &output)
20-
void CyInstantiate(PointCloud output, PointCloudFused &input)

pcl/PointCloud.pyx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,23 @@ cdef public class PointCloud[object CyPointCloud, type CyPointCloud_py]:
243243
def __get__(self):
244244
return [field.name.decode('ascii') for field in self.ptr().fields]
245245
property sensor_orientation:
246-
''' Sensor acquisition pose (rotation). '''
246+
''' Sensor acquisition pose (rotation) in quaternion (x,y,z,w). '''
247247
def __get__(self):
248-
raise NotImplementedError()
248+
cdef float *mem_ptr = self._orientation.coeffs().data()
249+
cdef float[:] mem_view = <float[:4]>mem_ptr
250+
cdef np.ndarray arr_raw = np.asarray(mem_view)
251+
return arr_raw
252+
def __set__(self, value):
253+
self._orientation = Quaternionf(value[3], value[0], value[1], value[2])
249254
property sensor_origin:
250255
''' Sensor acquisition pose (origin/translation). '''
251256
def __get__(self):
252-
raise NotImplementedError()
257+
cdef float *mem_ptr = self._origin.data()
258+
cdef float[:] mem_view = <float[:3]>mem_ptr
259+
cdef np.ndarray arr_raw = np.asarray(mem_view)
260+
return arr_raw
261+
def __set__(self, value):
262+
self._origin = Vector4f(value[0], value[1], value[2], 0)
253263

254264
property xyz:
255265
'''
@@ -291,6 +301,8 @@ cdef public class PointCloud[object CyPointCloud, type CyPointCloud_py]:
291301
'''
292302
Get whether the point cloud is organized
293303
'''
304+
def __get__(self):
305+
return self.height > 1
294306

295307
def __len__(self):
296308
return self.ptr().width * self.ptr().height

pcl/PointCloud_Impl.cxx

Lines changed: 0 additions & 45 deletions
This file was deleted.

pcl/_eigen.pxd

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
1-
# bindings in the package will be finally combined into eigency
2-
# from eigency.core cimport *
1+
# bindings in the package could be finally combined into eigency
32

43
cdef extern from "Eigen/Eigen" namespace "Eigen" nogil:
54
cdef cppclass Vector4f:
65
Vector4f() except +
7-
Vector4f(float c0, float c1, float c2, float c3) except +
6+
Vector4f(float, float, float, float) except +
87
float *data()
9-
float& element "operator()"(int row, int col)
10-
8+
float& element "operator()"(int index)
119
@staticmethod
1210
Vector4f Zero()
1311

1412
cdef cppclass Quaternionf:
1513
Quaternionf()
16-
Quaternionf(float, float, float, float)
17-
float w()
18-
float x()
19-
float y()
20-
float z()
21-
14+
Quaternionf(float w, float x, float y, float z)
15+
Vector4f& coeffs()
2216
@staticmethod
2317
Quaternionf Identity()
2418

setup.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,26 @@
77

88
setup(
99
name="PyPCL",
10-
version="0.1.1",
11-
description="Minial PCL Binding",
10+
version="0.1.2",
11+
description="Cython bindings of Point Cloud Library (PCL) ",
12+
long_description='(see project homepage)',
1213
author='Jacob Zhong',
13-
license="MIT",
14+
author_email='cmpute@gmail.com',
15+
url='https://github.com/cmpute/pypcl',
16+
download_url='https://github.com/cmpute/pypcl/archive/master.zip',
17+
license='BSD-3-Clause',
1418
packages=['pcl'],
1519
package_data={'pcl':['*.pxd', '*/*.pxd', '__init__.pxd']},
16-
install_requires=['cython', 'eigency'],
20+
install_requires=['cython', 'scikit-build'],
21+
extras_require={'test': ['pytest']},
22+
classifiers=[
23+
'Programming Language :: C++',
24+
'Programming Language :: Cython',
25+
'Programming Language :: Python :: 3',
26+
'License :: OSI Approved :: BSD License',
27+
'Operating System :: OS Independent',
28+
'Development Status :: 2 - Pre-Alpha',
29+
'Topic :: Scientific/Engineering'
30+
],
31+
keywords=['pcl', 'pointcloud', 'numpy', 'cython', 'binding'],
1732
)

0 commit comments

Comments
 (0)