Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
210910794
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2021
210910794
Commits
24f0bc6e
Unverified
Commit
24f0bc6e
authored
Mar 11, 2021
by
Steven Macenski
Committed by
GitHub
Mar 11, 2021
Browse files
Options
Downloads
Patches
Plain Diff
adding precomputations of trig and offsets (#2231)
parent
febb5fe8
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
nav2_smac_planner/include/nav2_smac_planner/node_se2.hpp
+2
-0
2 additions, 0 deletions
nav2_smac_planner/include/nav2_smac_planner/node_se2.hpp
nav2_smac_planner/src/node_se2.cpp
+37
-7
37 additions, 7 deletions
nav2_smac_planner/src/node_se2.cpp
with
39 additions
and
7 deletions
nav2_smac_planner/include/nav2_smac_planner/node_se2.hpp
+
2
−
0
View file @
24f0bc6e
...
...
@@ -128,6 +128,8 @@ struct MotionTable
float
cost_penalty
;
float
reverse_penalty
;
ompl
::
base
::
StateSpacePtr
state_space
;
std
::
vector
<
std
::
vector
<
double
>>
delta_xs
;
std
::
vector
<
std
::
vector
<
double
>>
delta_ys
;
};
/**
...
...
This diff is collapsed.
Click to expand it.
nav2_smac_planner/src/node_se2.cpp
+
37
−
7
View file @
24f0bc6e
...
...
@@ -102,6 +102,22 @@ void MotionTable::initDubin(
// Create the correct OMPL state space
state_space
=
std
::
make_unique
<
ompl
::
base
::
DubinsStateSpace
>
(
search_info
.
minimum_turning_radius
);
// Precompute projection deltas
delta_xs
.
resize
(
projections
.
size
());
delta_ys
.
resize
(
projections
.
size
());
for
(
unsigned
int
i
=
0
;
i
!=
projections
.
size
();
i
++
)
{
delta_xs
[
i
].
resize
(
num_angle_quantization
);
delta_ys
[
i
].
resize
(
num_angle_quantization
);
for
(
unsigned
int
j
=
0
;
j
!=
num_angle_quantization
;
j
++
)
{
double
cos_theta
=
cos
(
bin_size
*
j
);
double
sin_theta
=
sin
(
bin_size
*
j
);
delta_xs
[
i
][
j
]
=
projections
[
i
].
_x
*
cos_theta
-
projections
[
i
].
_y
*
sin_theta
;
delta_ys
[
i
][
j
]
=
projections
[
i
].
_x
*
sin_theta
+
projections
[
i
].
_y
*
cos_theta
;
}
}
}
// http://planning.cs.uiuc.edu/node822.html
...
...
@@ -148,6 +164,22 @@ void MotionTable::initReedsShepp(
// Create the correct OMPL state space
state_space
=
std
::
make_unique
<
ompl
::
base
::
ReedsSheppStateSpace
>
(
search_info
.
minimum_turning_radius
);
// Precompute projection deltas
delta_xs
.
resize
(
projections
.
size
());
delta_ys
.
resize
(
projections
.
size
());
for
(
unsigned
int
i
=
0
;
i
!=
projections
.
size
();
i
++
)
{
delta_xs
[
i
].
resize
(
num_angle_quantization
);
delta_ys
[
i
].
resize
(
num_angle_quantization
);
for
(
unsigned
int
j
=
0
;
j
!=
num_angle_quantization
;
j
++
)
{
double
cos_theta
=
cos
(
bin_size
*
j
);
double
sin_theta
=
sin
(
bin_size
*
j
);
delta_xs
[
i
][
j
]
=
projections
[
i
].
_x
*
cos_theta
-
projections
[
i
].
_y
*
sin_theta
;
delta_ys
[
i
][
j
]
=
projections
[
i
].
_x
*
sin_theta
+
projections
[
i
].
_y
*
cos_theta
;
}
}
}
MotionPoses
MotionTable
::
getProjections
(
const
NodeSE2
*
node
)
...
...
@@ -164,15 +196,10 @@ MotionPose MotionTable::getProjection(const NodeSE2 * node, const unsigned int &
{
const
MotionPose
&
motion_model
=
projections
[
motion_index
];
//
transform delta X, Y, and Theta into local coordinates
//
normalize theta, I know its overkill, but I've been burned before...
const
float
&
node_heading
=
node
->
pose
.
theta
;
const
float
cos_theta
=
cos
(
node_heading
*
bin_size
);
// needs actual angle [0, 2PI]
const
float
sin_theta
=
sin
(
node_heading
*
bin_size
);
const
float
delta_x
=
motion_model
.
_x
*
cos_theta
-
motion_model
.
_y
*
sin_theta
;
const
float
delta_y
=
motion_model
.
_x
*
sin_theta
+
motion_model
.
_y
*
cos_theta
;
float
new_heading
=
node_heading
+
motion_model
.
_theta
;
// normalize theta
while
(
new_heading
>=
num_angle_quantization_float
)
{
new_heading
-=
num_angle_quantization_float
;
}
...
...
@@ -180,7 +207,10 @@ MotionPose MotionTable::getProjection(const NodeSE2 * node, const unsigned int &
new_heading
+=
num_angle_quantization_float
;
}
return
MotionPose
(
delta_x
+
node
->
pose
.
x
,
delta_y
+
node
->
pose
.
y
,
new_heading
);
return
MotionPose
(
delta_xs
[
motion_index
][
node_heading
]
+
node
->
pose
.
x
,
delta_ys
[
motion_index
][
node_heading
]
+
node
->
pose
.
y
,
new_heading
);
}
NodeSE2
::
NodeSE2
(
const
unsigned
int
index
)
...
...
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