Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
ndcurves
Commits
fe6e7280
Commit
fe6e7280
authored
Apr 15, 2019
by
JasonChmn
Browse files
Change namespace and edit names in spline to curve for more generalization
parent
88ba5811
Changes
30
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
fe6e7280
...
...
@@ -5,7 +5,7 @@ INCLUDE(cmake/test.cmake)
INCLUDE
(
cmake/python.cmake
)
SET
(
PROJECT_ORG humanoid-path-planner
)
SET
(
PROJECT_NAME
hpp-spline
)
SET
(
PROJECT_NAME
curves
)
SET
(
PROJECT_DESCRIPTION
"template based classes for creating and manipulating spline and bezier curves. Comes with extra options specific to end-effector trajectories in robotics."
)
...
...
@@ -35,7 +35,7 @@ IF(BUILD_PYTHON_INTERFACE)
ENDIF
(
BUILD_PYTHON_INTERFACE
)
ADD_SUBDIRECTORY
(
include/
hpp/splin
e
)
ADD_SUBDIRECTORY
(
include/
curv
e
)
ADD_SUBDIRECTORY
(
tests
)
SETUP_PROJECT_FINALIZE
()
cmake
@
cea261e3
Compare
320c6369
...
cea261e3
Subproject commit
320c636960b03b3bad7c7a08bd2e104951f42bc3
Subproject commit
cea261e3da7d383844530070356bca76d20197a8
include/
hpp/splin
e/CMakeLists.txt
→
include/
curv
e/CMakeLists.txt
View file @
fe6e7280
...
...
@@ -15,7 +15,7 @@ SET(${PROJECT_NAME}_HEADERS
INSTALL
(
FILES
${${
PROJECT_NAME
}
_HEADERS
}
DESTINATION include/
hpp/splin
e
DESTINATION include/
curv
e
)
ADD_SUBDIRECTORY
(
helpers
)
include/
hpp/splin
e/MathDefs.h
→
include/
curv
e/MathDefs.h
View file @
fe6e7280
...
...
@@ -21,7 +21,7 @@
#include
<vector>
#include
<utility>
namespace
splin
e
{
namespace
curv
e
{
//REF: boulic et al An inverse kinematics architecture enforcing an arbitrary number of strict priority levels
template
<
typename
_Matrix_Type_
>
...
...
@@ -41,6 +41,6 @@ void PseudoInverse(_Matrix_Type_& pinvmat)
pinvmat
=
(
svd
.
matrixV
()
*
m_sigma_inv
*
svd
.
matrixU
().
transpose
());
}
}
// namespace
splin
e
}
// namespace
curv
e
#endif //_SPLINEMATH
include/
hpp/splin
e/bernstein.h
→
include/
curv
e/bernstein.h
View file @
fe6e7280
...
...
@@ -18,7 +18,7 @@
#include
<vector>
#include
<stdexcept>
namespace
splin
e
namespace
curv
e
{
///
/// \brief Computes factorial of a number
...
...
@@ -74,6 +74,6 @@ std::vector<Bern<Numeric> > makeBernstein(const unsigned int n)
res
.
push_back
(
Bern
<
Numeric
>
(
n
,
i
));
return
res
;
}
}
// namespace
splin
e
}
// namespace
curv
e
#endif //_CLASS_BERNSTEIN
include/
hpp/splin
e/bezier_curve.h
→
include/
curv
e/bezier_curve.h
View file @
fe6e7280
...
...
@@ -21,7 +21,7 @@
#include
<iostream>
namespace
splin
e
namespace
curv
e
{
/// \class BezierCurve
/// \brief Represents a Bezier curve of arbitrary dimension and order.
...
...
@@ -51,7 +51,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
,
mult_T_
(
1.
)
,
size_
(
std
::
distance
(
PointsBegin
,
PointsEnd
))
,
degree_
(
size_
-
1
)
,
bernstein_
(
splin
e
::
makeBernstein
<
num_t
>
((
unsigned
int
)
degree_
))
,
bernstein_
(
curv
e
::
makeBernstein
<
num_t
>
((
unsigned
int
)
degree_
))
{
assert
(
bernstein_
.
size
()
==
size_
);
In
it
(
PointsBegin
);
...
...
@@ -70,7 +70,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
,
mult_T_
(
1.
)
,
size_
(
std
::
distance
(
PointsBegin
,
PointsEnd
))
,
degree_
(
size_
-
1
)
,
bernstein_
(
splin
e
::
makeBernstein
<
num_t
>
((
unsigned
int
)
degree_
))
,
bernstein_
(
curv
e
::
makeBernstein
<
num_t
>
((
unsigned
int
)
degree_
))
{
assert
(
bernstein_
.
size
()
==
size_
);
In
it
(
PointsBegin
);
...
...
@@ -91,7 +91,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
,
mult_T_
(
mult_T
)
,
size_
(
std
::
distance
(
PointsBegin
,
PointsEnd
))
,
degree_
(
size_
-
1
)
,
bernstein_
(
splin
e
::
makeBernstein
<
num_t
>
((
unsigned
int
)
degree_
))
,
bernstein_
(
curv
e
::
makeBernstein
<
num_t
>
((
unsigned
int
)
degree_
))
{
assert
(
bernstein_
.
size
()
==
size_
);
In
it
(
PointsBegin
);
...
...
@@ -113,7 +113,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
,
mult_T_
(
1.
)
,
size_
(
std
::
distance
(
PointsBegin
,
PointsEnd
)
+
4
)
,
degree_
(
size_
-
1
)
,
bernstein_
(
splin
e
::
makeBernstein
<
num_t
>
((
unsigned
int
)
degree_
))
,
bernstein_
(
curv
e
::
makeBernstein
<
num_t
>
((
unsigned
int
)
degree_
))
{
if
(
Safe
&&
(
size_
<
1
||
T_
<=
0.
))
throw
std
::
out_of_range
(
"can't create bezier min bound is higher than max bound"
);
...
...
@@ -364,6 +364,6 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
return
bezier_curve_t
(
ts
.
begin
(),
ts
.
end
(),
T
);
}
};
}
}
// namespace curve
#endif //_CLASS_BEZIERCURVE
include/
hpp/splin
e/bezier_polynom_conversion.h
→
include/
curv
e/bezier_polynom_conversion.h
View file @
fe6e7280
...
...
@@ -21,7 +21,7 @@
#include
<iostream>
namespace
splin
e
namespace
curv
e
{
/// \brief Provides methods for converting a curve from a bernstein representation
/// to a polynom representation
...
...
@@ -67,6 +67,6 @@ Bezier from_polynom(const Polynom& polynom)
typedef Bezier::cit_point_t cit_point_t;
typedef Bezier::bezier_curve_t bezier_curve_t;
}*/
}
}
// namespace curve
#endif //_BEZIER_POLY_CONVERSION
include/
hpp/splin
e/cubic_spline.h
→
include/
curv
e/cubic_spline.h
View file @
fe6e7280
...
...
@@ -20,7 +20,7 @@
#include
<stdexcept>
namespace
splin
e
namespace
curv
e
{
/// \brief Creates coefficient vector of a cubic spline defined on the interval
/// [tBegin, tEnd]. It follows the equation
...
...
@@ -41,6 +41,6 @@ polynom<Time,Numeric,Dim,Safe,Point,T_Point> create_cubic(Point const& a, Point
T_Point
coeffs
=
make_cubic_vector
<
Point
,
T_Point
>
(
a
,
b
,
c
,
d
);
return
polynom
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
(
coeffs
.
begin
(),
coeffs
.
end
(),
min
,
max
);
}
}
}
// namespace curve
#endif //_STRUCT_CUBICSPLINE
include/
hpp/splin
e/curve_abc.h
→
include/
curv
e/curve_abc.h
View file @
fe6e7280
...
...
@@ -16,7 +16,7 @@
#include
<functional>
namespace
splin
e
namespace
curv
e
{
/// \struct curve_abc
/// \brief Represents a curve of dimension Dim
...
...
@@ -63,6 +63,6 @@ struct curve_abc : std::unary_function<Time, Point>
/*Helpers*/
};
}
}
// namespace curve
#endif //_STRUCT_CURVE_ABC
include/
hpp/splin
e/curve_constraint.h
→
include/
curv
e/curve_constraint.h
View file @
fe6e7280
...
...
@@ -17,7 +17,7 @@
#include
<functional>
#include
<vector>
namespace
splin
e
namespace
curv
e
{
template
<
typename
Point
>
struct
curve_constraints
...
...
@@ -32,5 +32,5 @@ struct curve_constraints
point_t
end_vel
;
point_t
end_acc
;
};
}
}
// namespace curve
#endif //_CLASS_CUBICZEROVELACC
include/
hpp/splin
e/exact_cubic.h
→
include/
curv
e/exact_cubic.h
View file @
fe6e7280
...
...
@@ -29,7 +29,7 @@
#include
<functional>
#include
<vector>
namespace
splin
e
namespace
curv
e
{
/// \class ExactCubic
/// \brief Represents a set of cubic splines defining a continuous function
...
...
@@ -198,6 +198,6 @@ struct exact_cubic : public curve_abc<Time, Numeric, Dim, Safe, Point>
t_spline_t
subSplines_
;
// const
/*Attributes*/
};
}
}
// namespace curve
#endif //_CLASS_EXACTCUBIC
include/
hpp/splin
e/helpers/CMakeLists.txt
→
include/
curv
e/helpers/CMakeLists.txt
View file @
fe6e7280
...
...
@@ -5,5 +5,5 @@ SET(${PROJECT_NAME}_HELPERS_HEADERS
INSTALL
(
FILES
${${
PROJECT_NAME
}
_HELPERS_HEADERS
}
DESTINATION include/
hpp/splin
e/helpers
DESTINATION include/
curv
e/helpers
)
include/
hpp/splin
e/helpers/effector_spline.h
→
include/
curv
e/helpers/effector_spline.h
View file @
fe6e7280
...
...
@@ -20,9 +20,9 @@
#ifndef _CLASS_EFFECTORSPLINE
#define _CLASS_EFFECTORSPLINE
#include
"
hpp/splin
e/spline_deriv_constraint.h"
#include
"
curv
e/spline_deriv_constraint.h"
namespace
splin
e
namespace
curv
e
{
namespace
helpers
{
...
...
@@ -117,6 +117,6 @@ exact_cubic_t* effector_spline(
splines
.
push_back
(
end_spline
);
return
new
exact_cubic_t
(
splines
);
}
}
}
}
// namespace helpers
}
// namespace curve
#endif //_CLASS_EFFECTORSPLINE
include/
hpp/splin
e/helpers/effector_spline_rotation.h
→
include/
curv
e/helpers/effector_spline_rotation.h
View file @
fe6e7280
...
...
@@ -20,11 +20,11 @@
#ifndef _CLASS_EFFECTOR_SPLINE_ROTATION
#define _CLASS_EFFECTOR_SPLINE_ROTATION
#include
"
hpp/splin
e/helpers/effector_spline.h"
#include
"
hpp/splin
e/curve_abc.h"
#include
"
curv
e/helpers/effector_spline.h"
#include
"
curv
e/curve_abc.h"
#include
<Eigen/Geometry>
namespace
splin
e
namespace
curv
e
{
namespace
helpers
{
...
...
@@ -252,5 +252,5 @@ class effector_spline_rotation
};
}
// namespace helpers
}
// namespace
splin
e
}
// namespace
curv
e
#endif //_CLASS_EFFECTOR_SPLINE_ROTATION
include/
hpp/splin
e/linear_variable.h
→
include/
curv
e/linear_variable.h
View file @
fe6e7280
...
...
@@ -19,7 +19,7 @@
#include
<Eigen/Core>
#include
<stdexcept>
namespace
splin
e
namespace
curv
e
{
template
<
int
Dim
,
typename
Numeric
=
double
>
struct
linear_variable
{
...
...
@@ -196,6 +196,6 @@ variables<V> operator/(const variables<V>& w,const double k)
return
res
;
}
}
// namespace
splin
e
}
// namespace
curv
e
#endif //_CLASS_LINEAR_VARIABLE
include/
hpp/splin
e/polynom.h
→
include/
curv
e/polynom.h
View file @
fe6e7280
...
...
@@ -23,7 +23,7 @@
#include
<functional>
#include
<stdexcept>
namespace
splin
e
namespace
curv
e
{
/// \class polynom
/// \brief Represents a polynomf arbitrary order defined on the interval
...
...
@@ -199,6 +199,6 @@ struct polynom : public curve_abc<Time, Numeric, Dim, Safe, Point>
return
res
;
}
};
//class polynom
}
}
// namespace curve
#endif //_STRUCT_POLYNOM
include/
hpp/splin
e/quintic_spline.h
→
include/
curv
e/quintic_spline.h
View file @
fe6e7280
...
...
@@ -20,7 +20,7 @@
#include
<stdexcept>
namespace
splin
e
namespace
curv
e
{
/// \brief Creates coefficient vector of a quintic spline defined on the interval
/// [tBegin, tEnd]. It follows the equation
...
...
@@ -43,6 +43,6 @@ polynom<Time,Numeric,Dim,Safe,Point,T_Point> create_quintic(Point const& a, Poin
T_Point
coeffs
=
make_quintic_vector
<
Point
,
T_Point
>
(
a
,
b
,
c
,
d
,
e
,
f
);
return
polynom
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
(
coeffs
.
begin
(),
coeffs
.
end
(),
min
,
max
);
}
}
}
// namespace curve
#endif //_STRUCT_QUINTIC_SPLINE
include/
hpp/splin
e/spline_deriv_constraint.h
→
include/
curv
e/spline_deriv_constraint.h
View file @
fe6e7280
...
...
@@ -28,7 +28,7 @@
#include
<functional>
#include
<vector>
namespace
splin
e
namespace
curv
e
{
/// \class spline_deriv_constraint.
/// \brief Represents a set of cubic splines defining a continuous function
...
...
@@ -137,6 +137,6 @@ struct spline_deriv_constraint : public exact_cubic<Time, Numeric, Dim, Safe, Po
private:
/* Constructors - destructors */
};
}
}
// namespace curve
#endif //_CLASS_CUBICZEROVELACC
python/CMakeLists.txt
View file @
fe6e7280
...
...
@@ -3,7 +3,7 @@ STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
ADD_REQUIRED_DEPENDENCY
(
"eigenpy"
)
# Define the wrapper library that wraps our library
add_library
(
${
PY_NAME
}
SHARED
splin
e_python.cpp python_variables.cpp python_variables.h
)
add_library
(
${
PY_NAME
}
SHARED
curv
e_python.cpp python_variables.cpp python_variables.h
)
#~ target_link_libraries( centroidal_dynamics ${Boost_LIBRARIES} ${PROJECT_NAME} )
# don't prepend wrapper library name with lib
set_target_properties
(
${
PY_NAME
}
PROPERTIES PREFIX
""
)
...
...
@@ -18,4 +18,4 @@ INSTALL(
TARGETS
${
PY_NAME
}
DESTINATION
${
PYTHON_SITELIB
}
)
ADD_PYTHON_UNIT_TEST
(
"python-
splin
e"
"python/test/test.py"
"python"
)
ADD_PYTHON_UNIT_TEST
(
"python-
curv
e"
"python/test/test.py"
"python"
)
python/
splin
e_python.cpp
→
python/
curv
e_python.cpp
View file @
fe6e7280
#include
"
hpp/splin
e/bezier_curve.h"
#include
"
hpp/splin
e/polynom.h"
#include
"
hpp/splin
e/exact_cubic.h"
#include
"
hpp/splin
e/spline_deriv_constraint.h"
#include
"
hpp/splin
e/curve_constraint.h"
#include
"
hpp/splin
e/bezier_polynom_conversion.h"
#include
"
hpp/splin
e/bernstein.h"
#include
"
curv
e/bezier_curve.h"
#include
"
curv
e/polynom.h"
#include
"
curv
e/exact_cubic.h"
#include
"
curv
e/spline_deriv_constraint.h"
#include
"
curv
e/curve_constraint.h"
#include
"
curv
e/bezier_polynom_conversion.h"
#include
"
curv
e/bernstein.h"
#include
"python_definitions.h"
#include
"python_variables.h"
...
...
@@ -17,22 +17,22 @@
#include
<boost/python.hpp>
/*** TEMPLATE SPECIALIZATION FOR PYTHON ****/
using
namespace
splin
e
;
using
namespace
curv
e
;
typedef
splin
e
::
bezier_curve
<
real
,
real
,
3
,
true
,
point_t
>
bezier_t
;
typedef
splin
e
::
bezier_curve
<
real
,
real
,
6
,
true
,
point6_t
>
bezier6_t
;
typedef
splin
e
::
polynom
<
real
,
real
,
3
,
true
,
point_t
,
t_point_t
>
polynom_t
;
typedef
splin
e
::
exact_cubic
<
real
,
real
,
3
,
true
,
point_t
,
t_point_t
>
exact_cubic_t
;
typedef
curv
e
::
bezier_curve
<
real
,
real
,
3
,
true
,
point_t
>
bezier_t
;
typedef
curv
e
::
bezier_curve
<
real
,
real
,
6
,
true
,
point6_t
>
bezier6_t
;
typedef
curv
e
::
polynom
<
real
,
real
,
3
,
true
,
point_t
,
t_point_t
>
polynom_t
;
typedef
curv
e
::
exact_cubic
<
real
,
real
,
3
,
true
,
point_t
,
t_point_t
>
exact_cubic_t
;
typedef
polynom_t
::
coeff_t
coeff_t
;
typedef
std
::
pair
<
real
,
point_t
>
waypoint_t
;
typedef
std
::
vector
<
waypoint_t
,
Eigen
::
aligned_allocator
<
point_t
>
>
t_waypoint_t
;
typedef
splin
e
::
Bern
<
double
>
bernstein_t
;
typedef
curv
e
::
Bern
<
double
>
bernstein_t
;
typedef
splin
e
::
spline_deriv_constraint
<
real
,
real
,
3
,
true
,
point_t
,
t_point_t
>
spline_deriv_constraint_t
;
typedef
splin
e
::
curve_constraints
<
point_t
>
curve_constraints_t
;
typedef
splin
e
::
curve_constraints
<
point6_t
>
curve_constraints6_t
;
typedef
curv
e
::
spline_deriv_constraint
<
real
,
real
,
3
,
true
,
point_t
,
t_point_t
>
spline_deriv_constraint_t
;
typedef
curv
e
::
curve_constraints
<
point_t
>
curve_constraints_t
;
typedef
curv
e
::
curve_constraints
<
point6_t
>
curve_constraints6_t
;
/*** TEMPLATE SPECIALIZATION FOR PYTHON ****/
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION
(
bernstein_t
)
...
...
@@ -43,7 +43,7 @@ EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(exact_cubic_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION
(
curve_constraints_t
)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION
(
spline_deriv_constraint_t
)
namespace
splin
e
namespace
curv
e
{
using
namespace
boost
::
python
;
...
...
@@ -186,7 +186,7 @@ void set_end_acc(curve_constraints_t& c, const point_t& val)
BOOST_PYTHON_MODULE
(
hpp_spline
)
BOOST_PYTHON_MODULE
(
curves
)
{
/** BEGIN eigenpy init**/
eigenpy
::
enableEigenPy
();
...
...
@@ -332,4 +332,4 @@ BOOST_PYTHON_MODULE(hpp_spline)
}
}
// namespace
splin
e
}
// namespace
curv
e
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment