Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Navigation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
Skills
Navigation
Commits
2a9aa29f
Commit
2a9aa29f
authored
3 years ago
by
Christian Dreher
Browse files
Options
Downloads
Patches
Plain Diff
fix: Formatting.
parent
ef940758
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/Navigation/components/Navigator/Navigator.cpp
+129
-107
129 additions, 107 deletions
source/Navigation/components/Navigator/Navigator.cpp
with
129 additions
and
107 deletions
source/Navigation/components/Navigator/Navigator.cpp
+
129
−
107
View file @
2a9aa29f
...
...
@@ -40,147 +40,169 @@
#include
<Navigation/libraries/factories/NavigationStackFactory.h>
namespace
armarx
::
nav
::
components
armarx
::
nav
::
components
::
Navigator
::
Navigator
()
:
executor
{
platformUnit
}
{
}
Navigator
::
Navigator
()
:
executor
{
platformUnit
}
{
}
armarx
::
nav
::
components
::
Navigator
::
~
Navigator
()
{
}
Navigator
::~
Navigator
()
{
}
void
Navigator
::
onInitComponent
()
{
}
void
armarx
::
nav
::
components
::
Navigator
::
onInitComponent
()
{
}
void
Navigator
::
onConnectComponent
()
{
}
void
Navigator
::
onDisconnectComponent
()
{
}
void
armarx
::
nav
::
components
::
Navigator
::
onConnectComponent
()
{
}
void
Navigator
::
onExitComponent
()
{
}
void
Navigator
::
updateContext
()
{
scene
.
staticScene
=
staticScene
();
scene
.
robot
=
getRobot
();
}
void
armarx
::
nav
::
components
::
Navigator
::
onDisconnectComponent
()
{
}
std
::
string
Navigator
::
getDefaultName
()
const
{
return
"Navigator"
;
}
std
::
vector
<
core
::
Pose
>
convert
(
const
std
::
vector
<
Eigen
::
Matrix4f
>&
wps
)
{
std
::
vector
<
core
::
Pose
>
p
;
p
.
reserve
(
wps
.
size
());
std
::
transform
(
wps
.
begin
(),
wps
.
end
(),
std
::
back_inserter
(
p
),
[](
const
auto
&
p
)
{
return
Eigen
::
Affine3f
(
p
);
});
return
p
;
}
std
::
string
Navigator
::
createConfig
(
const
aron
::
data
::
AronDictPtr
&
stackConfig
,
const
Ice
::
Current
&
)
{
// TODO: Not thread-safe.
const
std
::
string
uuid
=
boost
::
uuids
::
to_string
(
boost
::
uuids
::
random_generator
()());
void
armarx
::
nav
::
components
::
Navigator
::
onExitComponent
()
{
}
server
::
NavigationStack
stack
=
fac
::
NavigationStackFactory
::
create
(
stackConfig
,
scene
);
navigators
.
emplace
(
uuid
,
server
::
Navigator
{
stack
,
scene
,
executor
});
return
uuid
;
}
void
armarx
::
nav
::
components
::
Navigator
::
updateContext
()
{
scene
.
staticScene
=
staticScene
();
scene
.
robot
=
getRobot
();
}
void
Navigator
::
moveTo
(
const
std
::
vector
<
Eigen
::
Matrix4f
>&
waypoints
,
const
std
::
string
&
navigationMode
,
const
std
::
string
&
configId
,
const
Ice
::
Current
&
)
{
// TODO: Error handling.
navigators
.
at
(
configId
).
moveTo
(
convert
(
waypoints
),
core
::
NavigationFramesMap
.
from_name
(
navigationMode
));
}
std
::
string
armarx
::
nav
::
components
::
Navigator
::
getDefaultName
()
const
{
return
"Navigator"
;
}
void
Navigator
::
moveTowards
(
const
Eigen
::
Vector3f
&
direction
,
const
std
::
string
&
navigationMode
,
const
std
::
string
&
configId
,
const
Ice
::
Current
&
)
std
::
vector
<
armarx
::
nav
::
core
::
Pose
>
convert
(
const
std
::
vector
<
Eigen
::
Matrix4f
>&
wps
)
{
std
::
vector
<
core
::
Pose
>
p
;
p
.
reserve
(
wps
.
size
());
std
::
transform
(
wps
.
begin
(),
wps
.
end
(),
std
::
back_inserter
(
p
),
[](
const
auto
&
p
)
{
// TODO: Error handling.
return
Eigen
::
Affine3f
(
p
);
});
return
p
;
}
navigators
.
at
(
configId
).
moveTowards
(
direction
,
core
::
NavigationFramesMap
.
from_name
(
navigationMode
));
}
void
Navigator
::
pauseMovement
(
const
Ice
::
Current
&
)
{
std
::
string
armarx
::
nav
::
components
::
Navigator
::
createConfig
(
const
aron
::
data
::
AronDictPtr
&
stackConfig
,
const
Ice
::
Current
&
)
{
// TODO: Not thread-safe.
const
std
::
string
uuid
=
boost
::
uuids
::
to_string
(
boost
::
uuids
::
random_generator
()());
}
server
::
NavigationStack
stack
=
fac
::
NavigationStackFactory
::
create
(
stackConfig
,
scene
);
navigators
.
emplace
(
uuid
,
server
::
Navigator
{
stack
,
scene
,
executor
});
void
Navigator
::
resumeMovement
(
const
Ice
::
Current
&
)
{
return
uuid
;
}
}
armarx
::
PropertyDefinitionsPtr
Navigator
::
createPropertyDefinitions
()
{
armarx
::
PropertyDefinitionsPtr
def
=
new
ComponentPropertyDefinitions
(
getConfigIdentifier
());
void
armarx
::
nav
::
components
::
Navigator
::
moveTo
(
const
std
::
vector
<
Eigen
::
Matrix4f
>&
waypoints
,
const
std
::
string
&
navigationMode
,
const
std
::
string
&
configId
,
const
Ice
::
Current
&
)
{
// TODO: Error handling.
navigators
.
at
(
configId
).
moveTo
(
convert
(
waypoints
),
core
::
NavigationFramesMap
.
from_name
(
navigationMode
));
}
// Publish to a topic (passing the TopicListenerPrx).
// def->topic(myTopicListener);
// Subscribe to a topic (passing the topic name).
// def->topic<PlatformUnitListener>("MyTopic");
void
armarx
::
nav
::
components
::
Navigator
::
moveTowards
(
const
Eigen
::
Vector3f
&
direction
,
const
std
::
string
&
navigationMode
,
const
std
::
string
&
configId
,
const
Ice
::
Current
&
)
{
// TODO: Error handling.
// Use (and depend on) another component (passing the ComponentInterfacePrx).
def
->
component
(
platformUnit
);
navigators
.
at
(
configId
).
moveTowards
(
direction
,
core
::
NavigationFramesMap
.
from_name
(
navigationMode
));
}
// Add a required property.
// def->required(properties.boxLayerName, "p.box.LayerName", "Name of the box layer in ArViz.");
// Add an optionalproperty.
// def->optional(properties.numBoxes, "p.box.Number", "Number of boxes to draw in ArViz.");
void
armarx
::
nav
::
components
::
Navigator
::
pauseMovement
(
const
Ice
::
Current
&
)
{
return
def
;
}
}
core
::
StaticScene
Navigator
::
staticScene
()
{
core
::
StaticScene
scene
;
objpose
::
ObjectPoseSeq
objectPoses
=
ObjectPoseClientPluginUser
::
getObjectPoses
();
void
armarx
::
nav
::
components
::
Navigator
::
resumeMovement
(
const
Ice
::
Current
&
)
{
scene
.
objects
=
util
::
asSceneObjects
(
objectPoses
);
}
return
scene
;
}
VirtualRobot
::
RobotPtr
Navigator
::
getRobot
()
{
auto
robot
=
RemoteRobot
::
createLocalCloneFromFile
(
getRobotStateComponent
(),
VirtualRobot
::
RobotIO
::
RobotDescription
::
eFull
);
// auto robot = RemoteRobot::createLocalClone(getRobotStateComponent());
ARMARX_CHECK_NOT_NULL
(
robot
);
armarx
::
PropertyDefinitionsPtr
armarx
::
nav
::
components
::
Navigator
::
createPropertyDefinitions
()
{
armarx
::
PropertyDefinitionsPtr
def
=
new
ComponentPropertyDefinitions
(
getConfigIdentifier
());
// Publish to a topic (passing the TopicListenerPrx).
// def->topic(myTopicListener);
// Subscribe to a topic (passing the topic name).
// def->topic<PlatformUnitListener>("MyTopic");
// Use (and depend on) another component (passing the ComponentInterfacePrx).
def
->
component
(
platformUnit
);
// ARMARX_INFO << "Resetting robot";
// robot = VirtualRobot::RobotIO::loadRobot(robot->getFilename());
// Add a required property.
// def->required(properties.boxLayerName, "p.box.LayerName", "Name of the box layer in ArViz.");
// Add an optionalproperty.
// def->optional(properties.numBoxes, "p.box.Number", "Number of boxes to draw in ArViz.");
return
def
;
}
armarx
::
nav
::
core
::
StaticScene
armarx
::
nav
::
components
::
Navigator
::
staticScene
()
{
core
::
StaticScene
scene
;
objpose
::
ObjectPoseSeq
objectPoses
=
ObjectPoseClientPluginUser
::
getObjectPoses
();
scene
.
objects
=
util
::
asSceneObjects
(
objectPoses
);
return
scene
;
}
VirtualRobot
::
RobotPtr
armarx
::
nav
::
components
::
Navigator
::
getRobot
()
{
auto
robot
=
RemoteRobot
::
createLocalCloneFromFile
(
getRobotStateComponent
(),
VirtualRobot
::
RobotIO
::
RobotDescription
::
eFull
);
// auto robot = RemoteRobot::createLocalClone(getRobotStateComponent());
ARMARX_CHECK_NOT_NULL
(
robot
);
RemoteRobot
::
synchronizeLocalClone
(
robot
,
getRobotStateComponent
());
// ARMARX_INFO << "Resetting robot";
// robot = VirtualRobot::RobotIO::loadRobot(robot->getFilename());
return
robot
;
}
RemoteRobot
::
synchronizeLocalClone
(
robot
,
getRobotStateComponent
());
}
// namespace armarx::nav::components
return
robot
;
}
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