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
f5d7beae
Commit
f5d7beae
authored
8 years ago
by
Steve Tonneau
Browse files
Options
Downloads
Patches
Plain Diff
finished effector_rotation_spline
parent
c0022298
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/bezier_curve.h
+3
-3
3 additions, 3 deletions
include/spline/bezier_curve.h
include/spline/helpers/effector_spline_rotation.h
+4
-4
4 additions, 4 deletions
include/spline/helpers/effector_spline_rotation.h
src/tests/spline_test/Main.cpp
+30
-6
30 additions, 6 deletions
src/tests/spline_test/Main.cpp
with
37 additions
and
13 deletions
include/spline/bezier_curve.h
+
3
−
3
View file @
f5d7beae
...
...
@@ -43,7 +43,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
In
it
(
PointsBegin
);
if
(
Safe
&&
(
size_
<=
1
||
minBound
==
maxBound
))
{
throw
;
// TODO
throw
std
::
out_of_range
(
"TODO"
)
;
// TODO
}
for
(;
it
!=
PointsEnd
;
++
it
)
{
...
...
@@ -72,8 +72,8 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
num_t
nT
=
(
t
-
minBound_
)
/
(
maxBound_
-
minBound_
);
if
(
Safe
&!
(
0
<=
nT
&&
nT
<=
1
))
{
//throw
; // TODO
}
throw
std
::
out_of_range
(
"TODO"
)
;
// TODO
}
else
{
num_t
dt
=
(
1
-
nT
);
...
...
This diff is collapsed.
Click to expand it.
include/spline/helpers/effector_spline_rotation.h
+
4
−
4
View file @
f5d7beae
...
...
@@ -101,13 +101,13 @@ class effector_spline_rotation
/// \param t : the time when to evaluate the spline
/// \param quat : quaternion updated as the interpolation result
///
quat_t
interpolate_quat
(
time_t
t
)
const
quat_t
interpolate_quat
(
Numeric
t
)
const
{
if
(
t
<=
time_lift_offset_
)
return
quat_t
(
to_quat_
.
coeffs
()
.
data
())
;
if
(
t
>=
time_land_offset_
)
return
quat_t
(
land_quat_
.
coeffs
()
.
data
())
;
if
(
t
<=
time_lift_offset_
)
return
to_quat_
.
coeffs
();
if
(
t
>=
time_land_offset_
)
return
land_quat_
.
coeffs
();
//normalize u
Numeric
u
=
(
t
-
time_lift_offset_
)
/
(
time_land_offset_
-
time_lift_offset_
);
return
quat_t
(
to_quat_
.
slerp
(
u
,
land_quat_
).
coeffs
()
.
data
())
;
return
to_quat_
.
slerp
(
u
,
land_quat_
).
coeffs
();
}
/*Operations*/
...
...
This diff is collapsed.
Click to expand it.
src/tests/spline_test/Main.cpp
+
30
−
6
View file @
f5d7beae
...
...
@@ -451,19 +451,43 @@ void EffectorSplineRotationNoRotationTest(bool& error)
ComparePoints
(
q_end
,
eff_traj
(
10
),
errmsg
,
error
);
}
void
EffectorSplineRotationRotationTest
(
bool
&
error
)
{
// create arbitrary trajectory
spline
::
T_Waypoint
waypoints
;
for
(
double
i
=
0
;
i
<=
10
;
i
=
i
+
2
)
{
waypoints
.
push_back
(
std
::
make_pair
(
i
,
point_t
(
i
,
i
,
i
)));
}
helpers
::
quat_t
init_quat
=
GetXRotQuat
(
M_PI
);
helpers
::
effector_spline_rotation
eff_traj
(
waypoints
.
begin
(),
waypoints
.
end
(),
init_quat
);
helpers
::
config_t
q_init
=
helpers
::
config_t
::
Zero
();
q_init
.
tail
<
4
>
()
=
init_quat
;
helpers
::
config_t
q_end
;
q_end
<<
10.
,
10.
,
10.
,
0.
,
0.
,
0.
,
1.
;
helpers
::
config_t
q_to
=
q_init
;
q_to
(
2
)
+=
0.02
;
helpers
::
config_t
q_land
=
q_end
;
q_land
(
2
)
+=
0.02
;
helpers
::
quat_t
q_mod
=
GetXRotQuat
(
M_PI_2
);;
std
::
string
errmsg
(
"Error in EffectorSplineRotationNoRotationTest; while checking waypoints (expected / obtained)"
);
ComparePoints
(
q_init
,
eff_traj
(
0
),
errmsg
,
error
);
ComparePoints
(
q_to
,
eff_traj
(
0.02
),
errmsg
,
error
);
ComparePoints
(
q_land
,
eff_traj
(
9.98
),
errmsg
,
error
);
ComparePoints
(
q_mod
,
eff_traj
(
5
).
tail
<
4
>
(),
errmsg
,
error
);
ComparePoints
(
q_end
,
eff_traj
(
10
),
errmsg
,
error
);
}
int
main
(
int
/*argc*/
,
char
**
/*argv[]*/
)
{
std
::
cout
<<
"performing tests...
\n
"
;
bool
error
=
false
;
std
::
cout
<<
"performing tests...
\n
"
;
bool
error
=
false
;
CubicFunctionTest
(
error
);
ExactCubicNoErrorTest
(
error
);
ExactCubicPointsCrossedTest
(
error
);
// checks that given wayPoints are crossed
ExactCubicTwoPointsTest
(
error
);
ExactCubicNoErrorTest
(
error
);
ExactCubicPointsCrossedTest
(
error
);
// checks that given wayPoints are crossed
ExactCubicTwoPointsTest
(
error
);
ExactCubicOneDimTest
(
error
);
ExactCubicVelocityConstraintsTest
(
error
);
EffectorTrajectoryTest
(
error
);
EffectorSplineRotationNoRotationTest
(
error
);
//BezierCurveTest(error);
EffectorSplineRotationRotationTest
(
error
);
BezierCurveTest
(
error
);
if
(
error
)
{
std
::
cout
<<
"There were some errors
\n
"
;
...
...
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