Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
ndcurves
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
loco-3d
ndcurves
Commits
0a87d54b
Commit
0a87d54b
authored
8 years ago
by
Steve Tonneau
Browse files
Options
Downloads
Patches
Plain Diff
renaming constrained splines
parent
c1bb699c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/spline/spline_deriv_constraint.h
+10
-20
10 additions, 20 deletions
include/spline/spline_deriv_constraint.h
src/tests/spline_test/Main.cpp
+5
-5
5 additions, 5 deletions
src/tests/spline_test/Main.cpp
with
15 additions
and
25 deletions
include/spline/
exact_cubic_vel_acc_cons
.h
→
include/spline/
spline_deriv_constraint
.h
+
10
−
20
View file @
0a87d54b
...
...
@@ -29,17 +29,17 @@
namespace
spline
{
/// \class
cubic_zero_vel
.
/// \class
spline_deriv_constraint
.
/// \brief Represents a set of cubic splines defining a continuous function
/// crossing each of the waypoint given in its initialization. Additional constraints
/// are used to increase the order of the last
and first
spline
s
, to start and finish
/// trajectory with
zero
velocity and acceleration.
Thus the first and last splines
/// are used to increase the order of the last spline, to start and finish
/// trajectory with
user defined
velocity and acceleration.
///
///
template
<
typename
Time
=
double
,
typename
Numeric
=
Time
,
std
::
size_t
Dim
=
3
,
bool
Safe
=
false
,
typename
Point
=
Eigen
::
Matrix
<
Numeric
,
Dim
,
1
>,
typename
T_Point
=
std
::
vector
<
Point
,
Eigen
::
aligned_allocator
<
Point
>
>
>
struct
cubic_zero_vel
:
public
exact_cubic
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
struct
spline_deriv_constraint
:
public
exact_cubic
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
{
typedef
Point
point_t
;
typedef
T_Point
t_point_t
;
...
...
@@ -57,20 +57,13 @@ struct cubic_zero_vel : public exact_cubic<Time, Numeric, Dim, Safe, Point, T_Po
struct
spline_constraints
{
spline_constraints
()
:
init_vel
(
point_t
::
Zero
()),
init_acc
(
init_vel
),
end_vel
(
init_vel
),
end_acc
(
init_vel
),
init_normal
(
init_vel
),
end_normal
(
init_vel
)
{}
spline_constraints
(
const
point_t
&
n0
,
point_t
&
n1
)
:
init_vel
(
point_t
::
Zero
()),
init_acc
(
init_vel
),
end_vel
(
init_vel
),
end_acc
(
init_vel
),
init_normal
(
n0
),
end_normal
(
n1
)
{}
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
;
point_t
init_normal
;
//TODO
point_t
end_normal
;
//TODO
};
/* Constructors - destructors */
...
...
@@ -79,11 +72,11 @@ struct cubic_zero_vel : public exact_cubic<Time, Numeric, Dim, Safe, Point, T_Po
///\param wayPointsBegin : an iterator pointing to the first element of a waypoint container
///\param wayPointsEns : an iterator pointing to the end of a waypoint container
template
<
typename
In
>
cubic_zero_vel
(
In
wayPointsBegin
,
In
wayPointsEnd
,
const
spline_constraints
&
constraints
=
spline_constraints
())
spline_deriv_constraint
(
In
wayPointsBegin
,
In
wayPointsEnd
,
const
spline_constraints
&
constraints
=
spline_constraints
())
:
exact_cubic_t
(
computeWayPoints
<
In
>
(
wayPointsBegin
,
wayPointsEnd
,
constraints
))
{}
///\brief Destructor
~
cubic_zero_vel
(){}
~
spline_deriv_constraint
(){}
private
:
template
<
typename
In
>
...
...
@@ -135,11 +128,9 @@ struct cubic_zero_vel : public exact_cubic<Time, Numeric, Dim, Safe, Point, T_Po
t_spline_t
computeWayPoints
(
In
wayPointsBegin
,
In
wayPointsEnd
,
const
spline_constraints
&
constraints
)
const
{
std
::
size_t
const
size
(
std
::
distance
(
wayPointsBegin
,
wayPointsEnd
));
if
(
Safe
&&
size
<
1
)
throw
;
// TODO
if
(
Safe
&&
size
<
1
)
throw
;
// TODO
t_spline_t
subSplines
;
subSplines
.
reserve
(
size
-
1
);
spline_constraints
cons
=
constraints
;
In
it
(
wayPointsBegin
),
next
(
wayPointsBegin
),
end
(
wayPointsEnd
-
1
);
++
next
;
for
(
std
::
size_t
i
(
0
);
next
!=
end
;
++
next
,
++
it
,
++
i
)
...
...
@@ -148,10 +139,9 @@ struct cubic_zero_vel : public exact_cubic<Time, Numeric, Dim, Safe, Point, T_Po
return
subSplines
;
}
private
:
cubic_zero_vel
(
const
cubic_zero_vel
&
);
cubic_zero_vel
&
operator
=
(
const
cubic_zero_vel
&
);
spline_deriv_constraint
(
const
spline_deriv_constraint
&
);
spline_deriv_constraint
&
operator
=
(
const
spline_deriv_constraint
&
);
/* Constructors - destructors */
/*Attributes*/
public
:
...
...
This diff is collapsed.
Click to expand it.
src/tests/spline_test/Main.cpp
+
5
−
5
View file @
0a87d54b
#include
"spline/exact_cubic.h"
#include
"spline/exact_cubic_vel_acc_cons.h"
#include
"spline/bezier_curve.h"
#include
"spline/spline_curve.h"
#include
"spline/spline_deriv_constraint.h"
#include
<string>
#include
<iostream>
...
...
@@ -16,9 +16,9 @@ typedef Eigen::Vector3d point_t;
typedef
std
::
vector
<
point_t
,
Eigen
::
aligned_allocator
<
point_t
>
>
t_point_t
;
typedef
spline_curve
<
double
,
double
,
3
,
true
,
point_t
,
t_point_t
>
cubic_function_t
;
typedef
exact_cubic
<
double
,
double
,
3
,
true
,
point_t
>
exact_cubic_t
;
typedef
cubic_zero_vel
<
double
,
double
,
3
,
true
,
point_t
>
cubic_zero_vel
_t
;
typedef
spline_deriv_constraint
<
double
,
double
,
3
,
true
,
point_t
>
spline_deriv_constraint
_t
;
typedef
bezier_curve
<
double
,
double
,
3
,
true
,
point_t
>
bezier_curve_t
;
typedef
cubic_zero_vel
_t
::
spline_constraints
spline_constraints_t
;
typedef
spline_deriv_constraint
_t
::
spline_constraints
spline_constraints_t
;
typedef
std
::
pair
<
double
,
point_t
>
Waypoint
;
typedef
std
::
vector
<
Waypoint
>
T_Waypoint
;
...
...
@@ -352,7 +352,7 @@ void ExactCubicVelocityConstraintsTest(bool& error)
}
std
::
string
errmsg
(
"Error in ExactCubicVelocityConstraintsTest (1)
;
while
checking
that
given
wayPoints
are
crossed
(
expected
/
obtained
)
")
;
spline_constraints_t
constraints
;
cubic_zero_vel
_t
exactCubic
(
waypoints
.
begin
(),
waypoints
.
end
());
spline_deriv_constraint
_t
exactCubic
(
waypoints
.
begin
(),
waypoints
.
end
());
// now check that init and end velocity are 0
CheckWayPointConstraint
(
errmsg
,
0.2
,
waypoints
,
&
exactCubic
,
error
);
std
::
string
errmsg3
(
"Error in ExactCubicVelocityConstraintsTest (2)
;
while
checking
derivative
(
expected
/
obtained
)
")
;
...
...
@@ -367,7 +367,7 @@ void ExactCubicVelocityConstraintsTest(bool& error)
constraints
.
end_acc
=
point_t
(
4
,
5
,
6
);
constraints
.
init_acc
=
point_t
(
-
4
,
-
4
,
-
6
);
std
::
string
errmsg2
(
"Error in ExactCubicVelocityConstraintsTest (3)
;
while
checking
that
given
wayPoints
are
crossed
(
expected
/
obtained
)
")
;
cubic_zero_vel
_t
exactCubic2
(
waypoints
.
begin
(),
waypoints
.
end
(),
constraints
);
spline_deriv_constraint
_t
exactCubic2
(
waypoints
.
begin
(),
waypoints
.
end
(),
constraints
);
CheckWayPointConstraint
(
errmsg2
,
0.2
,
waypoints
,
&
exactCubic2
,
error
);
std
::
string
errmsg4
(
"Error in ExactCubicVelocityConstraintsTest (4)
;
while
checking
derivative
(
expected
/
obtained
)
")
;
...
...
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