Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Navigation
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Software
ArmarX
Skills
Navigation
Commits
f171f5b5
Commit
f171f5b5
authored
3 years ago
by
Fabian Reister
Browse files
Options
Downloads
Patches
Plain Diff
trajectory duration
parent
afb6fb60
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/armarx/navigation/core/Trajectory.cpp
+30
-2
30 additions, 2 deletions
source/armarx/navigation/core/Trajectory.cpp
source/armarx/navigation/core/Trajectory.h
+1
-0
1 addition, 0 deletions
source/armarx/navigation/core/Trajectory.h
with
31 additions
and
2 deletions
source/armarx/navigation/core/Trajectory.cpp
+
30
−
2
View file @
f171f5b5
...
...
@@ -585,8 +585,36 @@ namespace armarx::navigation::core
float
Trajectory
::
duration
(
const
core
::
VelocityInterpolation
interpolation
)
const
{
throw
LocalException
(
"not implemented yet"
);
return
0
;
// FIXME
float
dur
=
0
;
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
pts
.
size
()
-
1
);
i
++
)
{
const
auto
&
start
=
pts
.
at
(
i
);
const
auto
&
goal
=
pts
.
at
(
i
+
1
);
const
float
distance
=
(
goal
.
waypoint
.
pose
.
translation
()
-
start
.
waypoint
.
pose
.
translation
()).
norm
();
const
float
startVelocity
=
start
.
velocity
;
const
float
goalVelocity
=
goal
.
velocity
;
constexpr
int
nSamples
=
100
;
for
(
int
j
=
0
;
j
<
nSamples
;
j
++
)
{
const
float
progress
=
static_cast
<
float
>
(
j
)
/
nSamples
;
const
float
v
=
startVelocity
+
progress
*
(
goalVelocity
-
startVelocity
);
const
float
s
=
distance
/
nSamples
;
const
float
t
=
s
/
v
;
dur
+=
t
;
}
}
return
dur
;
}
bool
...
...
This diff is collapsed.
Click to expand it.
source/armarx/navigation/core/Trajectory.h
+
1
−
0
View file @
f171f5b5
...
...
@@ -114,6 +114,7 @@ namespace armarx::navigation::core
*/
Indices
allConnectedPointsInRange
(
std
::
size_t
idx
,
float
radius
)
const
;
private
:
std
::
vector
<
TrajectoryPoint
>
pts
;
};
...
...
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