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
02d7f25c
Commit
02d7f25c
authored
9 years ago
by
Mirko Wächter
Browse files
Options
Downloads
Patches
Plain Diff
optimized force torque observer performance
parent
4ef6b6fe
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/components/units/ForceTorqueObserver.cpp
+40
-17
40 additions, 17 deletions
source/RobotAPI/components/units/ForceTorqueObserver.cpp
source/RobotAPI/components/units/ForceTorqueObserver.h
+1
-1
1 addition, 1 deletion
source/RobotAPI/components/units/ForceTorqueObserver.h
with
41 additions
and
18 deletions
source/RobotAPI/components/units/ForceTorqueObserver.cpp
+
40
−
17
View file @
02d7f25c
...
...
@@ -125,7 +125,7 @@ void ForceTorqueObserver::visualizerFunction()
float
forceFactor
=
getProperty
<
float
>
(
"ForceVisualizerFactor"
).
getValue
();
RemoteRobot
::
synchronizeLocalClone
(
localRobot
,
robot
);
auto
channels
=
getAvailableChannels
(
false
);
for
(
auto
&
channel
:
channels
)
for
(
auto
&
channel
:
channels
)
{
if
(
localRobot
->
hasRobotNode
(
channel
.
first
))
{
...
...
@@ -164,38 +164,61 @@ PropertyDefinitionsPtr ForceTorqueObserver::createPropertyDefinitions()
}
void
ForceTorqueObserver
::
offerValue
(
std
::
string
nodeName
,
const
std
::
string
&
type
,
FramedDirectionBasePtr
value
,
const
DataFieldIdentifierPtr
&
id
)
void
ForceTorqueObserver
::
offerValue
(
const
std
::
string
&
nodeName
,
const
std
::
string
&
type
,
const
FramedDirectionBasePtr
&
value
,
const
DataFieldIdentifierPtr
&
id
)
{
FramedDirectionPtr
vec
=
FramedDirectionPtr
::
dynamicCast
(
value
);
if
(
!
existsDataField
(
id
->
channelName
,
id
->
datafieldName
))
try
{
if
(
!
existsChannel
(
id
->
channelName
))
{
offerChannel
(
id
->
channelName
,
type
+
" vectors on specific parts of the robot."
);
}
offerDataFieldWithDefault
(
id
->
channelName
,
id
->
datafieldName
,
Variant
(
value
),
"3D vector for "
+
type
+
" of "
+
nodeName
);
setDataFieldFlatCopy
(
id
->
channelName
,
id
->
datafieldName
,
new
Variant
(
value
));
}
else
catch
(...)
{
setDataFieldFlatCopy
(
id
->
channelName
,
id
->
datafieldName
,
new
Variant
(
value
));
ARMARX_INFO
<<
"Creating force/torque fields"
;
if
(
!
existsDataField
(
id
->
channelName
,
id
->
datafieldName
))
{
if
(
!
existsChannel
(
id
->
channelName
))
{
offerChannel
(
id
->
channelName
,
type
+
" vectors on specific parts of the robot."
);
}
offerDataFieldWithDefault
(
id
->
channelName
,
id
->
datafieldName
,
Variant
(
value
),
"3D vector for "
+
type
+
" of "
+
nodeName
);
}
}
// pod = plain old data
std
::
string
pod_channelName
=
id
->
channelName
+
POD_SUFFIX
;
if
(
!
existsChannel
(
pod_channelName
))
try
{
StringVariantBaseMap
values
;
values
[
id
->
datafieldName
+
"_x"
]
=
new
Variant
(
vec
->
x
);
values
[
id
->
datafieldName
+
"_y"
]
=
new
Variant
(
vec
->
y
);
values
[
id
->
datafieldName
+
"_z"
]
=
new
Variant
(
vec
->
z
);
values
[
id
->
datafieldName
+
"_frame"
]
=
new
Variant
(
vec
->
frame
);
setDataFieldsFlatCopy
(
pod_channelName
,
values
);
}
catch
(...)
{
offerChannel
(
pod_channelName
,
id
->
datafieldName
+
" on "
+
nodeName
+
" as plain old data (pod)"
);
ARMARX_INFO
<<
"Creating force/torque pod fields"
;
if
(
!
existsChannel
(
pod_channelName
))
{
offerChannel
(
pod_channelName
,
id
->
datafieldName
+
" on "
+
nodeName
+
" as plain old data (pod)"
);
}
offerOrUpdateDataField
(
pod_channelName
,
id
->
datafieldName
+
"_x"
,
Variant
(
vec
->
x
),
type
+
" on X axis"
);
offerOrUpdateDataField
(
pod_channelName
,
id
->
datafieldName
+
"_y"
,
Variant
(
vec
->
y
),
type
+
" on Y axis"
);
offerOrUpdateDataField
(
pod_channelName
,
id
->
datafieldName
+
"_z"
,
Variant
(
vec
->
z
),
type
+
" on Z axis"
);
offerOrUpdateDataField
(
pod_channelName
,
id
->
datafieldName
+
"_frame"
,
Variant
(
vec
->
frame
),
"Frame of "
+
value
->
frame
);
}
offerOrUpdateDataField
(
pod_channelName
,
id
->
datafieldName
+
"_x"
,
Variant
(
vec
->
x
),
type
+
" on X axis"
);
offerOrUpdateDataField
(
pod_channelName
,
id
->
datafieldName
+
"_y"
,
Variant
(
vec
->
y
),
type
+
" on Y axis"
);
offerOrUpdateDataField
(
pod_channelName
,
id
->
datafieldName
+
"_z"
,
Variant
(
vec
->
z
),
type
+
" on Z axis"
);
offerOrUpdateDataField
(
pod_channelName
,
id
->
datafieldName
+
"_frame"
,
Variant
(
vec
->
frame
),
"Frame of "
+
value
->
frame
);
}
void
armarx
::
ForceTorqueObserver
::
reportSensorValues
(
const
std
::
string
&
sensorNodeName
,
const
FramedDirectionBasePtr
&
forces
,
const
FramedDirectionBasePtr
&
torques
,
const
Ice
::
Current
&
)
...
...
@@ -223,7 +246,7 @@ void armarx::ForceTorqueObserver::reportSensorValues(const std::string& sensorNo
updateChannel
(
id
->
channelName
);
updateChannel
(
id
->
channelName
+
POD_SUFFIX
);
}
catch
(
std
::
exception
&
e
)
catch
(
std
::
exception
&
)
{
ARMARX_ERROR
<<
"Reporting force torque for "
<<
sensorNodeName
<<
" failed! "
;
handleExceptions
();
...
...
This diff is collapsed.
Click to expand it.
source/RobotAPI/components/units/ForceTorqueObserver.h
+
1
−
1
View file @
02d7f25c
...
...
@@ -97,7 +97,7 @@ namespace armarx
DebugDrawerInterfacePrx
debugDrawer
;
PeriodicTask
<
ForceTorqueObserver
>::
pointer_type
visualizerTask
;
void
offerValue
(
std
::
string
nodeName
,
const
std
::
string
&
type
,
FramedDirectionBasePtr
value
,
const
DataFieldIdentifierPtr
&
id
);
void
offerValue
(
const
std
::
string
&
nodeName
,
const
std
::
string
&
type
,
const
FramedDirectionBasePtr
&
value
,
const
DataFieldIdentifierPtr
&
id
);
// ForceTorqueUnitObserverInterface interface
public
:
...
...
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