Skip to content
Snippets Groups Projects
Commit ad68bd49 authored by Tobias Gröger's avatar Tobias Gröger
Browse files

Fix set current velocity in controller pre activate

parent 256e8b12
No related branches found
No related tags found
1 merge request!451Improve armar7 platform movement
Pipeline #19077 failed
...@@ -50,14 +50,13 @@ namespace armarx ...@@ -50,14 +50,13 @@ namespace armarx
void void
NJointHolonomicPlatformVelocityControllerWithRamp::rtPreActivateController() NJointHolonomicPlatformVelocityControllerWithRamp::rtPreActivateController()
{ {
const float velX = velocitySensor->velocityX; activationVelocity(0) = velocitySensor->velocityX;
const float velY = velocitySensor->velocityY; activationVelocity(1) = velocitySensor->velocityY;
const float velRot = velocitySensor->velocityRotation; activationVelocity(2) = velocitySensor->velocityRotation;
activationTime = IceUtil::Time::now();
// init velocity ramp // init velocity ramp
ramp.init(Eigen::Vector3f(velX, velY, velRot)); ramp.init(activationVelocity);
setVelocites(velX, velY, velRot);
} }
void void
...@@ -79,11 +78,19 @@ namespace armarx ...@@ -79,11 +78,19 @@ namespace armarx
} }
else else
{ {
Eigen::Vector3f x(rtGetControlStruct().velocityX, Eigen::Vector3f result;
rtGetControlStruct().velocityY, if (activationTime > rtGetControlStruct().commandTimestamp)
rtGetControlStruct().velocityRotation); {
result = ramp.update(activationVelocity, timeSinceLastIteration.toSecondsDouble());
}
else
{
Eigen::Vector3f x(rtGetControlStruct().velocityX,
rtGetControlStruct().velocityY,
rtGetControlStruct().velocityRotation);
result = ramp.update(x, timeSinceLastIteration.toSecondsDouble());
}
Eigen::VectorXf result = ramp.update(x, timeSinceLastIteration.toSecondsDouble());
target->velocityX = result(0); target->velocityX = result(0);
target->velocityY = result(1); target->velocityY = result(1);
target->velocityRotation = result(2); target->velocityRotation = result(2);
......
...@@ -93,6 +93,9 @@ namespace armarx ...@@ -93,6 +93,9 @@ namespace armarx
protected: protected:
Cartesian2DimVelocityRamp ramp; Cartesian2DimVelocityRamp ramp;
Eigen::Vector3f activationVelocity;
IceUtil::Time activationTime;
ControlTargetHolonomicPlatformVelocity* target; ControlTargetHolonomicPlatformVelocity* target;
const SensorValueHolonomicPlatformVelocity* velocitySensor; const SensorValueHolonomicPlatformVelocity* velocitySensor;
}; };
......
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