Skip to content
Snippets Groups Projects

Improve armar7 platform movement

Merged Tobias Gröger requested to merge feature/improve-armar7-platform-movement into master
All threads resolved!
1 file
+ 21
21
Compare changes
  • Side-by-side
  • Inline
@@ -73,29 +73,29 @@ namespace armarx
const IceUtil::Time& sensorValuesTimestamp,
const IceUtil::Time& timeSinceLastIteration)
{
auto commandAge = sensorValuesTimestamp - rtGetControlStruct().commandTimestamp;
// auto commandAge = sensorValuesTimestamp - rtGetControlStruct().commandTimestamp;
if (commandAge > maxCommandDelay && // command must be recent
(rtGetControlStruct().velocityX != 0.0f || rtGetControlStruct().velocityY != 0.0f ||
rtGetControlStruct().velocityRotation !=
0.0f)) // only throw error if any command is not zero
{
throw LocalException(
"Platform target velocity was not set for a too long time: delay: ")
<< commandAge.toSecondsDouble()
<< " s, max allowed delay: " << maxCommandDelay.toSecondsDouble() << " s";
}
else
{
Eigen::VectorXf x(6);
x << rtGetControlStruct().velocityX, rtGetControlStruct().velocityY, 0, 0, 0,
rtGetControlStruct().velocityRotation;
// if (commandAge > maxCommandDelay && // command must be recent
// (rtGetControlStruct().velocityX != 0.0f || rtGetControlStruct().velocityY != 0.0f ||
// rtGetControlStruct().velocityRotation !=
// 0.0f)) // only throw error if any command is not zero
// {
// throw LocalException(
// "Platform target velocity was not set for a too long time: delay: ")
// << commandAge.toSecondsDouble()
// << " s, max allowed delay: " << maxCommandDelay.toSecondsDouble() << " s";
// }
// else
// {
Eigen::VectorXf x(6);
x << rtGetControlStruct().velocityX, rtGetControlStruct().velocityY, 0, 0, 0,
rtGetControlStruct().velocityRotation;
Eigen::VectorXf result = ramp.update(x, timeSinceLastIteration.toSecondsDouble());
target->velocityX = result(0);
target->velocityY = result(1);
target->velocityRotation = result(5);
}
Eigen::VectorXf result = ramp.update(x, timeSinceLastIteration.toSecondsDouble());
target->velocityX = result(0);
target->velocityY = result(1);
target->velocityRotation = result(5);
// }
}
void
Loading