Skip to content
Snippets Groups Projects

bugfix: platform position controller is turning into wrong direction

Merged Fabian Reister requested to merge fix/platform-rotation into master
1 file
+ 3
17
Compare changes
  • Side-by-side
  • Inline
@@ -80,24 +80,10 @@ namespace armarx
return;
}
const float measuredOrientation = rtGetControlStruct().globalOrientation;
const Eigen::Vector2f measuredPosition = rtGetControlStruct().globalPosition;// + relativeCurrentPosition;
const float measuredOrientation = rtGetControlStruct().globalOrientation;//+ relativeOrientation;
const float targetOrientation = rtGetControlStruct().targetOrientation;
// measured and target orientation are now within bounds [-pi, pi]
// in which orientation to rotate? => angleBetween is not reliable yet!
// float angleBetween = targetOrientation - measuredOrientation;
// angleBetween = simox::math::periodic_clamp(angleBetween, -M_PIf32, M_PIf32);
// targetOrientation = measuredOrientation + angleBetween;
// -> now angleBetween is reliable
pid.update(timeSinceLastIteration.toSecondsDouble(), measuredPosition, rtGetControlStruct().target);
//opid.update(timeSinceLastIteration.toSecondsDouble(), static_cast<double>(updatedOrientation), rtGetControlStruct().targetOrientation);
opid.update(timeSinceLastIteration.toSecondsDouble(), static_cast<double>(measuredOrientation), targetOrientation);
pid.update(timeSinceLastIteration.toSecondsDouble(), rtGetControlStruct().globalPosition, rtGetControlStruct().target);
opid.update(timeSinceLastIteration.toSecondsDouble(), static_cast<double>(measuredOrientation), rtGetControlStruct().targetOrientation);
const Eigen::Rotation2Df global_R_local(-measuredOrientation);
Loading