Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
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_lib
plugins
laser
Commits
db615c8c
Commit
db615c8c
authored
2 years ago
by
Víctor Sainz Ubide
Browse files
Options
Downloads
Patches
Plain Diff
moved PCLdownsample and renamed variables
parent
80945dc6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!41
Draft: Resolve "New branch laser 3d"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/laser/utils/laser3d_tools.h
+38
-14
38 additions, 14 deletions
include/laser/utils/laser3d_tools.h
src/processor/processor_odom_icp_3d.cpp
+3
-25
3 additions, 25 deletions
src/processor/processor_odom_icp_3d.cpp
with
41 additions
and
39 deletions
include/laser/utils/laser3d_tools.h
+
38
−
14
View file @
db615c8c
...
@@ -23,19 +23,29 @@
...
@@ -23,19 +23,29 @@
#ifndef LASER3D_TOOLS_H
#ifndef LASER3D_TOOLS_H
#define LASER3D_TOOLS_H
#define LASER3D_TOOLS_H
/**************************
* WOLF includes *
**************************/
#include
"laser/capture/capture_laser_3d.h"
#include
"laser/sensor/sensor_laser_3d.h"
#include
<core/utils/logging.h>
#include
<core/utils/logging.h>
/**************************
* PCL includes *
**************************/
#include
<pcl/point_types.h>
#include
<pcl/point_types.h>
#include
<pcl/point_cloud.h>
#include
<pcl/point_cloud.h>
#include
<pcl/common/transforms.h>
#include
<pcl/common/transforms.h>
#include
<pcl/io/pcd_io.h>
#include
<pcl/io/pcd_io.h>
#include
<pcl/filters/voxel_grid.h>
#include
<pcl/filters/voxel_grid.h>
#include
<pcl/registration/icp.h>
#include
<pcl/registration/icp.h>
#include
<pcl/registration/icp_nl.h>
#include
<pcl/registration/icp_nl.h>
#include
<pcl/registration/transforms.h>
#include
<pcl/registration/transforms.h>
/**************************
* Standard includes *
**************************/
#include
<iostream>
#include
<iostream>
#include
<fstream>
#include
<fstream>
...
@@ -43,21 +53,19 @@ typedef pcl::Registration<pcl::PointXYZ, pcl::PointXYZ>::Ptr RegistrationPtr;
...
@@ -43,21 +53,19 @@ typedef pcl::Registration<pcl::PointXYZ, pcl::PointXYZ>::Ptr RegistrationPtr;
namespace
wolf
namespace
wolf
{
{
void
loadData
(
std
::
string
fname
,
pcl
::
PointCloud
<
pcl
::
PointXYZ
>
&
cloud
)
void
loadData
(
std
::
string
_
fname
,
pcl
::
PointCloud
<
pcl
::
PointXYZ
>
&
_
cloud
)
{
{
//std::string s_pcd = ".pcd", s_bin = ".bin";
if
(
_fname
.
compare
(
_fname
.
size
()
-
4
,
4
,
".pcd"
)
==
0
)
if
(
fname
.
compare
(
fname
.
size
()
-
4
,
4
,
".pcd"
)
==
0
)
{
{
pcl
::
io
::
loadPCDFile
(
fname
,
cloud
);
pcl
::
io
::
loadPCDFile
(
_fname
,
_cloud
);
}
}
else
if
(
fname
.
compare
(
fname
.
size
()
-
4
,
4
,
".bin"
)
==
0
)
else
if
(
_
fname
.
compare
(
_
fname
.
size
()
-
4
,
4
,
".bin"
)
==
0
)
{
// file is binary
{
// file is binary
//pcl::PointCloud<pcl::PointXYZ>::Ptr pcl_ptr = pcl::make_shared<pcl::PointCloud<pcl::PointXYZ>>();
//
pcl::PointCloud<pcl::PointXYZ>::Ptr pcl_ptr = pcl::make_shared<pcl::PointCloud<pcl::PointXYZ>>();
std
::
ifstream
stream_input
;
std
::
ifstream
stream_input
;
stream_input
.
open
(
fname
,
std
::
ios
::
in
);
stream_input
.
open
(
_
fname
,
std
::
ios
::
in
);
for
(
int
i
=
0
;
stream_input
.
good
()
&&
!
stream_input
.
eof
();
i
++
)
for
(
int
i
=
0
;
stream_input
.
good
()
&&
!
stream_input
.
eof
();
i
++
)
{
{
pcl
::
PointXYZI
point_raw
;
pcl
::
PointXYZI
point_raw
;
...
@@ -70,16 +78,32 @@ void loadData(std::string fname, pcl::PointCloud<pcl::PointXYZ> &cloud)
...
@@ -70,16 +78,32 @@ void loadData(std::string fname, pcl::PointCloud<pcl::PointXYZ> &cloud)
tPoint
.
y
=
point_raw
.
y
;
tPoint
.
y
=
point_raw
.
y
;
tPoint
.
z
=
point_raw
.
z
;
tPoint
.
z
=
point_raw
.
z
;
cloud
.
push_back
(
tPoint
);
_
cloud
.
push_back
(
tPoint
);
}
}
stream_input
.
close
();
stream_input
.
close
();
// remove NAN points from the cloud
// remove NAN points from the cloud
pcl
::
Indices
indices
;
pcl
::
Indices
indices
;
pcl
::
removeNaNFromPointCloud
(
cloud
,
cloud
,
indices
);
pcl
::
removeNaNFromPointCloud
(
_
cloud
,
_
cloud
,
indices
);
}
}
};
};
void
PCLdownsample
(
CaptureLaser3dPtr
_capture_laser
,
bool
_pcl_downsample
=
true
,
double
_pcl_voxel_size
=
0.05
)
{
if
(
_pcl_downsample
)
{
pcl
::
VoxelGrid
<
pcl
::
PointXYZ
>
grid
;
grid
.
setLeafSize
(
_pcl_voxel_size
,
_pcl_voxel_size
,
_pcl_voxel_size
);
grid
.
setInputCloud
(
_capture_laser
->
getPCLRaw
());
pcl
::
PointCloud
<
pcl
::
PointXYZ
>::
Ptr
pcl_ptr
=
pcl
::
make_shared
<
pcl
::
PointCloud
<
pcl
::
PointXYZ
>>
();
grid
.
filter
(
*
pcl_ptr
);
_capture_laser
->
setPCLDownsampled
(
pcl_ptr
);
}
else
{
_capture_laser
->
setPCLDownsampled
(
_capture_laser
->
getPCLRaw
());
}
}
// _cloud_ref: first PointCloud
// _cloud_ref: first PointCloud
// _cloud_other: second PointCloud
// _cloud_other: second PointCloud
inline
void
pairAlign
(
const
pcl
::
PointCloud
<
pcl
::
PointXYZ
>::
Ptr
_cloud_ref
,
inline
void
pairAlign
(
const
pcl
::
PointCloud
<
pcl
::
PointXYZ
>::
Ptr
_cloud_ref
,
...
...
This diff is collapsed.
Click to expand it.
src/processor/processor_odom_icp_3d.cpp
+
3
−
25
View file @
db615c8c
...
@@ -89,31 +89,9 @@ void ProcessorOdomIcp3d::configure(SensorBasePtr _sensor)
...
@@ -89,31 +89,9 @@ void ProcessorOdomIcp3d::configure(SensorBasePtr _sensor)
void
ProcessorOdomIcp3d
::
preProcess
()
void
ProcessorOdomIcp3d
::
preProcess
()
{
{
incoming_laser_
=
std
::
static_pointer_cast
<
CaptureLaser3d
>
(
incoming_ptr_
);
incoming_laser_
=
std
::
static_pointer_cast
<
CaptureLaser3d
>
(
incoming_ptr_
);
if
(
params_odom_icp_
->
pcl_downsample
)
double
pcl_voxel_size
=
params_odom_icp_
->
pcl_downsample_voxel_size
;
{
bool
pcl_downsample
=
params_odom_icp_
->
pcl_downsample
;
// DURATION --------------------------------------------------------
PCLdownsample
(
incoming_laser_
,
pcl_downsample
,
pcl_voxel_size
);
auto
start
=
std
::
chrono
::
high_resolution_clock
::
now
();
// DURATION --------------------------------------------------------
double
pcl_voxel_size
=
params_odom_icp_
->
pcl_downsample_voxel_size
;
pcl
::
VoxelGrid
<
pcl
::
PointXYZ
>
grid
;
grid
.
setLeafSize
(
pcl_voxel_size
,
pcl_voxel_size
,
pcl_voxel_size
);
grid
.
setInputCloud
(
incoming_laser_
->
getPCLRaw
());
pcl
::
PointCloud
<
pcl
::
PointXYZ
>::
Ptr
pcl_ptr
=
pcl
::
make_shared
<
pcl
::
PointCloud
<
pcl
::
PointXYZ
>>
();
grid
.
filter
(
*
pcl_ptr
);
incoming_laser_
->
setPCLDownsampled
(
pcl_ptr
);
// DURATION --------------------------------------------------------
auto
duration
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
std
::
chrono
::
high_resolution_clock
::
now
()
-
start
);
WOLF_INFO
(
"ProcessorOdomIcp3d.h: downsample: duration: "
,
1e-3
*
(
duration
).
count
(),
" ms"
);
// DURATION --------------------------------------------------------
}
else
{
incoming_laser_
->
setPCLDownsampled
(
incoming_laser_
->
getPCLRaw
());
}
}
}
/** \brief Tracker function
/** \brief Tracker function
...
...
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