Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
M
multiTraj
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
multiTraj
Commits
33bf5bb1
Commit
33bf5bb1
authored
Dec 29, 2021
by
limingbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
5a45d7f5
Pipeline
#869
canceled with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
34 deletions
+63
-34
multi_traj_functions.cpp
apps/function/multi_traj_functions.cpp
+28
-15
multi_traj_functions.h
apps/function/multi_traj_functions.h
+3
-4
multi_traj.cpp
apps/multi_traj.cpp
+9
-2
trajectory.cpp
libs/trajectory/trajectory.cpp
+18
-11
trajectory.h
libs/trajectory/trajectory.h
+5
-2
No files found.
apps/function/multi_traj_functions.cpp
View file @
33bf5bb1
...
...
@@ -19,32 +19,35 @@ vector<string> getCloseTasks(
if
(
!
is_directory
(
rawTraceDir
)){
continue
;
}
string
iePath
=
rawTraceDir
+
"/sample.gps"
;
if
(
!
exists
(
iePath
)){
string
trajPath
=
rawTraceDir
+
"/sample.gps"
;
if
(
!
exists
(
trajPath
)){
trajPath
=
rawTraceDir
+
"/ie.txt"
;;
}
if
(
!
exists
(
trajPath
)){
continue
;
}
if
(
currTraj
->
getTrajPath
()
==
ie
Path
){
if
(
currTraj
->
getTrajPath
()
==
traj
Path
){
continue
;
}
TrajPoint
trajPoint
;
if
(
getFstTraj
(
ie
Path
,
trajPoint
,
proj
)){
if
(
!
getFstTraj
(
traj
Path
,
trajPoint
,
proj
)){
continue
;
}
if
(
trajPoint
.
translation
.
norm
()
>
30000
){
continue
;
}
closeTasks
.
push_back
(
ie
Path
);
closeTasks
.
push_back
(
traj
Path
);
}
return
closeTasks
;
}
bool
getFstTraj
(
const
string
&
ie
Path
,
bool
getFstTraj
(
const
string
&
traj
Path
,
TrajPoint
&
trajPoint
,
boost
::
shared_ptr
<
LocalCartesian
>
proj
){
std
::
ifstream
ifs
(
ie
Path
);
std
::
ifstream
ifs
(
traj
Path
);
if
(
!
ifs
){
LOG
(
WARNING
)
<<
ie
Path
<<
" load fail!"
;
LOG
(
WARNING
)
<<
traj
Path
<<
" load fail!"
;
return
false
;
}
string
line
;
...
...
@@ -111,16 +114,16 @@ vector<string> getCrossTasks(
}
vector
<
boost
::
shared_ptr
<
Trajectory
>>
multiThreadInitTrajectory
(
const
vector
<
string
>
&
ie
Paths
)
const
vector
<
string
>
&
traj
Paths
)
{
vector
<
ThreadPtr
>
thread_vec
;
vector
<
boost
::
shared_ptr
<
Trajectory
>>
trajectories
;
trajectories
.
resize
(
ie
Paths
.
size
());
for
(
uint8_t
thread_index
=
0
;
thread_index
<
ie
Paths
.
size
();
thread_index
++
){
trajectories
.
resize
(
traj
Paths
.
size
());
for
(
uint8_t
thread_index
=
0
;
thread_index
<
traj
Paths
.
size
();
thread_index
++
){
// thread_vec.emplace_back(ThreadPtr(new boost::thread(boost::bind(&initTrajectory,
// iePaths[thread_index],
// trajectories[thread_index]))));
initTrajectory
(
ie
Paths
[
thread_index
],
trajectories
[
thread_index
]);
initTrajectory
(
traj
Paths
[
thread_index
],
trajectories
[
thread_index
]);
}
for
(
uint8_t
thread_index
=
0
;
thread_index
<
thread_vec
.
size
();
thread_index
++
){
thread_vec
[
thread_index
]
->
join
();
...
...
@@ -129,12 +132,19 @@ vector<boost::shared_ptr<Trajectory>> multiThreadInitTrajectory(
return
trajectories
;
}
void
initTrajectory
(
const
string
&
ie
Path
,
bool
initTrajectory
(
const
string
&
traj
Path
,
boost
::
shared_ptr
<
Trajectory
>
&
trajectory
)
{
trajectory
.
reset
(
new
Trajectory
(
iePath
,
PPK
));
if
(
boost
::
filesystem
::
path
(
trajPath
).
stem
()
==
"ie.txt"
){
trajectory
.
reset
(
new
Trajectory
(
trajPath
,
PPK
));
}
else
if
(
boost
::
filesystem
::
path
(
trajPath
).
stem
()
==
"sample.gps"
){
trajectory
.
reset
(
new
Trajectory
(
trajPath
,
PPK
,
10
));
}
else
{
return
false
;
}
trajectory
->
init
();
return
true
;
}
vector
<
PointCloudExport
::
Ptr
>
multiThreadGetPointCloud
(
...
...
@@ -162,6 +172,9 @@ void getPointCloud(boost::shared_ptr<LocalCartesian> proj,
boost
::
shared_ptr
<
Trajectory
>
&
trajectory
,
PointCloudExport
::
Ptr
&
pointCloud
)
{
if
(
!
trajectory
){
return
;
}
vector
<
TrajPoint
>
traj
=
trajectory
->
getTrajectory
();
for
(
const
TrajPoint
&
trajPoint
:
traj
){
PointExport
point
;
...
...
apps/function/multi_traj_functions.h
View file @
33bf5bb1
...
...
@@ -9,7 +9,7 @@ vector<string> getCloseTasks(
const
string
&
parentPath
,
boost
::
shared_ptr
<
Trajectory
>
currTraj
);
bool
getFstTraj
(
const
string
&
ie
Path
,
bool
getFstTraj
(
const
string
&
traj
Path
,
TrajPoint
&
trajPoint
,
boost
::
shared_ptr
<
LocalCartesian
>
proj
);
...
...
@@ -17,10 +17,9 @@ vector<string> getCrossTasks(
const
vector
<
string
>
&
closeTasks
,
boost
::
shared_ptr
<
Trajectory
>
currTraj
);
vector
<
boost
::
shared_ptr
<
Trajectory
>>
multiThreadInitTrajectory
(
const
vector
<
string
>
&
iePaths
);
vector
<
boost
::
shared_ptr
<
Trajectory
>>
multiThreadInitTrajectory
(
const
vector
<
string
>
&
trajPaths
);
void
initTrajectory
(
const
string
&
ie
Path
,
bool
initTrajectory
(
const
string
&
traj
Path
,
boost
::
shared_ptr
<
Trajectory
>
&
trajectory
);
vector
<
PointCloudExport
::
Ptr
>
multiThreadGetPointCloud
(
...
...
apps/multi_traj.cpp
View file @
33bf5bb1
...
...
@@ -25,8 +25,15 @@ int main(int argc, char *argv[])
FLAGS_logbufsecs
=
0
;
string
ppk_dir_
=
FLAGS_base_dir
+
"/raw_trace/sample.gps"
;
ppk_traj_
.
reset
(
new
Trajectory
(
ppk_dir_
,
PPK
));
if
(
exists
(
ppk_dir_
)){
ppk_traj_
.
reset
(
new
Trajectory
(
ppk_dir_
,
PPK
,
10
));
}
else
{
ppk_dir_
=
FLAGS_base_dir
+
"/raw_trace/ie.txt"
;
if
(
!
exists
(
ppk_dir_
)){
return
0
;
}
ppk_traj_
.
reset
(
new
Trajectory
(
ppk_dir_
,
PPK
));
}
ppk_traj_
->
init
();
LOG
(
INFO
)
<<
"Trajectory load done!"
;
...
...
libs/trajectory/trajectory.cpp
View file @
33bf5bb1
...
...
@@ -5,9 +5,13 @@ uint16_t MAX_REVERSE_CNT = 1;
uint16_t
MIN_PPK_LINE_ITEM_CNT
=
12
;
uint16_t
MIN_NODE_LINE_ITEM_CNT
=
10
;
Trajectory
::
Trajectory
(
const
string
&
traj_path
,
const
TrajType
&
trajType
)
Trajectory
::
Trajectory
(
const
string
&
traj_path
,
const
TrajType
&
trajType
,
uint32_t
frequency
)
:
trajectory_path_
(
traj_path
),
trajType_
(
trajType
)
trajType_
(
trajType
),
frequency_
(
frequency
)
{
}
...
...
@@ -20,16 +24,19 @@ Trajectory::~Trajectory()
bool
Trajectory
::
init
()
{
string
range
;
switch
(
trajType_
){
case
PPK
:
frequency_
=
1000
;
range
=
","
;
break
;
case
NODE
:
frequency_
=
10
;
range
=
" "
;
break
;
if
(
frequency_
!=
0
){
switch
(
trajType_
){
case
PPK
:
frequency_
=
1000
;
range
=
","
;
break
;
case
NODE
:
frequency_
=
10
;
range
=
" "
;
break
;
}
}
LOG
(
INFO
)
<<
"Trajectory set frequency: "
<<
frequency_
;
io_
=
new
TextIO
(
trajectory_path_
,
range
);
boost
::
function
<
void
(
const
vector
<
string
>&
,
uint8_t
)
>
parse_callback
=
...
...
libs/trajectory/trajectory.h
View file @
33bf5bb1
...
...
@@ -9,7 +9,10 @@ using namespace GeographicLib;
class
Trajectory
{
public
:
Trajectory
(
const
string
&
traj_path
,
const
TrajType
&
trajType
);
Trajectory
(
const
string
&
traj_path
,
const
TrajType
&
trajType
,
uint32_t
frequency
=
0
);
~
Trajectory
();
...
...
@@ -57,7 +60,7 @@ private:
const
TrajType
trajType_
;
double
frequency_
;
uint32_t
frequency_
;
TextIO
*
io_
=
nullptr
;
...
...
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