Skip to content

Chrono vehicle alignment is hardcoded for the sedan model, blocking other Chrono templates #9862

Description

@hakuturu583

Setup

  • CARLA version: ue5-dev @ 0a5ce0d5b (0.10.0), built with -DENABLE_CHRONO=ON from Port the Project Chrono integration from ue4-dev #9861
  • Platform: Ubuntu 22.04
  • Python version: 3.10
  • GPU: NVIDIA RTX 3090
  • GPU Drivers: 580.173.02
  • Unreal Engine: CarlaUnreal/UnrealEngine @ ue5-dev-carla (5.5)

Is your feature request related to a problem? Please describe.

UChronoMovementComponent drives the CARLA actor's transform from the Chrono
simulation, and applies two fixed corrections while doing so
(Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/MovementComponents/ChronoMovementComponent.cpp,
TickComponent):

const auto ChronoPositionOffset = ChVector<>(0, 0, -0.25f);
auto VehiclePos = Vehicle->GetVehiclePos() + ChronoPositionOffset;
...
// adding small rotation to compensate chrono offset
const float ChronoPitchOffset = 2.5f;
NewRotator.Add(ChronoPitchOffset, 0.f, 0.f);

Both constants reconcile the Chrono vehicle origin with the CARLA skeletal mesh
origin, and both are tuned for the one model shipped under
Co-Simulation/Chrono/Vehicles/sedan — a 1250 kg passenger car. They are applied
unconditionally, so any other Chrono vehicle template renders with the wrong ride
height and a constant 2.5 degree pitch. Project Chrono ships a dozen more models
(citybus, longhaul, mtv, MAN_Kat1, hmmwv, uaz, gator, feda,
rccar, …) in share/chrono/data/vehicle/, and those are exactly the cases where
a higher-fidelity dynamics model is most interesting — heavy vehicles, where
CARLA's default Chaos parameters are least representative.

The values cannot be worked around from the client: enable_chrono_physics takes
only substep settings and the three template paths, and the JSON templates have no
say in how the result is mapped back onto the Unreal actor.

For context on the demand for non-sedan Chrono vehicles, see the (template-less,
so closed) #9160.

Describe the solution you'd like

Make the Chrono-to-actor alignment a property of the vehicle rather than a
constant. Either of:

  1. Extra optional arguments on enable_chrono_physics (e.g. position_offset,
    pitch_offset), defaulting to the current values so existing scripts are
    unaffected; or
  2. An optional block in the vehicle JSON that CARLA reads alongside the Chrono
    parse, keeping the alignment next to the model it belongs to.

Deriving the offset instead of configuring it would be better still — the
difference between Vehicle->GetVehiclePos() and the CARLA mesh origin is
computable from the chassis reference frame and the vehicle's bounding box — but a
configurable value would already unblock non-sedan models.

Describe alternatives you've considered

  • Editing the constants and rebuilding per vehicle type. Works, but they are
    global, so a simulation cannot mix a Chrono bus and a Chrono sedan.
  • Compensating on the client by re-setting the actor transform each tick. Fights
    the component, which writes the transform every tick from the Chrono state.
  • Shipping a CARLA-tuned copy of each Chrono template. Does not help: the offsets
    are in C++, not in the templates.

Additional context

Two adjacent hardcodings in the same file, in case they are worth folding into the
same fix:

  • UERayCastTerrain::GetCoefficientFriction() returns 1 unconditionally, so the
    road surface friction of the map never reaches the tire model. Ground height and
    normal are ray-cast from the CARLA world, so only friction is ignored.
  • Calling enable_chrono_physics immediately after spawn_actor is silently a
    no-op: the spawn overlap trips the collision fallback, DisableChronoPhysics()
    reverts to the default physics, and the client sees no error — only a server-side
    Chrono physics does not support collisions yet warning. Letting the vehicle
    settle for a few ticks first avoids it, but the failure is invisible to the
    caller.

All three behaviours predate the UE5 branch; they are inherited from ue4-dev and
are not introduced by #9861, which only makes the existing integration buildable
again.

🤖 Generated with Claude Code

https://claude.ai/code/session_013bSfUeZdAm96gauHK5HJct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions