Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
curves
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jason Chemin
curves
Commits
efe1fbc2
Commit
efe1fbc2
authored
8 years ago
by
Steve Tonneau
Browse files
Options
Downloads
Patches
Plain Diff
spline coeffs in Eigen matrix + cleaning
parent
844e49b7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/spline/exact_cubic_vel_acc_cons.h
+0
-0
0 additions, 0 deletions
include/spline/exact_cubic_vel_acc_cons.h
include/spline/spline_curve.h
+49
-37
49 additions, 37 deletions
include/spline/spline_curve.h
src/tests/spline_test/Main.cpp
+1
-1
1 addition, 1 deletion
src/tests/spline_test/Main.cpp
with
50 additions
and
38 deletions
include/spline/cubic_
zero_
vel_acc.h
→
include/spline/
exact_
cubic_vel_acc
_cons
.h
+
0
−
0
View file @
efe1fbc2
File moved
This diff is collapsed.
Click to expand it.
include/spline/spline_curve.h
+
49
−
37
View file @
efe1fbc2
...
...
@@ -35,13 +35,27 @@ template<typename Time= double, typename Numeric=Time, std::size_t Dim=3, bool S
struct
spline_curve
:
public
curve_abc
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
>
{
typedef
Point
point_t
;
typedef
T_Point
t_point_t
;
typedef
typename
t_point_t
::
const_iterator
cit_point_t
;
typedef
Time
time_t
;
typedef
Numeric
num_t
;
typedef
curve_abc
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
>
curve_abc_t
;
typedef
Eigen
::
Matrix
<
double
,
Dim
,
Eigen
::
Dynamic
>
coeff_t
;
typedef
Eigen
::
Ref
<
coeff_t
>
coeff_t_ref
;
/* Constructors - destructors */
public:
///\brief Constructor
///\param coefficients : a container containing all coefficients of the spline, starting
/// with the zero order coefficient, up to the highest order. Spline order is given
/// by the size of the coefficients
///\param min: LOWER bound on interval definition of the spline
///\param max: UPPER bound on interval definition of the spline
spline_curve
(
const
coeff_t_ref
&
coefficients
,
const
time_t
min
,
const
time_t
max
)
:
curve_abc_t
(),
coefficients_
(
coefficients
),
t_min_
(
min
),
t_max_
(
max
),
dim_
(
Dim
),
order_
(
coefficients_
.
cols
()
-
1
)
{
safe_check
();
}
///\brief Constructor
///\param coefficients : a container containing all coefficients of the spline, starting
/// with the zero order coefficient, up to the highest order. Spline order is given
...
...
@@ -50,19 +64,10 @@ struct spline_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
///\param max: UPPER bound on interval definition of the spline
spline_curve
(
const
T_Point
&
coefficients
,
const
time_t
min
,
const
time_t
max
)
:
curve_abc_t
(),
coefficients_
(
coefficients
),
t_min_
(
min
),
t_max_
(
max
),
dim_
(
Dim
),
order_
(
coefficients_
.
size
()
+
1
)
coefficients_
(
init_coeffs
(
coefficients
.
begin
(),
coefficients
.
end
())),
t_min_
(
min
),
t_max_
(
max
),
dim_
(
Dim
),
order_
(
coefficients_
.
cols
()
-
1
)
{
if
(
Safe
)
{
if
(
t_min_
>
t_max_
)
{
std
::
out_of_range
(
"TODO"
);
}
if
(
coefficients_
.
size
()
!=
order_
+
1
)
{
std
::
runtime_error
(
"Spline order and coefficients do not match"
);
}
}
safe_check
();
}
///\brief Constructor
...
...
@@ -73,20 +78,10 @@ struct spline_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
///\param max: UPPER bound on interval definition of the spline
template
<
typename
In
>
spline_curve
(
In
zeroOrderCoefficient
,
In
out
,
const
time_t
min
,
const
time_t
max
)
:
coefficients_
(
init_coeffs
(
zeroOrderCoefficient
,
out
)),
dim_
(
Dim
),
order_
(
coefficients_
.
size
()
+
1
),
:
coefficients_
(
init_coeffs
(
zeroOrderCoefficient
,
out
)),
dim_
(
Dim
),
order_
(
coefficients_
.
cols
()
-
1
),
t_min_
(
min
),
t_max_
(
max
)
{
if
(
Safe
)
{
if
(
t_min_
>
t_max_
)
{
std
::
out_of_range
(
"TODO"
);
}
if
(
coefficients_
.
size
()
!=
order_
+
1
)
{
std
::
runtime_error
(
"Spline order and coefficients do not match"
);
}
}
safe_check
();
}
///\brief Destructor
...
...
@@ -97,11 +92,25 @@ struct spline_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
spline_curve
(
const
spline_curve
&
other
)
:
t_min_
(
other
.
t_min_
),
t_max
_
(
other
.
t_max
_
)
,
coefficients_
(
other
.
coefficients
_
)
{}
:
coefficients_
(
other
.
coefficients_
),
dim_
(
other
.
dim_
),
order
_
(
other
.
order
_
)
,
t_min_
(
other
.
t_min_
),
t_max_
(
other
.
t_max
_
){}
private
:
//spline_curve& operator=(const spline_curve& other);
void
safe_check
()
{
if
(
Safe
)
{
if
(
t_min_
>
t_max_
)
{
std
::
out_of_range
(
"TODO"
);
}
if
(
coefficients_
.
size
()
!=
order_
+
1
)
{
std
::
runtime_error
(
"Spline order and coefficients do not match"
);
}
}
}
/* Constructors - destructors */
...
...
@@ -114,11 +123,10 @@ struct spline_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
{
if
((
t
<
t_min_
||
t
>
t_max_
)
&&
Safe
){
throw
std
::
out_of_range
(
"TODO"
);}
time_t
const
dt
(
t
-
t_min_
);
time_t
cdt
(
dt
);
cit_point_t
cit
=
coefficients_
.
begin
();
point_t
currentPoint_
=
*
cit
;
++
cit
;
for
(;
cit
!=
coefficients_
.
end
();
++
cit
,
cdt
*=
dt
)
currentPoint_
+=
cdt
*
(
*
cit
);
time_t
cdt
(
1
);
point_t
currentPoint_
=
point_t
::
Zero
();
for
(
int
i
=
0
;
i
<
order_
+
1
;
++
i
,
cdt
*=
dt
)
currentPoint_
+=
cdt
*
coefficients_
.
col
(
i
);
return
currentPoint_
;
}
/*Operations*/
...
...
@@ -133,7 +141,7 @@ struct spline_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
/*Attributes*/
public
:
t_point
_t
coefficients_
;
coeff
_t
coefficients_
;
std
::
size_t
dim_
;
std
::
size_t
order_
;
...
...
@@ -143,10 +151,14 @@ struct spline_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
private
:
template
<
typename
In
>
t_point
_t
init_coeffs
(
In
zeroOrderCoefficient
,
In
highestOrderCoefficient
)
coeff
_t
init_coeffs
(
In
zeroOrderCoefficient
,
In
highestOrderCoefficient
)
{
t_point_t
res
(
std
::
distance
(
zeroOrderCoefficient
,
highestOrderCoefficient
));
std
::
copy
(
zeroOrderCoefficient
,
highestOrderCoefficient
,
res
.
begin
());
std
::
size_t
size
=
std
::
distance
(
zeroOrderCoefficient
,
highestOrderCoefficient
);
coeff_t
res
=
coeff_t
(
Dim
,
size
);
int
i
=
0
;
for
(
In
cit
=
zeroOrderCoefficient
;
cit
!=
highestOrderCoefficient
;
++
cit
,
++
i
)
{
res
.
col
(
i
)
=
*
cit
;
}
return
res
;
}
};
//class spline_curve
...
...
This diff is collapsed.
Click to expand it.
src/tests/spline_test/Main.cpp
+
1
−
1
View file @
efe1fbc2
#include
"spline/exact_cubic.h"
#include
"spline/cubic_
zero_
vel_acc.h"
#include
"spline/
exact_
cubic_vel_acc
_cons
.h"
#include
"spline/bezier_curve.h"
#include
"spline/spline_curve.h"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment