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
8154a235
Commit
8154a235
authored
2 years ago
by
Víctor Sainz Ubide
Browse files
Options
Downloads
Patches
Plain Diff
New loader for binaries
parent
5c528c49
No related branches found
No related tags found
1 merge request
!41
Draft: Resolve "New branch laser 3d"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/laser/utils/laser3d_tools.h
+48
-6
48 additions, 6 deletions
include/laser/utils/laser3d_tools.h
with
48 additions
and
6 deletions
include/laser/utils/laser3d_tools.h
+
48
−
6
View file @
8154a235
...
@@ -40,12 +40,53 @@ typedef pcl::Registration<pcl::PointXYZ, pcl::PointXYZ>::Ptr RegistrationPtr;
...
@@ -40,12 +40,53 @@ 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
)
{
{
pcl
::
io
::
loadPCDFile
(
fname
,
cloud
);
std
::
string
s_pcd
=
".pcd"
,
s_bin
=
".bin"
;
// remove NAN points from the cloud
if
(
fname
.
compare
(
fname
.
size
()
-
4
,
4
,
s_pcd
)
==
0
)
pcl
::
Indices
indices
;
{
pcl
::
removeNaNFromPointCloud
(
cloud
,
cloud
,
indices
);
pcl
::
io
::
loadPCDFile
(
fname
,
cloud
);
// remove NAN points from the cloud
pcl
::
Indices
indices
;
pcl
::
removeNaNFromPointCloud
(
cloud
,
cloud
,
indices
);
}
else
if
(
fname
.
compare
(
fname
.
size
()
-
4
,
4
,
s_bin
)
==
0
)
{
// file is binary
pcl
::
PointCloud
<
pcl
::
PointXYZ
>::
Ptr
pcl_ptr
=
pcl
::
make_shared
<
pcl
::
PointCloud
<
pcl
::
PointXYZ
>>
();
FILE
*
stream
;
stream
=
std
::
fopen
(
fname
.
c_str
(),
"rb"
);
int32_t
num
=
std
::
fread
(
NULL
,
sizeof
(
float
),
10000000
,
stream
)
/
4
;
// size of point cloud
float
*
data
=
(
float
*
)
malloc
(
num
*
sizeof
(
float
));
float
*
px
=
data
+
0
;
float
*
py
=
data
+
1
;
float
*
pz
=
data
+
2
;
float
*
pr
=
data
+
3
;
pcl
::
PointXYZ
tPoint
;
for
(
int32_t
i
=
0
;
i
<
num
;
i
++
)
{
tPoint
.
x
=
*
px
;
tPoint
.
y
=
*
py
;
tPoint
.
z
=
*
pz
;
pcl_ptr
->
push_back
(
tPoint
);
// m.cloud -> push_back(*px, *py, *pz, *pr);
// point_cloud.points.push_back(tPoint(*px, *py, *pz, *pr));
px
+=
4
;
py
+=
4
;
pz
+=
4
;
pr
+=
4
;
}
fclose
(
stream
);
// remove NAN points from the cloud
std
::
vector
<
int
>
indices
;
pcl
::
removeNaNFromPointCloud
(
*
pcl_ptr
,
*
pcl_ptr
,
indices
);
}
};
};
// _cloud_ref: first PointCloud
// _cloud_ref: first PointCloud
...
@@ -86,7 +127,8 @@ inline void pairAlign(const pcl::PointCloud<pcl::PointXYZ>::Ptr _cloud_ref,
...
@@ -86,7 +127,8 @@ inline void pairAlign(const pcl::PointCloud<pcl::PointXYZ>::Ptr _cloud_ref,
_transform_final
=
Eigen
::
Isometry3d
(
transform_pcl
.
cast
<
double
>
());
_transform_final
=
Eigen
::
Isometry3d
(
transform_pcl
.
cast
<
double
>
());
// DURATION --------------------------------------------------------
// DURATION --------------------------------------------------------
auto
duration
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
std
::
chrono
::
high_resolution_clock
::
now
()
-
start
);
auto
duration
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
std
::
chrono
::
high_resolution_clock
::
now
()
-
start
);
WOLF_INFO
(
"Laser3d_tools.h: pairAlign: duration: "
,
1e-3
*
(
duration
).
count
(),
" ms"
);
WOLF_INFO
(
"Laser3d_tools.h: pairAlign: duration: "
,
1e-3
*
(
duration
).
count
(),
" ms"
);
// DURATION --------------------------------------------------------
// DURATION --------------------------------------------------------
}
}
...
...
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