Skip to content
Snippets Groups Projects
Commit 0e77107f authored by Fabian Reister's avatar Fabian Reister
Browse files

/KinematicUnitSimulation: +getDebugInfo

parent 1fe5cf25
No related branches found
No related tags found
1 merge request!273Kinematic Unit: new method to retrieve debug / all info at once
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <ArmarXCore/core/system/ArmarXDataPath.h> #include <ArmarXCore/core/system/ArmarXDataPath.h>
#include <ArmarXCore/core/time/TimeUtil.h> #include <ArmarXCore/core/time/TimeUtil.h>
#include <ArmarXCore/core/util/algorithm.h> #include <ArmarXCore/core/util/algorithm.h>
#include <RobotAPI/interface/units/KinematicUnitInterface.h>
#include <algorithm> #include <algorithm>
...@@ -472,6 +473,26 @@ Ice::StringSeq KinematicUnitSimulation::getJoints(const Ice::Current& c) const ...@@ -472,6 +473,26 @@ Ice::StringSeq KinematicUnitSimulation::getJoints(const Ice::Current& c) const
return getMapKeys(sensorAngles); return getMapKeys(sensorAngles);
} }
DebugInfo KinematicUnitSimulation::getDebugInfo(const Ice::Current& c) const
{
std::lock_guard g{jointStatesMutex};
DebugInfo debugInfo;
for(const auto& [jointName, info]: jointStates)
{
debugInfo.jointAngles[jointName] = info.angle;
debugInfo.jointVelocities[jointName] = info.velocity;
debugInfo.jointMotorTemperatures[jointName] = info.temperature;
debugInfo.jointTorques[jointName] = info.torque;
debugInfo.jointModes[jointName] = info.controlMode;
};
return debugInfo;
}
bool mapEntryEqualsString(std::pair<std::string, KinematicUnitSimulationJointState> iter, std::string compareString) bool mapEntryEqualsString(std::pair<std::string, KinematicUnitSimulationJointState> iter, std::string compareString)
{ {
...@@ -499,4 +520,3 @@ void KinematicUnitSimulation::releaseJoints(const Ice::StringSeq& joints, const ...@@ -499,4 +520,3 @@ void KinematicUnitSimulation::releaseJoints(const Ice::StringSeq& joints, const
KinematicUnit::release(c); KinematicUnit::release(c);
} }
} }
...@@ -160,6 +160,8 @@ namespace armarx ...@@ -160,6 +160,8 @@ namespace armarx
armarx::NameValueMap getJointVelocities(const Ice::Current& c) const override; armarx::NameValueMap getJointVelocities(const Ice::Current& c) const override;
Ice::StringSeq getJoints(const Ice::Current& c) const override; Ice::StringSeq getJoints(const Ice::Current& c) const override;
DebugInfo getDebugInfo(const Ice::Current& c = Ice::emptyCurrent) const override;
/// @see PropertyUser::createPropertyDefinitions() /// @see PropertyUser::createPropertyDefinitions()
PropertyDefinitionsPtr createPropertyDefinitions() override; PropertyDefinitionsPtr createPropertyDefinitions() override;
...@@ -167,7 +169,7 @@ namespace armarx ...@@ -167,7 +169,7 @@ namespace armarx
KinematicUnitSimulationJointStates jointStates; KinematicUnitSimulationJointStates jointStates;
KinematicUnitSimulationJointStates previousJointStates; KinematicUnitSimulationJointStates previousJointStates;
KinematicUnitSimulationJointInfos jointInfos; KinematicUnitSimulationJointInfos jointInfos;
std::mutex jointStatesMutex; mutable std::mutex jointStatesMutex;
IceUtil::Time lastExecutionTime; IceUtil::Time lastExecutionTime;
float noise; float noise;
int intervalMs; int intervalMs;
...@@ -180,7 +182,5 @@ namespace armarx ...@@ -180,7 +182,5 @@ namespace armarx
mutable std::mutex sensorDataMutex; mutable std::mutex sensorDataMutex;
NameValueMap sensorAngles; NameValueMap sensorAngles;
NameValueMap sensorVelocities; NameValueMap sensorVelocities;
}; };
} }
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