Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wolf_ros_laser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
mobile_robotics
wolf_projects
wolf_ros
wolf_ros_laser
Commits
76abe000
Commit
76abe000
authored
4 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
added extrinsics to the pointcloud and occgrid computation
parent
427c7dcd
No related branches found
No related tags found
2 merge requests
!4
new release
,
!3
New release
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/publisher_laser_map.cpp
+11
-3
11 additions, 3 deletions
src/publisher_laser_map.cpp
with
11 additions
and
3 deletions
src/publisher_laser_map.cpp
+
11
−
3
View file @
76abe000
...
...
@@ -19,6 +19,8 @@ PublisherLaserMap::PublisherLaserMap(const std::string& _unique_name,
logodds_array_
(
Eigen
::
ArrayXXd
::
Zero
(
n_cells_
(
0
),
n_cells_
(
1
))),
agg_pc_
(
0
,
0
)
{
assert
(
_problem
->
getDim
()
==
2
&&
"PublisherLaserMap only implemented for 2D problems"
);
// common params
update_dist_th_
=
_server
.
getParam
<
double
>
(
prefix_
+
"/update_dist_th"
);
update_angle_th_
=
_server
.
getParam
<
double
>
(
prefix_
+
"/update_angle_th"
);
...
...
@@ -186,7 +188,7 @@ void PublisherLaserMap::storeScan(FrameBasePtr frame, CaptureLaser2dPtr capture)
}
bool
PublisherLaserMap
::
trajectoryChanged
(
const
std
::
map
<
FrameBasePtr
,
Eigen
::
Vector3d
>&
_last_trajectory
,
const
std
::
map
<
FrameBasePtr
,
Eigen
::
Vector3d
>&
_current_trajectory
)
const
const
std
::
map
<
FrameBasePtr
,
Eigen
::
Vector3d
>&
_current_trajectory
)
const
{
// check if trajectory changed enough
for
(
auto
frame_pos
:
_last_trajectory
)
...
...
@@ -254,8 +256,14 @@ bool PublisherLaserMap::updateOccMap()
void
PublisherLaserMap
::
addScanToOccMap
(
const
ScanData
&
scan_data
,
const
Eigen
::
Vector3d
&
pose
)
{
// Get laser extrinsics
Eigen
::
Vector3d
laser_pose
;
laser_pose
.
head
<
2
>
()
=
Eigen
::
Rotation2Dd
(
pose
(
2
)).
matrix
()
*
scan_data
.
capture_
->
getSensor
()
->
getP
()
->
getState
()
+
pose
.
head
<
2
>
();
laser_pose
(
2
)
=
scan_data
.
capture_
->
getSensor
()
->
getO
()
->
getState
()(
0
)
+
pose
(
2
);
// Compute global points
Eigen
::
MatrixXf
points
=
Eigen
::
Rotation2Df
(
pose
(
2
)).
matrix
()
*
scan_data
.
local_points_
+
pose
.
cast
<
float
>
().
head
(
2
).
replicate
(
1
,
scan_data
.
local_points_
.
cols
());
Eigen
::
MatrixXf
points
=
Eigen
::
Rotation2Df
(
laser_
pose
(
2
)).
matrix
()
*
scan_data
.
local_points_
+
laser_
pose
.
cast
<
float
>
().
head
(
2
).
replicate
(
1
,
scan_data
.
local_points_
.
cols
());
// Bounds
Eigen
::
Vector2i
min_cell
=
vectorToCell
(
Eigen
::
Vector2d
(
points
.
row
(
0
).
minCoeff
(),
...
...
@@ -280,7 +288,7 @@ void PublisherLaserMap::addScanToOccMap(const ScanData& scan_data, const Eigen::
}
// Apply log odds for each ray
Eigen
::
Vector2i
origin_cell
=
vectorToCell
(
pose
.
head
<
2
>
());
Eigen
::
Vector2i
origin_cell
=
vectorToCell
(
laser_
pose
.
head
<
2
>
());
Eigen
::
Vector2i
point_cell
;
for
(
auto
i
=
0
;
i
<
points
.
cols
();
i
++
)
{
...
...
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