Skip to content
Snippets Groups Projects
Commit 67aa1caa authored by Lukas Kaul's avatar Lukas Kaul
Browse files

RobotStateComponent: Fixed segfault in reportJointAngles

parent ebb90003
No related branches found
No related tags found
No related merge requests found
...@@ -253,7 +253,7 @@ namespace armarx ...@@ -253,7 +253,7 @@ namespace armarx
float influenceNext = 1.0f - (float)(it->first - time) / deltaT; float influenceNext = 1.0f - (float)(it->first - time) / deltaT;
float influencePrev = 1.0f - (float)(time - prevIt->first) / deltaT; float influencePrev = 1.0f - (float)(time - prevIt->first) / deltaT;
auto jointIt = prevIt->second.jointMap.begin(); auto jointIt = prevIt->second.jointMap.begin();
for (auto & joint : config.jointMap) for (auto& joint : config.jointMap)
{ {
joint.second = joint.second * influenceNext + jointIt->second * influencePrev; joint.second = joint.second * influenceNext + jointIt->second * influencePrev;
jointIt++; jointIt++;
...@@ -279,11 +279,11 @@ namespace armarx ...@@ -279,11 +279,11 @@ namespace armarx
void RobotStateComponent::reportJointAngles(const NameValueMap& jointAngles, Ice::Long timestamp, bool aValueChanged, const Current& c) void RobotStateComponent::reportJointAngles(const NameValueMap& jointAngles, Ice::Long timestamp, bool aValueChanged, const Current& c)
{ {
// IceUtil::Time start = IceUtil::Time::now();
if (timestamp <= 0) if (timestamp <= 0)
{ {
timestamp = IceUtil::Time::now().toMicroSeconds(); timestamp = IceUtil::Time::now().toMicroSeconds();
} }
if (aValueChanged) if (aValueChanged)
{ {
{ {
...@@ -311,18 +311,16 @@ namespace armarx ...@@ -311,18 +311,16 @@ namespace armarx
_sharedRobotServant->setTimestamp(IceUtil::Time::microSeconds(timestamp)); _sharedRobotServant->setTimestamp(IceUtil::Time::microSeconds(timestamp));
} }
history[timestamp] = {timestamp, RobotStateConfig config;
new FramedPose(_synchronized->getGlobalPose(), GlobalFrame, ""), config.timestamp = timestamp;
jointAngles config.globalPose = new FramedPose(_synchronized->getGlobalPose(), GlobalFrame, "");
}; config.jointMap = jointAngles;
history[timestamp] = config;
if (history.size() > historyLength) if (history.size() > historyLength)
{ {
history.erase(history.begin()); history.erase(history.begin());
} }
// ARMARX_VERBOSE << deactivateSpam(2) << "my duration: " << (IceUtil::Time::now() - start).toMicroSecondsDouble() << " ms";
} }
std::string RobotStateComponent::getRobotFilename(const Ice::Current&) const std::string RobotStateComponent::getRobotFilename(const Ice::Current&) const
...@@ -341,7 +339,7 @@ namespace armarx ...@@ -341,7 +339,7 @@ namespace armarx
auto packages = armarx::Application::GetProjectDependencies(); auto packages = armarx::Application::GetProjectDependencies();
packages.push_back(Application::GetProjectName()); packages.push_back(Application::GetProjectName());
for (const std::string & projectName : packages) for (const std::string& projectName : packages)
{ {
if (projectName.empty()) if (projectName.empty())
{ {
......
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