Skip to content

Commit a806830

Browse files
committed
Merging osr with dbot
1 parent 6a1e7f7 commit a806830

21 files changed

+1435
-19
lines changed

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ endif(DBOT_BUILD_GPU AND CUDA_FOUND AND GLEW_FOUND AND OPENGL_FOUND)
108108
# Dependencies #
109109
############################
110110
# Use catkin of available otherwise fall back to native cmake
111-
find_package(catkin QUIET COMPONENTS fl osr)
111+
find_package(catkin QUIET COMPONENTS fl)
112112

113113
if(DBOT_BUILD_GPU)
114114
list(APPEND dbot_INCLUDE_DIRS ${CUDA_INCLUDE_DIRS})
@@ -125,7 +125,6 @@ if(catkin_FOUND)
125125
LIBRARIES
126126
${dbot_LIBRARIES}
127127
CATKIN_DEPENDS
128-
osr
129128
fl
130129
DEPENDS
131130
Eigen)

package.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@
88

99
<license>GNU GPL</license>
1010

11-
<url type="website">https://github.com/bayesian-object-tracking</url>
11+
<url type="website">https://github.com/bayesian-object-tracking/dbot</url>
1212

1313
<author email="manuel.wuthrich@gmail.com">Manuel Wuethrich</author>
1414
<author email="jan.issac@gmail.com">Jan Issac</author>
1515

1616
<buildtool_depend>catkin</buildtool_depend>
1717

1818
<build_depend>fl</build_depend>
19-
<build_depend>osr</build_depend>
2019
<run_depend>fl</run_depend>
21-
<run_depend>osr</run_depend>
2220

2321
<export>
2422
<!-- <metapackage/> -->

source/dbot/builder/rb_sensor_builder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* \author Jan Issac (jan.issac@gmail.com)
2828
*/
2929

30-
#include <osr/free_floating_rigid_bodies_state.hpp>
30+
#include <dbot/pose/free_floating_rigid_bodies_state.hpp>
3131

3232
#include <dbot/builder/rb_sensor_builder.h>
3333
#include <dbot/builder/rb_sensor_builder.hpp>

source/dbot/gpu/kinect_image_model_gpu.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
#include "boost/filesystem.hpp"
3838
#include "Eigen/Core"
3939

40-
#include <osr/pose_vector.hpp>
40+
#include <dbot/pose/pose_vector.hpp>
4141
#include <dbot/model/rao_blackwell_sensor.hpp>
42-
#include <osr/free_floating_rigid_bodies_state.hpp>
42+
#include <dbot/pose/free_floating_rigid_bodies_state.hpp>
4343

4444
#include <dbot/traits.hpp>
4545
#include <dbot/gpu/object_rasterizer.hpp>

source/dbot/model/depth_pixel_model.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
#include <dbot/rigid_body_renderer.hpp>
4848

49-
#include <osr/pose_hashing.hpp>
49+
#include <dbot/pose/pose_hashing.hpp>
5050

5151
namespace fl
5252
{

source/dbot/model/kinect_image_model.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333

3434
#include <Eigen/Core>
3535

36-
#include <osr/pose_vector.hpp>
36+
#include <dbot/pose/pose_vector.hpp>
3737
#include <fl/util/assertions.hpp>
3838
#include <dbot/traits.hpp>
39-
#include <osr/free_floating_rigid_bodies_state.hpp>
39+
#include <dbot/pose/free_floating_rigid_bodies_state.hpp>
4040
#include <dbot/model/rao_blackwell_sensor.hpp>
4141

4242
#include <dbot/rigid_body_renderer.hpp>

source/dbot/model/rao_blackwell_sensor.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
#include <Eigen/Core>
3232

3333
#include <fl/util/types.hpp>
34-
#include <osr/pose_vector.hpp>
35-
#include <osr/pose_velocity_vector.hpp>
36-
#include <osr/composed_vector.hpp>
37-
#include <osr/free_floating_rigid_bodies_state.hpp>
34+
#include <dbot/pose/pose_vector.hpp>
35+
#include <dbot/pose/pose_velocity_vector.hpp>
36+
#include <dbot/pose/composed_vector.hpp>
37+
#include <dbot/pose/free_floating_rigid_bodies_state.hpp>
3838

3939
namespace dbot
4040
{

source/dbot/pose/composed_vector.hpp

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* This is part of the Bayesian Object Tracking (bot),
3+
* (https://github.com/bayesian-object-tracking)
4+
*
5+
* Copyright (c) 2015 Max Planck Society,
6+
* Autonomous Motion Department,
7+
* Institute for Intelligent Systems
8+
*
9+
* This Source Code Form is subject to the terms of the GNU General Public
10+
* License License (GNU GPL). A copy of the license can be found in the LICENSE
11+
* file distributed with this source code.
12+
*/
13+
14+
/**
15+
* \file composed_vector.hpp
16+
* \date August 2015
17+
* \author Manuel Wuthrich (manuel.wuthrich@gmail.com)
18+
*/
19+
20+
#pragma once
21+
22+
#include <Eigen/Dense>
23+
24+
namespace osr
25+
{
26+
template <typename Block, typename Vector>
27+
class ComposedVector : public Vector
28+
{
29+
public:
30+
// constructor and destructor **********************************************
31+
ComposedVector() {}
32+
template <typename T>
33+
ComposedVector(const Eigen::MatrixBase<T>& vector)
34+
: Vector(vector)
35+
{
36+
}
37+
38+
virtual ~ComposedVector() noexcept {}
39+
// operators ***************************************************************
40+
template <typename T>
41+
void operator=(const Eigen::MatrixBase<T>& vector)
42+
{
43+
*((Vector*)(this)) = vector;
44+
}
45+
46+
// accessors ***************************************************************
47+
const Block component(int index) const
48+
{
49+
return Block(*this, index * Block::SizeAtCompileTime);
50+
}
51+
int count() const { return this->size() / Block::SizeAtCompileTime; }
52+
// mutators ****************************************************************
53+
Block component(int index)
54+
{
55+
return Block(*this, index * Block::SizeAtCompileTime);
56+
}
57+
void recount(int new_count)
58+
{
59+
return this->resize(new_count * Block::SizeAtCompileTime);
60+
}
61+
};
62+
}

source/dbot/pose/euler_vector.hpp

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
/*
2+
* This is part of the Bayesian Object Tracking (bot),
3+
* (https://github.com/bayesian-object-tracking)
4+
*
5+
* Copyright (c) 2015 Max Planck Society,
6+
* Autonomous Motion Department,
7+
* Institute for Intelligent Systems
8+
*
9+
* This Source Code Form is subject to the terms of the GNU General Public
10+
* License License (GNU GPL). A copy of the license can be found in the LICENSE
11+
* file distributed with this source code.
12+
*/
13+
14+
/**
15+
* \file orientation_transition.hpp
16+
* \date July 2015
17+
* \author Manuel Wuthrich (manuel.wuthrich@gmail.com)
18+
*/
19+
20+
#pragma once
21+
22+
#include <Eigen/Dense>
23+
24+
namespace osr
25+
{
26+
typedef double Real;
27+
28+
/// basic functionality for both vectors and blocks ****************************
29+
template <typename Base>
30+
class EulerBase : public Base
31+
{
32+
public:
33+
// types *******************************************************************
34+
typedef typename Base::Scalar Scalar;
35+
typedef Eigen::Matrix<Scalar, 3, 1> Axis;
36+
typedef Eigen::Matrix<Scalar, 3, 1> Vector;
37+
typedef Eigen::AngleAxis<Scalar> AngleAxis;
38+
typedef Eigen::Quaternion<Scalar> Quaternion;
39+
typedef Eigen::Matrix<Scalar, 3, 3> RotationMatrix;
40+
41+
typedef EulerBase<Eigen::Matrix<Real, 3, 1>> EulerVector;
42+
43+
// constructor and destructor **********************************************
44+
EulerBase(const Base& vector) : Base(vector) {}
45+
virtual ~EulerBase() noexcept {}
46+
// operators ***************************************************************
47+
template <typename T>
48+
void operator=(const Eigen::MatrixBase<T>& vector)
49+
{
50+
*((Base*)(this)) = vector;
51+
}
52+
53+
// accessor ****************************************************************
54+
virtual Scalar angle() const { return this->norm(); }
55+
virtual Axis axis() const
56+
{
57+
Axis ax = this->normalized();
58+
59+
if (!std::isfinite(ax.sum()))
60+
{
61+
return Axis(1, 0, 0);
62+
}
63+
return ax;
64+
}
65+
virtual AngleAxis angle_axis() const { return AngleAxis(angle(), axis()); }
66+
virtual Quaternion quaternion() const { return Quaternion(angle_axis()); }
67+
virtual RotationMatrix rotation_matrix() const
68+
{
69+
return RotationMatrix(quaternion());
70+
}
71+
virtual EulerVector inverse() const { return EulerVector(-*this); }
72+
// mutators ****************************************************************
73+
virtual void angle_axis(const Scalar& angle, const Axis& axis)
74+
{
75+
*this = angle * axis;
76+
77+
rescale();
78+
}
79+
virtual void angle_axis(const AngleAxis& ang_axis)
80+
{
81+
angle_axis(ang_axis.angle(), ang_axis.axis());
82+
}
83+
virtual void quaternion(const Quaternion& quat)
84+
{
85+
angle_axis(AngleAxis(quat));
86+
}
87+
virtual void rotation_matrix(const RotationMatrix& rot_mat)
88+
{
89+
angle_axis(AngleAxis(rot_mat));
90+
}
91+
virtual void rescale() // make sure the norm is in [0,Pi]
92+
{
93+
Scalar alpha = angle();
94+
95+
if (alpha <= M_PI)
96+
{
97+
return;
98+
}
99+
if (alpha > 2 * M_PI)
100+
{
101+
alpha -= std::floor(alpha / (2 * M_PI)) * 2 * M_PI;
102+
}
103+
if (alpha > M_PI)
104+
{
105+
alpha -= 2 * M_PI;
106+
}
107+
108+
(*this) = axis() * alpha;
109+
}
110+
111+
// operators ***************************************************************
112+
template <typename T>
113+
EulerVector operator*(const EulerBase<T>& factor)
114+
{
115+
EulerVector product(EulerVector::Zero());
116+
product.quaternion(this->quaternion() * factor.quaternion());
117+
return product;
118+
}
119+
};
120+
121+
/// implementation for vectors *************************************************
122+
class EulerVector : public EulerBase<Eigen::Matrix<Real, 3, 1>>
123+
{
124+
public:
125+
typedef EulerBase<Eigen::Matrix<Real, 3, 1>> Base;
126+
127+
// constructor and destructor **********************************************
128+
EulerVector() : Base(Base::Zero()) {}
129+
template <typename T>
130+
EulerVector(const Eigen::MatrixBase<T>& vector)
131+
: Base(vector)
132+
{
133+
}
134+
135+
virtual ~EulerVector() noexcept {}
136+
};
137+
138+
/// implementation for blocks **************************************************
139+
template <typename Vector>
140+
class EulerBlock : public EulerBase<Eigen::VectorBlock<Vector, 3>>
141+
{
142+
public:
143+
typedef Eigen::VectorBlock<Vector, 3> Block;
144+
typedef EulerBase<Block> Base;
145+
146+
using Base::operator=;
147+
148+
// constructor and destructor **********************************************
149+
EulerBlock(const Block& block) : Base(block) {}
150+
EulerBlock(Vector& vector, int start) : Base(Block(vector, start)) {}
151+
virtual ~EulerBlock() noexcept {}
152+
};
153+
}

0 commit comments

Comments
 (0)