载入中...
搜索中...
未找到
VehicleTireRuntime.cpp
浏览该文件的文档.
16Result<VehiclePhysicsStatus> synchronize(VehicleEntity& vehicle, std::shared_ptr<VehicleWheelRuntime>& runtime) {
61void driveInputs(physics::TireInput& target, const SuspensionConfig& config, const VehicleEntity::Input& input,
66 driven > 0 && wheel.drive && throttle * target.longitudinalVelocity < std::abs(throttle) * speedLimit;
67 target.driveTorque = driving ? traction * throttle * wheel.radius / static_cast<double>(driven) : 0;
68 target.brakeTorque = config.brakeTorque * (input.handbrake ? 1 : std::clamp(double(input.brake), 0.0, 1.0));
76 // Reserve all candidate storage before commit. Construct receipt state after commit without allocation.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Move-only, single-use collection of validated force requests. @ownership Owns values and handles only...
Definition ForceBatch.h:26
Result< ForceReceipt > commit(World &world, const SimulationStep &step)
Revalidate all planar requests and submit once; rejects consumed or foreign batches.
Definition ForceBatch.cpp:89
Box3D rigid-body world. Script coordinates are meters (Box3D native), unlike 2D World which uses pixe...
Definition World3D.h:47
Box2D world wrapper (2D physics) with pixel-space coordinates. Handles stepping, gravity,...
Definition World.h:44
std::vector< VehicleEntity::SuspensionState::WheelState > candidate
Definition VehicleTireRuntime.cpp:12
std::optional< physics::ForceReceipt > receipt
Definition VehicleTireRuntime.cpp:11
ForceStepStatus
Completion of the world step to which a submitted force batch belongs.
Definition ForceReceipt.h:9
Result< VehiclePhysicsStatus > synchronize(VehicleEntity &vehicle, std::shared_ptr< VehicleWheelRuntime > &runtime)
Definition VehicleTireRuntime.cpp:16
Result< VehiclePhysicsStatus > submissionState(const std::shared_ptr< VehicleWheelRuntime > &runtime, const SimulationStep &step)
Definition VehicleTireRuntime.cpp:31
Result< VehiclePhysicsStatus > commit(physics::World &world, physics::ForceBatch &batch, std::shared_ptr< VehicleWheelRuntime > &runtime, std::vector< VehicleEntity::SuspensionState::WheelState > candidate, const SimulationStep &step)
Definition VehicleTireRuntime.cpp:87
void driveInputs(physics::TireInput &target, const SuspensionConfig &config, const VehicleEntity::Input &input, const SuspensionWheel &wheel, std::size_t driven, double maximumSpeed, double traction)
Definition VehicleTireRuntime.cpp:61
@ Pending
Forces submitted; the world has not completed their step.
@ Cancelled
Restore or destruction cancelled a pending step.
@ PreconditionViolation
Contact-frame sample: +X forward, +Y lateral; ground-relative m/s, N, Nm.
Definition ForceModels.h:109
Caller-owned wheel parameters; stiffness in N per unit slip / radian.
Definition ForceModels.h:101
Suspension and tire parameters owned by the immutable vehicle definition.
Definition VehicleTypes.h:116
float tireFriction
Tire friction coefficient and longitudinal / cornering stiffness in N.
Definition VehicleTypes.h:126
float longitudinalStiffness
Definition VehicleTypes.h:126
float rollingResistance
Rolling-resistance coefficient and maximum brake torque per wheel in Nm.
Definition VehicleTypes.h:128
float wheelInertia
Tire inertia in kg*m^2; all wheels use this definition value.
Definition VehicleTypes.h:124
float corneringStiffness
Definition VehicleTypes.h:126
Wheel mount for 3D ray suspension or 2D top-down tire contact.
Definition VehicleTypes.h:102