Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Florian Leander Singer
Simox
Commits
a18169f5
Commit
a18169f5
authored
2 years ago
by
Fabian Reister
Browse files
Options
Downloads
Patches
Plain Diff
adding code from armarx /manipulation
parent
dc2c0d70
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GeometricPlanning/CMakeLists.txt
+2
-0
2 additions, 0 deletions
GeometricPlanning/CMakeLists.txt
GeometricPlanning/util.cpp
+104
-0
104 additions, 0 deletions
GeometricPlanning/util.cpp
GeometricPlanning/util.h
+44
-0
44 additions, 0 deletions
GeometricPlanning/util.h
with
150 additions
and
0 deletions
GeometricPlanning/CMakeLists.txt
+
2
−
0
View file @
a18169f5
...
...
@@ -32,6 +32,7 @@ SET(SOURCES
path_primitives/CircleSegment.cpp
path_primitives/Line.cpp
visualization.cpp
util.cpp
)
SET
(
HEADERS
...
...
@@ -45,6 +46,7 @@ SET(HEADERS
path_primitives/Line.h
assert/assert.h
visualization.h
util.h
)
ADD_LIBRARY
(
GeometricPlanning SHARED
)
# sources will be added later
...
...
This diff is collapsed.
Click to expand it.
GeometricPlanning/util.cpp
0 → 100644
+
104
−
0
View file @
a18169f5
/**
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Fabian Reister ( fabian dot reister at kit dot edu )
* @date 2023
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include
"util.h"
#include
<algorithm>
#include
<optional>
#include
<tuple>
#include
<vector>
#include
<SimoxUtility/algorithm/string/string_tools.h>
#include
<VirtualRobot/Grasping/GraspSet.h>
#include
<VirtualRobot/Robot.h>
namespace
simox
::
geometric_planning
{
std
::
vector
<
std
::
string
>
nodesMatching
(
const
std
::
vector
<
std
::
string
>&
allNodeNames
,
const
std
::
string
&
identifier
)
{
std
::
vector
<
std
::
string
>
handleNodeNames
;
std
::
copy_if
(
allNodeNames
.
begin
(),
allNodeNames
.
end
(),
std
::
back_inserter
(
handleNodeNames
),
[
&
identifier
](
const
auto
&
nodeName
)
{
// the second check is a bit hacky: we can define transformation nodes in URDF which might match, e.g. "parent->child"
return
simox
::
alg
::
ends_with
(
nodeName
,
identifier
)
and
not
simox
::
alg
::
contains
(
nodeName
,
'>'
);
});
return
handleNodeNames
;
}
std
::
optional
<
std
::
tuple
<
VirtualRobot
::
RobotNodePtr
,
VirtualRobot
::
GraspPtr
>>
findGraspByName
(
const
VirtualRobot
::
Robot
&
robot
,
const
std
::
string
&
graspSetName
,
const
std
::
string
&
graspName
)
{
for
(
const
auto
&
[
node
,
graspSets
]
:
allGraspSets
(
robot
))
{
if
(
not
graspSets
.
empty
())
{
// ARMARX_VERBOSE << "Found grasp sets attached to node " << node->getName();
for
(
const
auto
&
graspSet
:
graspSets
)
{
// check if grasp set name matches if provided
if
(
not
graspSetName
.
empty
()
and
graspSet
->
getName
()
!=
graspSetName
)
{
continue
;
}
for
(
const
auto
&
grasp
:
graspSet
->
getGrasps
())
{
if
(
graspName
==
grasp
->
getName
())
{
return
std
::
make_tuple
(
node
,
grasp
);
}
}
}
}
}
return
std
::
nullopt
;
}
std
::
map
<
VirtualRobot
::
RobotNodePtr
,
std
::
vector
<
VirtualRobot
::
GraspSetPtr
>>
allGraspSets
(
const
VirtualRobot
::
Robot
&
robot
)
{
std
::
map
<
VirtualRobot
::
RobotNodePtr
,
std
::
vector
<
VirtualRobot
::
GraspSetPtr
>>
nodeGraspSets
;
for
(
const
auto
&
node
:
robot
.
getRobotNodes
())
{
const
auto
graspSets
=
node
->
getAllGraspSets
();
for
(
const
auto
&
graspSet
:
graspSets
)
{
nodeGraspSets
[
node
].
push_back
(
graspSet
);
}
}
return
nodeGraspSets
;
}
}
// namespace simox::geometric_planning
This diff is collapsed.
Click to expand it.
GeometricPlanning/util.h
0 → 100644
+
44
−
0
View file @
a18169f5
/**
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Fabian Reister ( fabian dot reister at kit dot edu )
* @date 2023
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#pragma once
#include
<map>
#include
<VirtualRobot/VirtualRobot.h>
namespace
simox
::
geometric_planning
{
std
::
vector
<
std
::
string
>
nodesMatching
(
const
std
::
vector
<
std
::
string
>&
allNodeNames
,
const
std
::
string
&
identifier
);
std
::
optional
<
std
::
tuple
<
VirtualRobot
::
RobotNodePtr
,
VirtualRobot
::
GraspPtr
>>
findGraspByName
(
const
VirtualRobot
::
Robot
&
robot
,
const
std
::
string
&
graspSetName
,
const
std
::
string
&
graspName
);
std
::
map
<
VirtualRobot
::
RobotNodePtr
,
std
::
vector
<
VirtualRobot
::
GraspSetPtr
>>
allGraspSets
(
const
VirtualRobot
::
Robot
&
robot
);
}
// namespace simox::geometric_planning
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