Pose3f KickViewMath::calculateHandPos(const JointAngles& jointAngles, const Joints::Joint& joint, const RobotDimensions& robotDimensions) { Pose3f handPos; float sign = joint == Joints::lShoulderPitch ? 1.f : -1.f; handPos.translate(robotDimensions.armOffset.x(), sign * robotDimensions.armOffset.y(), robotDimensions.armOffset.z()); handPos.rotateY(-jointAngles.angles[joint]); handPos.rotateZ(sign * jointAngles.angles[joint + 1]); handPos.translate(robotDimensions.upperArmLength, 0, 0); handPos.rotateX(jointAngles.angles[joint + 2] * sign); handPos.rotateZ(sign * jointAngles.angles[joint + 3]); return handPos; }