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
8eb05916
Commit
8eb05916
authored
9 years ago
by
Mirko Wächter
Browse files
Options
Downloads
Patches
Plain Diff
added sync to timestamp function to remoterobot
parent
339ae814
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/RobotAPI/libraries/core/remoterobot/RemoteRobot.cpp
+40
-0
40 additions, 0 deletions
source/RobotAPI/libraries/core/remoterobot/RemoteRobot.cpp
source/RobotAPI/libraries/core/remoterobot/RemoteRobot.h
+11
-4
11 additions, 4 deletions
source/RobotAPI/libraries/core/remoterobot/RemoteRobot.h
with
51 additions
and
4 deletions
source/RobotAPI/libraries/core/remoterobot/RemoteRobot.cpp
+
40
−
0
View file @
8eb05916
...
...
@@ -155,6 +155,11 @@ namespace armarx
return
p
->
toEigen
();
// convert to eigen first
}
SharedRobotInterfacePrx
RemoteRobot
::
getSharedRobot
()
const
{
return
this
->
_robot
;
}
string
RemoteRobot
::
getName
()
{
return
_robot
->
getName
();
...
...
@@ -397,6 +402,40 @@ namespace armarx
return
true
;
}
bool
RemoteRobot
::
synchronizeLocalCloneToTimestamp
(
RobotPtr
robot
,
RobotStateComponentInterfacePrx
robotStatePrx
,
Ice
::
Long
timestamp
)
{
if
(
!
robotStatePrx
||
!
robot
)
{
ARMARX_ERROR_S
<<
"NULL data. Aborting..."
<<
endl
;
return
false
;
}
RobotConfigPtr
c
(
new
RobotConfig
(
robot
,
"synchronizeLocalClone"
));
RobotStateConfig
config
=
robotStatePrx
->
getRobotStateAtTimestamp
(
timestamp
);
if
(
config
.
jointMap
.
empty
())
{
return
false
;
}
for
(
NameValueMap
::
const_iterator
it
=
config
.
jointMap
.
begin
();
it
!=
config
.
jointMap
.
end
();
it
++
)
{
// joint values
const
std
::
string
&
jointName
=
it
->
first
;
float
jointAngle
=
it
->
second
;
if
(
!
c
->
setConfig
(
jointName
,
jointAngle
))
{
ARMARX_WARNING_S
<<
"Joint not known in local copy:"
<<
jointName
<<
". Skipping..."
<<
endl
;
}
}
robot
->
setConfig
(
c
);
auto
pose
=
PosePtr
::
dynamicCast
(
config
.
globalPose
);
robot
->
setGlobalPose
(
pose
->
toEigen
());
return
true
;
}
// Private (unused methods)
...
...
@@ -426,4 +465,5 @@ namespace armarx
}
}
}
This diff is collapsed.
Click to expand it.
source/RobotAPI/libraries/core/remoterobot/RemoteRobot.h
+
11
−
4
View file @
8eb05916
...
...
@@ -171,10 +171,7 @@ namespace armarx
/// Use this method to share the robot instance over Ice.
inline
SharedRobotInterfacePrx
getSharedRobot
()
{
return
this
->
_robot
;
}
SharedRobotInterfacePrx
getSharedRobot
()
const
;
std
::
string
getName
();
...
...
@@ -192,11 +189,21 @@ namespace armarx
/*!
Use this method to synchronize (i.e. copy the joint values) from the remote robot to the local clone.
The local clone must have the identical structure as the remote robot model, otherwise an error will be reported.
This is the fastest way to get update a local robot.
*/
static
bool
synchronizeLocalClone
(
VirtualRobot
::
RobotPtr
robot
,
RobotStateComponentInterfacePrx
robotStatePrx
);
static
bool
synchronizeLocalClone
(
VirtualRobot
::
RobotPtr
robot
,
SharedRobotInterfacePrx
sharedRobotPrx
);
/**
* @brief Synchronizes a local robot to a robot state at timestamp.
* @param robot Local robot that should be updated
* @param robotStatePrx Proxy to the RobotStateComponent
* @param timestamp Timestamp to which the local robot should be sychronized. Must be in range of the state history of the RobotStateComponent.
* @return True if successfully synced.
*/
static
bool
synchronizeLocalCloneToTimestamp
(
VirtualRobot
::
RobotPtr
robot
,
RobotStateComponentInterfacePrx
robotStatePrx
,
Ice
::
Long
timestamp
);
// VirtualRobot::RobotPtr getRobotPtr() { return shared_from_this();} // only for debugging
//! Clones the structure of this remote robot to a local instance
...
...
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