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
Container Registry
Model registry
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
RobotAPI
Commits
6e7277db
Commit
6e7277db
authored
10 years ago
by
Manfred Kröhnert
Browse files
Options
Downloads
Patches
Plain Diff
formatting
parent
71aee38a
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/components/units/KinematicUnitObserver.cpp
+27
-27
27 additions, 27 deletions
source/RobotAPI/components/units/KinematicUnitObserver.cpp
source/RobotAPI/components/units/KinematicUnitObserver.h
+4
-1
4 additions, 1 deletion
source/RobotAPI/components/units/KinematicUnitObserver.h
with
31 additions
and
28 deletions
source/RobotAPI/components/units/KinematicUnitObserver.cpp
+
27
−
27
View file @
6e7277db
...
...
@@ -44,7 +44,7 @@ using namespace armarx;
// ********************************************************************
void
KinematicUnitObserver
::
onInitObserver
()
{
// read names of kinematic chain elements belonging to this unit from XML and setup a map of all joints
// read names of kinematic chain elements belonging to this unit from XML and setup a map of all joints
// the kinematic chain elements belonging to this unit are defined in a RobotNodeSet
std
::
string
robotFile
=
getProperty
<
std
::
string
>
(
"RobotFileName"
).
getValue
();
robotNodeSetName
=
getProperty
<
std
::
string
>
(
"RobotNodeSetName"
).
getValue
();
...
...
@@ -64,16 +64,16 @@ void KinematicUnitObserver::onInitObserver()
std
::
vector
<
VirtualRobot
::
RobotNodePtr
>
robotNodes
;
robotNodes
=
robotNodeSetPtr
->
getAllRobotNodes
();
// register all channels
offerChannel
(
"jointangles"
,
"Joint values of the "
+
robotNodeSetName
+
" kinematic chain"
);
offerChannel
(
"jointvelocities"
,
"Joint velocities of the "
+
robotNodeSetName
+
"kinematic chain"
);
offerChannel
(
"jointtorques"
,
"Joint torques of the"
+
robotNodeSetName
+
" kinematic chain"
);
offerChannel
(
"jointcurrents"
,
"Joint currents of the "
+
robotNodeSetName
+
" kinematic chain"
);
// register all channels
offerChannel
(
"jointangles"
,
"Joint values of the "
+
robotNodeSetName
+
" kinematic chain"
);
offerChannel
(
"jointvelocities"
,
"Joint velocities of the "
+
robotNodeSetName
+
"kinematic chain"
);
offerChannel
(
"jointtorques"
,
"Joint torques of the"
+
robotNodeSetName
+
" kinematic chain"
);
offerChannel
(
"jointcurrents"
,
"Joint currents of the "
+
robotNodeSetName
+
" kinematic chain"
);
offerChannel
(
"jointmotortemperatures"
,
"Joint motor temperatures of the "
+
robotNodeSetName
+
" kinematic chain"
);
offerChannel
(
"jointcontrolmodes"
,
"Joint motor temperatures of the "
+
robotNodeSetName
+
" kinematic chain"
);
// register all data fields
// register all data fields
for
(
std
::
vector
<
VirtualRobot
::
RobotNodePtr
>::
iterator
it
=
robotNodes
.
begin
();
it
!=
robotNodes
.
end
();
it
++
)
{
std
::
string
jointName
=
(
*
it
)
->
getName
();
...
...
@@ -81,21 +81,21 @@ void KinematicUnitObserver::onInitObserver()
offerDataFieldWithDefault
(
"jointcontrolmodes"
,
jointName
,
ControlModeToString
(
eUnknown
),
"Controlmode of the "
+
jointName
+
" joint"
);
offerDataField
(
"jointangles"
,
jointName
,
VariantType
::
Float
,
"Joint angle of the "
+
jointName
+
" joint in radians"
);
offerDataField
(
"jointvelocities"
,
jointName
,
VariantType
::
Float
,
"Joint velocity of the "
+
jointName
+
" joint"
);
offerDataField
(
"jointtorques"
,
jointName
,
VariantType
::
Float
,
"Joint torque of the "
+
jointName
+
" joint"
);
offerDataField
(
"jointcurrents"
,
jointName
,
VariantType
::
Float
,
"Joint current of the "
+
jointName
+
" joint"
);
offerDataField
(
"jointmotortemperatures"
,
jointName
,
VariantType
::
Float
,
"Joint motor temperature of the "
+
jointName
+
" joint"
);
}
offerDataField
(
"jointtorques"
,
jointName
,
VariantType
::
Float
,
"Joint torque of the "
+
jointName
+
" joint"
);
offerDataField
(
"jointcurrents"
,
jointName
,
VariantType
::
Float
,
"Joint current of the "
+
jointName
+
" joint"
);
offerDataField
(
"jointmotortemperatures"
,
jointName
,
VariantType
::
Float
,
"Joint motor temperature of the "
+
jointName
+
" joint"
);
}
updateChannel
(
"jointcontrolmodes"
);
// register all checks
// register all checks
offerConditionCheck
(
"valid"
,
new
ConditionCheckValid
());
offerConditionCheck
(
"updated"
,
new
ConditionCheckUpdated
());
offerConditionCheck
(
"equals"
,
new
ConditionCheckEquals
());
offerConditionCheck
(
"inrange"
,
new
ConditionCheckInRange
());
offerConditionCheck
(
"larger"
,
new
ConditionCheckLarger
());
offerConditionCheck
(
"smaller"
,
new
ConditionCheckSmaller
());
usingTopic
(
robotNodeSetName
+
"State"
);
offerConditionCheck
(
"inrange"
,
new
ConditionCheckInRange
());
offerConditionCheck
(
"larger"
,
new
ConditionCheckLarger
());
offerConditionCheck
(
"smaller"
,
new
ConditionCheckSmaller
());
usingTopic
(
robotNodeSetName
+
"State"
);
}
void
KinematicUnitObserver
::
onConnectObserver
()
...
...
@@ -123,10 +123,10 @@ void KinematicUnitObserver::reportJointAngles(const NameValueMap& jointAngles,
{
if
(
jointAngles
.
size
()
==
0
)
return
;
nameValueMapToDataFields
(
"jointangles"
,
jointAngles
);
nameValueMapToDataFields
(
"jointangles"
,
jointAngles
);
updateChannel
(
"jointangles"
);
updateChannel
(
"jointangles"
);
}
void
KinematicUnitObserver
::
reportJointVelocities
(
const
NameValueMap
&
jointVelocities
,
bool
aValueChanged
,
const
Ice
::
Current
&
c
)
...
...
@@ -134,7 +134,7 @@ void KinematicUnitObserver::reportJointVelocities(const NameValueMap& jointVeloc
if
(
jointVelocities
.
size
()
==
0
)
return
;
nameValueMapToDataFields
(
"jointvelocities"
,
jointVelocities
);
updateChannel
(
"jointvelocities"
);
updateChannel
(
"jointvelocities"
);
}
void
KinematicUnitObserver
::
reportJointTorques
(
const
NameValueMap
&
jointTorques
,
bool
aValueChanged
,
const
Ice
::
Current
&
c
)
...
...
@@ -142,7 +142,7 @@ void KinematicUnitObserver::reportJointTorques(const NameValueMap& jointTorques,
if
(
jointTorques
.
size
()
==
0
)
return
;
nameValueMapToDataFields
(
"jointtorques"
,
jointTorques
);
updateChannel
(
"jointtorques"
);
updateChannel
(
"jointtorques"
);
}
void
KinematicUnitObserver
::
reportJointCurrents
(
const
NameValueMap
&
jointCurrents
,
bool
aValueChanged
,
const
Ice
::
Current
&
c
)
...
...
@@ -150,7 +150,7 @@ void KinematicUnitObserver::reportJointCurrents(const NameValueMap& jointCurrent
if
(
jointCurrents
.
size
()
==
0
)
return
;
nameValueMapToDataFields
(
"jointcurrents"
,
jointCurrents
);
updateChannel
(
"jointcurrents"
);
updateChannel
(
"jointcurrents"
);
}
void
KinematicUnitObserver
::
reportJointMotorTemperatures
(
const
NameValueMap
&
jointMotorTemperatures
,
bool
aValueChanged
,
const
Ice
::
Current
&
c
)
...
...
@@ -170,13 +170,13 @@ void KinematicUnitObserver::reportJointStatuses(const NameStatusMap &jointStatus
// ********************************************************************
void
KinematicUnitObserver
::
nameValueMapToDataFields
(
const
std
::
string
&
channelName
,
const
NameValueMap
&
nameValueMap
)
{
NameValueMap
::
const_iterator
iter
=
nameValueMap
.
begin
();
NameValueMap
::
const_iterator
iter
=
nameValueMap
.
begin
();
while
(
iter
!=
nameValueMap
.
end
())
{
while
(
iter
!=
nameValueMap
.
end
())
{
setDataFieldFlatCopy
(
channelName
,
iter
->
first
,
new
Variant
(
iter
->
second
));
iter
++
;
}
iter
++
;
}
}
PropertyDefinitionsPtr
KinematicUnitObserver
::
createPropertyDefinitions
()
...
...
This diff is collapsed.
Click to expand it.
source/RobotAPI/components/units/KinematicUnitObserver.h
+
4
−
1
View file @
6e7277db
...
...
@@ -70,7 +70,10 @@ namespace armarx
void
reportJointMotorTemperatures
(
const
NameValueMap
&
jointMotorTemperatures
,
bool
aValueChanged
,
const
Ice
::
Current
&
c
=
::
Ice
::
Current
());
void
reportJointStatuses
(
const
NameStatusMap
&
jointStatuses
,
bool
aValueChanged
,
const
Ice
::
Current
&
c
=
::
Ice
::
Current
());
virtual
std
::
string
getDefaultName
()
const
{
return
"KinematicUnitObserver"
;
};
virtual
std
::
string
getDefaultName
()
const
{
return
"KinematicUnitObserver"
;
}
/**
* @see PropertyUser::createPropertyDefinitions()
...
...
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