Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
curves
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jason Chemin
curves
Commits
82884af0
Commit
82884af0
authored
Apr 05, 2017
by
Steve Tonneau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spline_constraint is now a generic curve constraint
parent
86554a37
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
28 deletions
+54
-28
include/spline/curve_constraint.h
include/spline/curve_constraint.h
+36
-0
include/spline/spline_deriv_constraint.h
include/spline/spline_deriv_constraint.h
+2
-13
python/spline_python.cpp
python/spline_python.cpp
+14
-13
python/test/test.py
python/test/test.py
+2
-2
No files found.
include/spline/curve_constraint.h
0 → 100644
View file @
82884af0
/**
* \file curve_constraint.h
* \brief struct to define constraints on start / end velocities and acceleration
* on a curve
* \author Steve T.
* \version 0.1
* \date 04/05/2017
*
*/
#ifndef _CLASS_CURVE_CONSTRAINT
#define _CLASS_CURVE_CONSTRAINT
#include "MathDefs.h"
#include <functional>
#include <vector>
namespace
spline
{
template
<
typename
Point
>
struct
curve_constraints
{
typedef
Point
point_t
;
curve_constraints
()
:
init_vel
(
point_t
::
Zero
()),
init_acc
(
init_vel
),
end_vel
(
init_vel
),
end_acc
(
init_vel
){}
~
curve_constraints
(){}
point_t
init_vel
;
point_t
init_acc
;
point_t
end_vel
;
point_t
end_acc
;
};
}
#endif //_CLASS_CUBICZEROVELACC
include/spline/spline_deriv_constraint.h
View file @
82884af0
...
...
@@ -21,6 +21,7 @@
#define _CLASS_CUBICZEROVELACC
#include "exact_cubic.h"
#include "curve_constraint.h"
#include "MathDefs.h"
...
...
@@ -53,19 +54,7 @@ struct spline_deriv_constraint : public exact_cubic<Time, Numeric, Dim, Safe, Po
typedef
typename
std
::
vector
<
spline_t
>
t_spline_t
;
typedef
typename
t_spline_t
::
iterator
it_spline_t
;
typedef
typename
t_spline_t
::
const_iterator
cit_spline_t
;
public:
struct
spline_constraints
{
spline_constraints
()
:
init_vel
(
point_t
::
Zero
()),
init_acc
(
init_vel
),
end_vel
(
init_vel
),
end_acc
(
init_vel
){}
~
spline_constraints
(){}
point_t
init_vel
;
point_t
init_acc
;
point_t
end_vel
;
point_t
end_acc
;
};
typedef
curve_constraints
<
point_t
>
spline_constraints
;
/* Constructors - destructors */
public:
...
...
python/spline_python.cpp
View file @
82884af0
...
...
@@ -2,6 +2,7 @@
#include "spline/spline_curve.h"
#include "spline/exact_cubic.h"
#include "spline/spline_deriv_constraint.h"
#include "spline/curve_constraint.h"
#include <vector>
...
...
@@ -36,14 +37,14 @@ typedef std::vector<waypoint_t, Eigen::aligned_allocator<point_t> > t_waypoint_t
typedef
spline
::
spline_deriv_constraint
<
real
,
real
,
3
,
true
,
point_t
,
t_point_t
>
spline_deriv_constraint_t
;
typedef
spline
_deriv_constraint_t
::
spline_constraints
splin
e_constraints_t
;
typedef
spline
::
curve_constraints
<
point_t
>
curv
e_constraints_t
;
/*** TEMPLATE SPECIALIZATION FOR PYTHON ****/
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION
(
bezier_t
)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION
(
bezier6_t
)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION
(
spline_curve_t
)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION
(
exact_cubic_t
)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION
(
splin
e_constraints_t
)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION
(
curv
e_constraints_t
)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION
(
spline_deriv_constraint_t
)
namespace
spline
...
...
@@ -118,7 +119,7 @@ exact_cubic_t* wrapExactCubicConstructor(const coeff_t& array, const time_waypoi
}
spline_deriv_constraint_t
*
wrapSplineDerivConstraint
(
const
coeff_t
&
array
,
const
time_waypoints_t
&
time_wp
,
const
splin
e_constraints_t
&
constraints
)
spline_deriv_constraint_t
*
wrapSplineDerivConstraint
(
const
coeff_t
&
array
,
const
time_waypoints_t
&
time_wp
,
const
curv
e_constraints_t
&
constraints
)
{
t_waypoint_t
wps
=
getWayPoints
(
array
,
time_wp
);
return
new
spline_deriv_constraint_t
(
wps
.
begin
(),
wps
.
end
(),
constraints
);
...
...
@@ -130,42 +131,42 @@ spline_deriv_constraint_t* wrapSplineDerivConstraintNoConstraints(const coeff_t&
return
new
spline_deriv_constraint_t
(
wps
.
begin
(),
wps
.
end
());
}
point_t
get_init_vel
(
const
splin
e_constraints_t
&
c
)
point_t
get_init_vel
(
const
curv
e_constraints_t
&
c
)
{
return
c
.
init_vel
;
}
point_t
get_init_acc
(
const
splin
e_constraints_t
&
c
)
point_t
get_init_acc
(
const
curv
e_constraints_t
&
c
)
{
return
c
.
init_acc
;
}
point_t
get_end_vel
(
const
splin
e_constraints_t
&
c
)
point_t
get_end_vel
(
const
curv
e_constraints_t
&
c
)
{
return
c
.
end_vel
;
}
point_t
get_end_acc
(
const
splin
e_constraints_t
&
c
)
point_t
get_end_acc
(
const
curv
e_constraints_t
&
c
)
{
return
c
.
end_acc
;
}
void
set_init_vel
(
splin
e_constraints_t
&
c
,
const
point_t
&
val
)
void
set_init_vel
(
curv
e_constraints_t
&
c
,
const
point_t
&
val
)
{
c
.
init_vel
=
val
;
}
void
set_init_acc
(
splin
e_constraints_t
&
c
,
const
point_t
&
val
)
void
set_init_acc
(
curv
e_constraints_t
&
c
,
const
point_t
&
val
)
{
c
.
init_acc
=
val
;
}
void
set_end_vel
(
splin
e_constraints_t
&
c
,
const
point_t
&
val
)
void
set_end_vel
(
curv
e_constraints_t
&
c
,
const
point_t
&
val
)
{
c
.
end_vel
=
val
;
}
void
set_end_acc
(
splin
e_constraints_t
&
c
,
const
point_t
&
val
)
void
set_end_acc
(
curv
e_constraints_t
&
c
,
const
point_t
&
val
)
{
c
.
end_acc
=
val
;
}
...
...
@@ -247,8 +248,8 @@ BOOST_PYTHON_MODULE(spline)
/** BEGIN spline constraints**/
class_
<
splin
e_constraints_t
>
(
"
splin
e_constraints"
,
init
<>
())
class_
<
curv
e_constraints_t
>
(
"
curv
e_constraints"
,
init
<>
())
.
add_property
(
"init_vel"
,
&
get_init_vel
,
&
set_init_vel
)
.
add_property
(
"init_acc"
,
&
get_init_acc
,
&
set_init_acc
)
.
add_property
(
"end_vel"
,
&
get_end_vel
,
&
set_end_vel
)
...
...
python/test/test.py
View file @
82884af0
from
spline
import
bezier
,
spline
,
exact_cubic
,
spline_constraints
,
splin
e_constraints
,
spline_deriv_constraint
from
spline
import
bezier
,
spline
,
exact_cubic
,
curv
e_constraints
,
spline_deriv_constraint
from
numpy
import
matrix
...
...
@@ -50,7 +50,7 @@ assert((a.derivate(0.4,0) == a(0.4)).all())
a
.
derivate
(
0.4
,
2
)
#testing spline_deriv_constraints
c
=
splin
e_constraints
();
c
=
curv
e_constraints
();
c
.
init_vel
;
c
.
end_vel
;
c
.
init_acc
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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