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
73f8f8fc
Commit
73f8f8fc
authored
Feb 25, 2022
by
limingbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add period
parent
732b7821
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
15 deletions
+43
-15
CMakeLists.txt.user
CMakeLists.txt.user
+0
-0
multi_traj_functions.cpp
apps/function/multi_traj_functions.cpp
+26
-5
multi_traj_functions.h
apps/function/multi_traj_functions.h
+4
-2
multi_traj.cpp
apps/multi_traj.cpp
+13
-8
No files found.
CMakeLists.txt.user
View file @
73f8f8fc
This diff is collapsed.
Click to expand it.
apps/function/multi_traj_functions.cpp
View file @
73f8f8fc
...
...
@@ -22,7 +22,7 @@ vector<string> getActiveTraces(
void
getCrossTasks
(
const
vector
<
string
>
&
allTask
,
vector
<
string
>
&
crossTasks
)
vector
<
pair
<
string
,
vector
<
pair
<
float
,
float
>>>
>
&
crossTasks
)
{
if
(
allTask
.
size
()
<
2
){
return
;
...
...
@@ -152,9 +152,9 @@ bool checkMeshOut(
return
false
;
}
vector
<
string
>
crossFilter
(
vector
<
pair
<
string
,
vector
<
pair
<
float
,
float
>>>
>
crossFilter
(
const
vector
<
TaskInfo
>
&
filteredTaskInfo
){
vector
<
string
>
ret
;
vector
<
pair
<
string
,
vector
<
pair
<
float
,
float
>>>
>
ret
;
if
(
filteredTaskInfo
.
size
()
<
2
){
return
ret
;
}
...
...
@@ -175,17 +175,37 @@ vector<string> crossFilter(
octree
.
addPointsFromInputCloud
();
for
(
size_t
pcIndex
=
1
;
pcIndex
<
pointClouds
.
size
();
pcIndex
++
){
bool
found
=
false
;
bool
inPeriod
=
false
;
float
start
=
0
,
end
=
0
;
pair
<
string
,
vector
<
pair
<
float
,
float
>>>
oneRet
;
vector
<
pair
<
float
,
float
>>
timePeriods
;
float
currTime
;
for
(
const
PointExport
&
query
:
pointClouds
[
pcIndex
]
->
points
){
int
result_index
;
float
sqr_distance
;
octree
.
approxNearestSearch
(
query
,
result_index
,
sqr_distance
);
if
(
sqr_distance
<
10
){
found
=
true
;
break
;
if
(
!
inPeriod
){
start
=
query
.
info
;
inPeriod
=
true
;
}
}
else
{
if
(
inPeriod
){
end
=
query
.
info
;
inPeriod
=
false
;
timePeriods
.
push_back
(
make_pair
(
start
,
end
));
}
}
currTime
=
query
.
info
;
}
if
(
inPeriod
){
timePeriods
.
push_back
(
make_pair
(
start
,
currTime
));
}
if
(
found
){
ret
.
push_back
(
filteredTaskInfo
[
pcIndex
].
taskPath
);
oneRet
=
make_pair
(
filteredTaskInfo
[
pcIndex
].
taskPath
,
timePeriods
);
ret
.
push_back
(
oneRet
);
}
}
return
ret
;
...
...
@@ -249,6 +269,7 @@ void getPointCloud(boost::shared_ptr<LocalCartesian> proj,
point
.
x
=
translation
.
x
();
point
.
y
=
translation
.
y
();
point
.
z
=
translation
.
z
();
point
.
info
=
trajPoint
.
timestamp
;
pointCloud
->
push_back
(
point
);
}
}
...
...
apps/function/multi_traj_functions.h
View file @
73f8f8fc
...
...
@@ -18,7 +18,9 @@ vector<string> getCloseTasks(
const
string
&
parentPath
,
boost
::
shared_ptr
<
Trajectory
>
currTraj
);
void
getCrossTasks
(
const
vector
<
string
>
&
allTask
,
vector
<
string
>
&
crossTasks
);
void
getCrossTasks
(
const
vector
<
string
>
&
allTask
,
vector
<
pair
<
string
,
vector
<
pair
<
float
,
float
>
>
>
>
&
crossTasks
);
bool
getTaskInfo
(
const
string
&
taskPath
,
...
...
@@ -35,7 +37,7 @@ bool checkMeshOut(
const
MeshOut
&
query
,
const
MeshOut
&
target
);
vector
<
string
>
crossFilter
(
vector
<
pair
<
string
,
vector
<
pair
<
float
,
float
>>>
>
crossFilter
(
const
vector
<
TaskInfo
>
&
filteredTaskInfo
);
bool
initTrajectory
(
const
string
&
trajPath
,
...
...
apps/multi_traj.cpp
View file @
73f8f8fc
...
...
@@ -35,20 +35,20 @@ int main(int argc, char *argv[])
}
activeTraces
.
insert
(
activeTraces
.
begin
(),
FLAGS_base_dir
);
vector
<
string
>
crossTasks
;
vector
<
pair
<
string
,
vector
<
pair
<
float
,
float
>>>
>
crossTasks
;
getCrossTasks
(
activeTraces
,
crossTasks
);
if
(
crossTasks
.
size
()
==
0
){
LOG
(
WARNING
)
<<
"crossTasks.size() == 0"
;
}
else
{
sort
(
crossTasks
.
begin
(),
crossTasks
.
end
(),
[](
const
string
&
query
,
const
string
&
target
)
{
return
stoi
(
boost
::
filesystem
::
path
(
query
).
filename
().
string
())
<
stoi
(
boost
::
filesystem
::
path
(
target
).
filename
().
string
());
[](
const
auto
&
query
,
const
auto
&
target
)
{
return
stoi
(
boost
::
filesystem
::
path
(
query
.
first
).
filename
().
string
())
<
stoi
(
boost
::
filesystem
::
path
(
target
.
first
).
filename
().
string
());
});
}
for
(
string
task
:
crossTasks
){
LOG
(
INFO
)
<<
"cross task chekc in: "
<<
task
;
for
(
auto
task
:
crossTasks
){
LOG
(
INFO
)
<<
"cross task chekc in: "
<<
task
.
first
;
}
string
outputPath
=
FLAGS_base_dir
+
"/multiTraj.txt"
;
...
...
@@ -59,8 +59,13 @@ int main(int argc, char *argv[])
}
if
(
crossTasks
.
size
()
!=
0
){
// ofs << crossTasks.back() << std::endl;
for
(
string
task
:
crossTasks
){
ofs
<<
task
<<
std
::
endl
;
for
(
auto
task
:
crossTasks
){
ofs
<<
task
.
first
;
for
(
auto
period
:
task
.
second
){
ofs
<<
" "
<<
period
.
first
<<
" "
<<
period
.
second
;
}
ofs
<<
std
::
endl
;
}
}
ofs
.
close
();
...
...
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