|
JSim 2026.06.01-p(1)
|
Computes a Magnus lift force from linear velocity and spin. More...
#include <magnus_model.hpp>
Public Member Functions | |
| MagnusModel (double magnus_coefficient=1.0e-4) | |
| Creates a Magnus-force model with the given coefficient. | |
| double | magnusCoefficient () const |
| Returns the current Magnus coefficient. | |
| void | setMagnusCoefficient (double coefficient) |
| Updates the Magnus coefficient used by computeForce(). | |
| Vector3 | computeForce (const Vector3 &velocity_mps, const Vector3 &spin_radps) const |
| Computes the lift force produced by the supplied velocity and spin. | |
Computes a Magnus lift force from linear velocity and spin.
This model is intentionally small: it just wraps the shared Vector3::magnusForce helper behind a configurable scalar coefficient so the same lift formulation can be reused by game-piece, shot, and simulation code without duplicating the cross-product math.
The input vectors use the world frame convention used throughout JSim and WPILib: +X points away from the blue alliance wall downfield, +Y points to the left when looking from the blue alliance end, and +Z points upward.
|
inlineexplicit |
Creates a Magnus-force model with the given coefficient.
| magnus_coefficient | Scalar applied to the omega x v lift term. The default matches the rest of the physics code and is tuned for SI inputs (meters per second and radians per second). |
|
inline |
Computes the lift force produced by the supplied velocity and spin.
| velocity_mps | Linear velocity vector in meters per second, expressed in the world frame. |
| spin_radps | Angular velocity vector in radians per second, expressed in the same frame as velocity_mps. Both vectors must be expressed in the same reference frame, because the result is the cross product omega x v scaled by the model coefficient. The returned force uses the model F = k * (omega x v), where k is magnusCoefficient(). |
|
inline |
Returns the current Magnus coefficient.
|
inline |
Updates the Magnus coefficient used by computeForce().
| coefficient | New scalar multiplier for the lift term. |