Skip to content
Snippets Groups Projects
Commit 6e7277db authored by Manfred Kröhnert's avatar Manfred Kröhnert
Browse files

formatting

parent 71aee38a
No related branches found
No related tags found
No related merge requests found
......@@ -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()
......
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment