Function tap::algorithms::ballistics::computeTravelTime
Defined in File ballistics.cpp
Function Documentation
-
bool tap::algorithms::ballistics::computeTravelTime(const modm::Vector3f &targetPosition, float bulletVelocity, float *travelTime, float *turretPitch, const float pitchAxisOffset)
Computes an iterative numerical approximation of the pitch angle to aim the turret in order to hit a given target and the time it will take for that target to be hit, given the velocity of a bullet out of the turret and the position of the target relative to the turret.
- Parameters:
targetPosition – [in] The 3D position of a target in m. Frame requirements: RELATIVE TO PROJECTILE RELEASE POSITION, Z IS OPPOSITE TO GRAVITY.
bulletVelocity – [in] The velocity of the projectile to be fired in m/s.
travelTime – [out] The expected travel time of a turret shot to hit a target from this object’s position.
turretPitch – [out] The pitch angle of the turret to hit the target at the given travel time.
pitchAxisOffset – [in] The distance between the pitch and yaw axes (in meters) as seen from a plane parallel to the ground. A positive offset indicates that the pitch axis is located behind the yaw axis.
- Returns:
Whether or not a valid travel time was found.