Skip to content
Snippets Groups Projects
Commit 526e62b6 authored by Armar6Demo's avatar Armar6Demo
Browse files

fixed the onInitComponent() compiling error

parent 2a1f4fc1
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,8 @@ using namespace armarx;
NJointHolonomicPlatformUnitVelocityPassThroughController::NJointHolonomicPlatformUnitVelocityPassThroughController(
RobotUnitPtr prov,
NJointHolonomicPlatformUnitVelocityPassThroughControllerConfigPtr
cfg, const VirtualRobot::RobotPtr&)
cfg, const VirtualRobot::RobotPtr&) :
maxCommandDelay(IceUtil::Time::milliSeconds(500))
{
target = useControlTarget(cfg->platformName, ControlModes::HolonomicPlatformVelocity)->asA<ControlTargetHolonomicPlatformVelocity>();
ARMARX_CHECK_EXPRESSION_W_HINT(target, "The actuator " << cfg->platformName << " has no control mode " << ControlModes::HolonomicPlatformVelocity);
......@@ -44,9 +45,10 @@ void NJointHolonomicPlatformUnitVelocityPassThroughController::rtRun(const IceUt
{
auto commandAge = sensorValuesTimestamp - rtGetControlStruct().commandTimestamp;
if (commandAge > maxCommandDelay) // command must be recent
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";
throw LocalException("Platform target velocity was not set for a too long time: delay: ") << commandAge.toSecondsDouble() << " s, max allowed delay: " << maxCommandDelay.toSecondsDouble() << " s";
}
else
{
......
......@@ -81,9 +81,7 @@ namespace armarx
void setMaxCommandDelay(const IceUtil::Time& value);
protected:
void onInitComponent() override {}
void onConnectComponent() override {}
IceUtil::Time maxCommandDelay = IceUtil::Time::milliSeconds(500);
IceUtil::Time maxCommandDelay;
ControlTargetHolonomicPlatformVelocity* target;
NJointHolonomicPlatformUnitVelocityPassThroughControllerControlData initialSettings;
......
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