Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
localize_for_ppk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangdawei
localize_for_ppk
Commits
01855b85
Commit
01855b85
authored
Jun 29, 2023
by
wangdawei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unload block
parent
28aa41de
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
80 additions
and
26 deletions
+80
-26
map_matcher_interface.cc
libs/localize/map_matcher_interface.cc
+5
-0
map_matcher_interface.h
libs/localize/map_matcher_interface.h
+3
-0
adjust_ppk.cpp
libs/locate_system/adjust_ppk_by_locate/adjust_ppk.cpp
+29
-25
adjust_ppk.h
libs/locate_system/adjust_ppk_by_locate/adjust_ppk.h
+2
-0
voxel_map.cc
libs/voxel_map/interface/voxel_map.cc
+5
-0
voxel_map.h
libs/voxel_map/interface/voxel_map.h
+1
-0
blockarea.cpp
libs/voxel_map/libs/area/blockarea.cpp
+11
-0
blockarea.h
libs/voxel_map/libs/area/blockarea.h
+2
-0
maparea.h
libs/voxel_map/libs/area/maparea.h
+7
-0
mesharea.cpp
libs/voxel_map/libs/area/mesharea.cpp
+13
-1
mesharea.h
libs/voxel_map/libs/area/mesharea.h
+2
-0
No files found.
libs/localize/map_matcher_interface.cc
View file @
01855b85
...
@@ -130,4 +130,9 @@ float MapMatcherInterface::MatchPointCloud(const PointCloudJ::Ptr pcloud, const
...
@@ -130,4 +130,9 @@ float MapMatcherInterface::MatchPointCloud(const PointCloudJ::Ptr pcloud, const
return
score
;
return
score
;
}
}
void
MapMatcherInterface
::
unLoadAllBlocks
()
{
}
}
// namespace juefx
}
// namespace juefx
libs/localize/map_matcher_interface.h
View file @
01855b85
...
@@ -47,6 +47,9 @@ public:
...
@@ -47,6 +47,9 @@ public:
float
MatchPointCloud
(
const
PointCloudJ
::
Ptr
pcloud
,
const
GuessPose
guess_pose
,
float
MatchPointCloud
(
const
PointCloudJ
::
Ptr
pcloud
,
const
GuessPose
guess_pose
,
GnssPoint
&
final_pose
,
Eigen
::
Isometry3f
&
local_pose
);
GnssPoint
&
final_pose
,
Eigen
::
Isometry3f
&
local_pose
);
void
unLoadAllBlocks
();
protected
:
protected
:
virtual
float
InnerMatch
(
const
VectorCloud
&
vector_cloud
,
const
GuessPose
guess_pose
,
virtual
float
InnerMatch
(
const
VectorCloud
&
vector_cloud
,
const
GuessPose
guess_pose
,
const
Rigid3d
&
predict_pose
,
Rigid3d
&
estimate_pose
)
=
0
;
const
Rigid3d
&
predict_pose
,
Rigid3d
&
estimate_pose
)
=
0
;
...
...
libs/locate_system/adjust_ppk_by_locate/adjust_ppk.cpp
View file @
01855b85
...
@@ -470,6 +470,9 @@ bool AdjustPPK::ConfigMap(double timestamp)
...
@@ -470,6 +470,9 @@ bool AdjustPPK::ConfigMap(double timestamp)
if
(
meshVec_
.
find
(
meshId
)
==
meshVec_
.
end
()){
if
(
meshVec_
.
find
(
meshId
)
==
meshVec_
.
end
()){
return
false
;
return
false
;
}
}
if
(
currMatcher_
){
currMatcher_
->
unLoadAllBlocks
();
}
while
(
!
meshVec_
.
at
(
meshId
).
matcher
){
while
(
!
meshVec_
.
at
(
meshId
).
matcher
){
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
100
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
100
));
}
}
...
@@ -504,26 +507,13 @@ bool AdjustPPK::LocateCloud(const CloudInfoForMatch &cloudInfo)
...
@@ -504,26 +507,13 @@ bool AdjustPPK::LocateCloud(const CloudInfoForMatch &cloudInfo)
guessPose
.
movement
=
2
;
guessPose
.
movement
=
2
;
guessPose
.
rotation
=
0.01
;
guessPose
.
rotation
=
0.01
;
guessPose
.
use_gnss
=
false
;
guessPose
.
use_gnss
=
false
;
uint16_t
checkCnt
=
0
;
if
(
!
currMatcher_
->
IsMapLoaded
(
guess
.
translation
())){
while
(
!
currMatcher_
->
IsMapLoaded
(
guess
.
translation
())){
currMatcher_
->
loadArea
(
guess
.
translation
());
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
100
));
if
(
++
checkCnt
>
200
){
LOG
(
INFO
)
<<
"IsMapLoaded fail ++checkCnt > 200! "
;
return
false
;
}
}
}
double
avgGridCnt
=
currMatcher_
->
AreaAvgGridCnt
(
guess
.
translation
());
double
avgGridCnt
=
currMatcher_
->
AreaAvgGridCnt
(
guess
.
translation
());
if
(
avgGridCnt
<
20000
){
if
(
avgGridCnt
<
20000
){
LOG
(
INFO
)
<<
"avgGridCnt < 20000! "
<<
"avgGridCnt: "
<<
avgGridCnt
;
LOG
(
INFO
)
<<
"avgGridCnt < 20000! "
<<
"avgGridCnt: "
<<
avgGridCnt
;
if
(
ppkIndex_
>
0
){
CloseToPPK
();
double
radio
=
0.9
;
const
auto
&
localPPK
=
localPoseVec_
.
at
(
ppkIndex_
-
1
);
mapPose_
.
translation
()
=
localPPK
.
pose
.
translation
()
*
radio
+
mapPose_
.
translation
()
*
(
1
-
radio
);
mapPose_
.
linear
()
=
Quaterniond
(
mapPose_
.
linear
()).
slerp
(
radio
,
Quaterniond
(
localPPK
.
pose
.
linear
())).
toRotationMatrix
();
}
return
false
;
return
false
;
}
}
ofs
<<
setprecision
(
16
)
<<
cloudInfo
.
timestamp
<<
", "
<<
guess
.
translation
().
x
()
ofs
<<
setprecision
(
16
)
<<
cloudInfo
.
timestamp
<<
", "
<<
guess
.
translation
().
x
()
...
@@ -535,6 +525,7 @@ bool AdjustPPK::LocateCloud(const CloudInfoForMatch &cloudInfo)
...
@@ -535,6 +525,7 @@ bool AdjustPPK::LocateCloud(const CloudInfoForMatch &cloudInfo)
guessPose
.
precision_type
=
MATCH_PRECISION_INIT
;
guessPose
.
precision_type
=
MATCH_PRECISION_INIT
;
currMatcher_
->
MatchPointCloud
(
cloudInfo
.
frame
,
guessPose
,
finalGnssPose
,
finalPose
);
currMatcher_
->
MatchPointCloud
(
cloudInfo
.
frame
,
guessPose
,
finalGnssPose
,
finalPose
);
mapPose_
=
finalPose
.
cast
<
double
>
();
mapPose_
=
finalPose
.
cast
<
double
>
();
CloseToPPK
();
skipCnt_
=
5
;
skipCnt_
=
5
;
return
true
;
return
true
;
}
}
...
@@ -577,15 +568,15 @@ void AdjustPPK::LoadMap()
...
@@ -577,15 +568,15 @@ void AdjustPPK::LoadMap()
LOG
(
INFO
)
<<
"mesh loaded: "
<<
meshId
;
LOG
(
INFO
)
<<
"mesh loaded: "
<<
meshId
;
}
}
}
}
for
(
size_t
id
=
period
.
startId
;
id
<=
period
.
endId
;
id
+=
100
){
//
for(size_t id = period.startId; id <= period.endId; id += 100){
if
(
requestQuit_
){
//
if(requestQuit_){
return
;
//
return;
}
//
}
auto
pose
=
localPoseVec_
.
at
(
id
).
pose
;
//
auto pose = localPoseVec_.at(id).pose;
if
(
!
meshInfo
.
matcher
->
IsMapLoaded
(
pose
.
translation
())){
//
if(!meshInfo.matcher->IsMapLoaded(pose.translation())){
meshInfo
.
matcher
->
loadArea
(
pose
.
translation
());
//
meshInfo.matcher->loadArea(pose.translation());
}
//
}
}
//
}
}
}
}
}
...
@@ -669,4 +660,17 @@ bool AdjustPPK::LoadMesh(const string &streamPath, boost::shared_ptr<VoxelMapMat
...
@@ -669,4 +660,17 @@ bool AdjustPPK::LoadMesh(const string &streamPath, boost::shared_ptr<VoxelMapMat
return
true
;
return
true
;
}
}
void
AdjustPPK
::
CloseToPPK
()
{
if
(
ppkIndex_
>
0
){
double
radio
=
0.9
;
const
auto
&
localPPK
=
localPoseVec_
.
at
(
ppkIndex_
-
1
);
mapPose_
.
translation
()
=
localPPK
.
pose
.
translation
()
*
radio
+
mapPose_
.
translation
()
*
(
1
-
radio
);
mapPose_
.
linear
()
=
Quaterniond
(
mapPose_
.
linear
()).
slerp
(
radio
,
Quaterniond
(
localPPK
.
pose
.
linear
())).
toRotationMatrix
();
}
}
}
// end of namespace
}
// end of namespace
libs/locate_system/adjust_ppk_by_locate/adjust_ppk.h
View file @
01855b85
...
@@ -89,6 +89,8 @@ private:
...
@@ -89,6 +89,8 @@ private:
bool
LoadMesh
(
const
string
&
streamPath
,
bool
LoadMesh
(
const
string
&
streamPath
,
boost
::
shared_ptr
<
VoxelMapMatcher
>
&
matcher
);
boost
::
shared_ptr
<
VoxelMapMatcher
>
&
matcher
);
void
CloseToPPK
();
private
:
private
:
string
ieBaseDir_
;
string
ieBaseDir_
;
...
...
libs/voxel_map/interface/voxel_map.cc
View file @
01855b85
...
@@ -50,6 +50,11 @@ void VoxelMap::ConfirmPosition(
...
@@ -50,6 +50,11 @@ void VoxelMap::ConfirmPosition(
mapArea_
->
ConfirmPosition
(
pose_in_map
,
final_pose
);
mapArea_
->
ConfirmPosition
(
pose_in_map
,
final_pose
);
}
}
void
VoxelMap
::
unLoadAllBlocks
()
{
mapArea_
->
unLoadAllBlocks
();
}
float
VoxelMap
::
GetResolution
(
uint8_t
type
)
const
float
VoxelMap
::
GetResolution
(
uint8_t
type
)
const
{
{
float
resolution
=
mapArea_
->
getResolution
();
float
resolution
=
mapArea_
->
getResolution
();
...
...
libs/voxel_map/interface/voxel_map.h
View file @
01855b85
...
@@ -24,6 +24,7 @@ public:
...
@@ -24,6 +24,7 @@ public:
double
AreaAvgGridCnt
(
const
Eigen
::
Vector3d
&
pose
);
double
AreaAvgGridCnt
(
const
Eigen
::
Vector3d
&
pose
);
bool
GuessPosition
(
const
GnssPoint
&
init_pose
,
Eigen
::
Isometry3d
&
pose_in_map
);
bool
GuessPosition
(
const
GnssPoint
&
init_pose
,
Eigen
::
Isometry3d
&
pose_in_map
);
void
ConfirmPosition
(
const
Eigen
::
Vector3d
&
pose_in_map
,
GnssPoint
&
final_pose
);
void
ConfirmPosition
(
const
Eigen
::
Vector3d
&
pose_in_map
,
GnssPoint
&
final_pose
);
void
unLoadAllBlocks
();
public
:
public
:
float
GetResolution
(
uint8_t
type
)
const
;
float
GetResolution
(
uint8_t
type
)
const
;
...
...
libs/voxel_map/libs/area/blockarea.cpp
View file @
01855b85
...
@@ -61,6 +61,17 @@ void BlockArea::load()
...
@@ -61,6 +61,17 @@ void BlockArea::load()
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
void
BlockArea
::
unLoad
()
{
vector
<
juefx
::
Distribution
>
().
swap
(
distributionVec_
);
for
(
size_t
i
=
0
;
i
<
5
;
i
++
){
vector
<
vector
<
juefx
::
DistributionIndex
>>
().
swap
(
indexTable_
[
i
]);
}
loaded_
=
false
;
}
//--------------------------------------------------------------------------
juefx
::
Distribution
*
BlockArea
::
getGridDistribution
(
juefx
::
Distribution
*
BlockArea
::
getGridDistribution
(
uint8_t
layerId
,
uint8_t
shiftedX
,
uint8_t
shiftedY
,
uint8_t
&
length
)
const
uint8_t
layerId
,
uint8_t
shiftedX
,
uint8_t
shiftedY
,
uint8_t
&
length
)
const
{
{
...
...
libs/voxel_map/libs/area/blockarea.h
View file @
01855b85
...
@@ -27,6 +27,8 @@ public:
...
@@ -27,6 +27,8 @@ public:
void
load
();
void
load
();
void
unLoad
();
juefx
::
Distribution
*
getGridDistribution
(
juefx
::
Distribution
*
getGridDistribution
(
uint8_t
layerId
,
uint8_t
shiftedX
,
uint8_t
shiftedY
,
uint8_t
&
length
)
const
;
uint8_t
layerId
,
uint8_t
shiftedX
,
uint8_t
shiftedY
,
uint8_t
&
length
)
const
;
...
...
libs/voxel_map/libs/area/maparea.h
View file @
01855b85
...
@@ -266,6 +266,13 @@ public:
...
@@ -266,6 +266,13 @@ public:
float
getResolution
();
float
getResolution
();
void
unLoadAllBlocks
(){
if
(
!
currMesh_
){
return
;
}
currMesh_
->
unLoadAllBlocks
();
}
private
:
private
:
void
backendThreadFunc
();
void
backendThreadFunc
();
...
...
libs/voxel_map/libs/area/mesharea.cpp
View file @
01855b85
...
@@ -356,7 +356,19 @@ void MeshArea::loadBlockAtArea(const Vector3d &position)
...
@@ -356,7 +356,19 @@ void MeshArea::loadBlockAtArea(const Vector3d &position)
}
}
}
}
// LOG(INFO) << "shiftedIndexToLoad: " << centerIndex.transpose()
// LOG(INFO) << "shiftedIndexToLoad: " << centerIndex.transpose()
// << " blockCntLoaded: " <<blockCntLoaded;
// << " blockCntLoaded: " <<blockCntLoaded;
}
void
MeshArea
::
unLoadAllBlocks
()
{
for
(
size_t
x
=
0
;
x
<
rowItemCnt_
;
x
++
){
for
(
size_t
y
=
0
;
y
<
colItemCnt_
;
y
++
){
BlockContent
&
blockContent
=
blockAreaTable_
[
x
][
y
];
if
(
blockContent
.
block
->
isLoad
()){
blockContent
.
block
->
unLoad
();
}
}
}
}
}
}
}
libs/voxel_map/libs/area/mesharea.h
View file @
01855b85
...
@@ -246,6 +246,7 @@ public:
...
@@ -246,6 +246,7 @@ public:
return
offset_
;
return
offset_
;
}
}
void
unLoadAllBlocks
();
private
:
private
:
void
checkBlockState
();
void
checkBlockState
();
...
@@ -271,6 +272,7 @@ private:
...
@@ -271,6 +272,7 @@ private:
void
loadBlockAtArea
(
const
Vector3d
&
position
);
void
loadBlockAtArea
(
const
Vector3d
&
position
);
private
:
private
:
string
meshPath_
;
string
meshPath_
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment