Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lennard Hofmann
RobotAPI
Commits
e2af96a6
Commit
e2af96a6
authored
3 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Skips Scenes/ dir in ObjectFinder
Signed-off-by:
Rainer Kartmann
<
rainer.kartmann@kit.edu
>
parent
c22e0a03
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.cpp
+20
-11
20 additions, 11 deletions
source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.cpp
source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.h
+5
-0
5 additions, 0 deletions
source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.h
with
25 additions
and
11 deletions
source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.cpp
+
20
−
11
View file @
e2af96a6
...
...
@@ -55,6 +55,12 @@ namespace armarx
}
bool
ObjectFinder
::
isDatasetDirValid
(
const
path
&
path
)
const
{
return
path
.
filename
()
!=
"Scenes"
and
std
::
filesystem
::
is_directory
(
path
);
}
std
::
optional
<
ObjectInfo
>
ObjectFinder
::
findObject
(
const
std
::
string
&
dataset
,
const
std
::
string
&
name
)
const
{
init
();
...
...
@@ -67,8 +73,8 @@ namespace armarx
return
ObjectInfo
(
packageName
,
packageDataDir
,
dataset
,
name
);
}
// Search for object in datasets.
const
auto
&
datasets
=
getDatasets
();
for
(
const
path
&
dataset
:
datasets
)
const
std
::
vector
<
std
::
string
>
&
datasets
=
getDatasets
();
for
(
const
std
::
string
&
dataset
:
datasets
)
{
if
(
fs
::
is_directory
(
_rootDirAbs
()
/
dataset
/
name
))
{
...
...
@@ -106,7 +112,7 @@ namespace armarx
{
// init(); // Done by called methods.
std
::
vector
<
std
::
string
>
datasets
;
for
(
const
auto
&
dir
:
getDatasetDirectories
())
for
(
const
path
&
dir
:
getDatasetDirectories
())
{
datasets
.
push_back
(
dir
.
filename
());
}
...
...
@@ -123,9 +129,9 @@ namespace armarx
const
bool
local
=
false
;
std
::
vector
<
path
>
dirs
=
simox
::
fs
::
list_directory
(
_rootDirAbs
(),
local
);
std
::
vector
<
path
>
datasetDirs
;
for
(
const
auto
&
p
:
dirs
)
for
(
const
path
&
p
:
dirs
)
{
if
(
std
::
filesystem
::
is_directory
(
p
))
if
(
isDatasetDirValid
(
p
))
{
datasetDirs
.
push_back
(
p
);
}
...
...
@@ -144,7 +150,7 @@ namespace armarx
std
::
vector
<
ObjectInfo
>
objects
;
for
(
const
path
&
datasetDir
:
simox
::
fs
::
list_directory
(
_rootDirAbs
(),
local
))
{
if
(
fs
::
is_directory
(
_rootDirAbs
()
/
datasetDir
))
if
(
isDatasetDirValid
(
_rootDirAbs
()
/
datasetDir
))
{
std
::
vector
<
ObjectInfo
>
dataset
=
findAllObjectsOfDataset
(
datasetDir
,
checkPaths
);
for
(
const
auto
&
o
:
dataset
)
...
...
@@ -169,7 +175,7 @@ namespace armarx
std
::
vector
<
armem
::
articulated_object
::
ArticulatedObjectDescription
>
objects
;
for
(
const
path
&
datasetDir
:
simox
::
fs
::
list_directory
(
_rootDirAbs
(),
local
))
{
if
(
fs
::
is_directory
(
_rootDirAbs
()
/
datasetDir
))
if
(
isDatasetDirValid
(
_rootDirAbs
()
/
datasetDir
))
{
const
auto
dataset
=
findAllArticulatedObjectsOfDataset
(
datasetDir
,
checkPaths
);
objects
.
insert
(
objects
.
end
(),
dataset
.
begin
(),
dataset
.
end
());
...
...
@@ -221,7 +227,9 @@ namespace armarx
return
objects
;
}
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
armem
::
articulated_object
::
ArticulatedObjectDescription
>>
ObjectFinder
::
findAllArticulatedObjectsByDataset
(
bool
checkPaths
)
const
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
armem
::
articulated_object
::
ArticulatedObjectDescription
>>
ObjectFinder
::
findAllArticulatedObjectsByDataset
(
bool
checkPaths
)
const
{
init
();
if
(
!
_ready
())
...
...
@@ -234,7 +242,7 @@ namespace armarx
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
armem
::
articulated_object
::
ArticulatedObjectDescription
>>
datasets
;
for
(
const
path
&
datasetDir
:
simox
::
fs
::
list_directory
(
_rootDirAbs
(),
local
))
{
if
(
fs
::
is_directory
(
_rootDirAbs
()
/
datasetDir
))
if
(
isDatasetDirValid
(
_rootDirAbs
()
/
datasetDir
))
{
const
auto
dataset
=
findAllArticulatedObjectsOfDataset
(
datasetDir
,
checkPaths
);
datasets
[
datasetDir
]
=
dataset
;
...
...
@@ -244,7 +252,8 @@ namespace armarx
}
std
::
vector
<
armem
::
articulated_object
::
ArticulatedObjectDescription
>
ObjectFinder
::
findAllArticulatedObjectsOfDataset
(
const
std
::
string
&
dataset
,
bool
checkPaths
)
const
std
::
vector
<
armem
::
articulated_object
::
ArticulatedObjectDescription
>
ObjectFinder
::
findAllArticulatedObjectsOfDataset
(
const
std
::
string
&
dataset
,
bool
checkPaths
)
const
{
init
();
if
(
!
_ready
())
...
...
@@ -252,7 +261,7 @@ namespace armarx
return
{};
}
path
datasetDir
=
_rootDirAbs
()
/
dataset
;
if
(
!
fs
::
is_directory
(
datasetDir
))
if
(
!
isDatasetDirValid
(
datasetDir
))
{
ARMARX_WARNING
<<
"Expected dataset directory for dataset '"
<<
dataset
<<
"':
\n
"
<<
datasetDir
;
...
...
This diff is collapsed.
Click to expand it.
source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.h
+
5
−
0
View file @
e2af96a6
...
...
@@ -89,14 +89,18 @@ namespace armarx
private:
void
init
()
const
;
bool
isDatasetDirValid
(
const
std
::
filesystem
::
path
&
path
)
const
;
path
_rootDirAbs
()
const
;
path
_rootDirRel
()
const
;
bool
_ready
()
const
;
private:
/// Name of package containing the object models (ArmarXObjects by default).
mutable
std
::
string
packageName
;
...
...
@@ -105,5 +109,6 @@ namespace armarx
* Empty if package could not be found.
*/
mutable
path
packageDataDir
;
};
}
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