Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lennard Hofmann
RobotAPI
Commits
8647e8af
Commit
8647e8af
authored
8 years ago
by
Mirko Wächter
Browse files
Options
Downloads
Patches
Plain Diff
trajectory doc
parent
80194304
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
source/RobotAPI/libraries/core/Trajectory.h
+9
-0
9 additions, 0 deletions
source/RobotAPI/libraries/core/Trajectory.h
source/RobotAPI/libraries/core/test/TrajectoryTest.cpp
+24
-0
24 additions, 0 deletions
source/RobotAPI/libraries/core/test/TrajectoryTest.cpp
with
33 additions
and
0 deletions
source/RobotAPI/libraries/core/Trajectory.h
+
9
−
0
View file @
8647e8af
...
...
@@ -72,6 +72,10 @@ namespace armarx
* Basic usage:
* @snippet RobotAPI/libraries/core/test/TrajectoryTest.cpp TrajectoryDocumentation BasicUsage
*
* The trajectory offers normal iterator capabilities:
* @snippet RobotAPI/libraries/core/test/TrajectoryTest.cpp TrajectoryDocumentation IteratorUsage
* @note Only const iterators are currently available.
*
* With the iterators it can be used like a std container:
* @snippet RobotAPI/libraries/core/test/TrajectoryTest.cpp TrajectoryDocumentation CopyIf
*/
...
...
@@ -194,6 +198,11 @@ namespace armarx
void
removeDerivation
(
size_t
dimension
,
size_t
derivation
);
// iterators
/**
* @brief Iterators that iterates in incremental order of the timestamps through the trajectory.
* @note Only const versions are available currently.
* @see end(), rbegin(), rend()
*/
typename
ordered_view
::
const_iterator
begin
()
const
;
typename
ordered_view
::
const_iterator
end
()
const
;
typename
ordered_view
::
const_reverse_iterator
rbegin
()
const
;
...
...
This diff is collapsed.
Click to expand it.
source/RobotAPI/libraries/core/test/TrajectoryTest.cpp
+
24
−
0
View file @
8647e8af
...
...
@@ -135,6 +135,30 @@ BOOST_AUTO_TEST_CASE(TrajectoryBasicUsage)
//! [TrajectoryDocumentation BasicUsage]
ARMARX_INFO_S
<<
VAROUT
(
pos
)
<<
VAROUT
(
positions
);
}
BOOST_AUTO_TEST_CASE
(
TrajectoryIteratorUsage
)
{
Ice
::
DoubleSeq
myPositionValues
{
0
,
5
,
1
};
// fill with your values;
Ice
::
DoubleSeq
timestamps
=
Trajectory
::
GenerateTimestamps
(
0
,
1
,
1.0
/
(
myPositionValues
.
size
()
-
1
));
// if you dont have timestamps
TrajectoryPtr
trajectory
(
new
Trajectory
);
trajectory
->
addDimension
(
timestamps
,
myPositionValues
,
"Shoulder 1 L"
);
//! [TrajectoryDocumentation IteratorUsage]
Trajectory
::
ordered_view
::
iterator
it
;
// or just auto it;
it
=
trajectory
->
begin
();
for
(;
it
!=
trajectory
->
end
();
it
++
)
{
const
Trajectory
::
TrajData
&
data
=
*
it
;
ARMARX_INFO_S
<<
"Position at "
<<
data
.
getTimestamp
()
<<
" :"
<<
data
.
getPosition
(
0
);
}
// or with c++11 for loop:
for
(
const
Trajectory
::
TrajData
&
element
:
*
trajectory
)
{
ARMARX_INFO_S
<<
"Position at "
<<
element
.
getTimestamp
()
<<
" :"
<<
element
.
getPosition
(
0
);
}
//! [TrajectoryDocumentation IteratorUsage]
}
BOOST_AUTO_TEST_CASE
(
testInplaceDerivation2
)
{
...
...
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