diff --git a/source/RobotAPI/components/units/KinematicUnitObserver.cpp b/source/RobotAPI/components/units/KinematicUnitObserver.cpp index 413bf4b5a03f1e3f56e5b76d74ba9df5d2f21ca2..8048dbeccd2864c15ba4cc2d9b8be377502d6904 100644 --- a/source/RobotAPI/components/units/KinematicUnitObserver.cpp +++ b/source/RobotAPI/components/units/KinematicUnitObserver.cpp @@ -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() diff --git a/source/RobotAPI/components/units/KinematicUnitObserver.h b/source/RobotAPI/components/units/KinematicUnitObserver.h index 7276da0ddc2832b4eca26eccdf4a244fdb6fd6fd..95debd4f3bf621562ea9bffea8a5822b57bd8aab 100644 --- a/source/RobotAPI/components/units/KinematicUnitObserver.h +++ b/source/RobotAPI/components/units/KinematicUnitObserver.h @@ -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()