Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
btalb committed Jul 12, 2022
2 parents fe30b3d + 464147f commit 750178f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ ros/src/py_detector/py_detector/weights/yolov3.weights
.python-version

compile_commands.json

*.log
*.so
6 changes: 2 additions & 4 deletions gtsam_quadrics/gtsam_quadrics.i
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

namespace gtsam_quadrics {

#include <gtsam/nonlinear/NonlinearFactor.h>
#include <gtsam_quadrics/base/Utilities.h>
namespace utils {
gtsam::Pose3 interpolate(const gtsam::Pose3& p1, const gtsam::Pose3& p2,
Expand Down Expand Up @@ -81,7 +80,7 @@ class ConstrainedDualQuadric {
};

#include <gtsam_quadrics/geometry/BoundingBoxFactor.h>
virtual class BoundingBoxFactor : gtsam::NoiseModelFactor {
virtual class BoundingBoxFactor {
BoundingBoxFactor();
BoundingBoxFactor(const gtsam_quadrics::AlignedBox2& measured,
const gtsam::Cal3_S2* calibration, const size_t& poseKey,
Expand Down Expand Up @@ -109,14 +108,13 @@ virtual class BoundingBoxFactor : gtsam::NoiseModelFactor {
};

#include <gtsam_quadrics/geometry/QuadricAngleFactor.h>
virtual class QuadricAngleFactor : gtsam::NoiseModelFactor {
virtual class QuadricAngleFactor {
QuadricAngleFactor(const size_t& quadricKey, const gtsam::Rot3& measured,
const gtsam::noiseModel::Base* model);
Vector evaluateError(
const gtsam_quadrics::ConstrainedDualQuadric& quadric) const;
};

#include <gtsam/nonlinear/PriorFactor.h>
// TODO need to figure out how to get this to import...
// template <T = {gtsam_quadrics::ConstrainedDualQuadric}>
// virtual class gtsam::PriorFactor : gtsam::NoiseModelFactor {
Expand Down
34 changes: 20 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,50 @@ class cmake_build_ext(build_ext):

def run(self):
self.build_cmake(self.extensions)
super().run()
# super().run()

def build_cmake(self, exts):
# This code assumes 'gtsam' & 'gtsam_quadrics' extensions are specified
# in that order...
gtsam_ext = exts[0]
gtsam_quadrics_ext = exts[1]

gtsam_so = self.get_ext_filename(gtsam_ext.name)
gtsam_quadrics_so = self.get_ext_filename(gtsam_quadrics_ext.name)

# Build our CPython shared objects
source_dir = os.getcwd()
build_dir = self.build_temp
build_lib_dir = self.build_lib

self.spawn([
'cmake', '-DBUILD_SHARED_LIBS=OFF',
'cmake', '-DBUILD_SHARED_LIBS=OFF', '-UCMAKE_MAKE_PROGRAM',
'-DCMAKE_POSITION_INDEPENDENT_CODE=ON', '-G', 'Ninja', '-B',
build_dir, '-S', source_dir
])
self.spawn(['cmake', '--build', build_dir])

# Move shared objects to the expected output location
lib_dir = os.path.dirname(self.get_ext_fullpath(gtsam_ext.name))
os.makedirs(lib_dir, exist_ok=True)

# Move shared objects to the build lib location
# TODO probably should just output them there from CMake... but eh
shutil.copy(
os.path.join(build_dir, 'gtsam', 'python', 'gtsam',
self.get_ext_filename(gtsam_ext.name)),
self.get_ext_fullpath(gtsam_ext.name))
shutil.copy(
os.path.join(build_dir,
self.get_ext_filename(gtsam_quadrics_ext.name)),
self.get_ext_fullpath(gtsam_quadrics_ext.name))
os.path.join(build_dir, 'gtsam', 'python', 'gtsam', gtsam_so),
os.path.join(build_lib_dir, gtsam_so))
shutil.copy(os.path.join(build_dir, gtsam_quadrics_so),
os.path.join(build_lib_dir, gtsam_quadrics_so))

# Move shared objects to the shared source location
# TODO probably should be behind an '--inplace' flag or something...
shutil.copy(os.path.join(build_lib_dir, gtsam_so),
os.path.join(source_dir, gtsam_so))
shutil.copy(os.path.join(build_lib_dir, gtsam_quadrics_so),
os.path.join(source_dir, gtsam_quadrics_so))


with open("README.md", 'r') as f:
long_description = f.read()

setup(name='gtsam_quadrics',
version='0.2.0',
version='0.2.1',
author='Lachlan Nicholson',
author_email='[email protected]',
maintainer='Ben Talbot',
Expand Down

0 comments on commit 750178f

Please sign in to comment.