Base is Vehicles.FourWheels.Base:
    .doc:"""
    The VehicleAssmebly primarily maps the geometry of the obj-files in the
    Assets folder to the OpenPLX model.
    """

    front_left_wheel becomes BeachBuggy.Assets.Components.WheelBase:
        rim becomes Physics3D.Bodies.RigidBody with BeachBuggy.Assets.RigidBodyDefinitions.fl_wheelBody
    front_right_wheel becomes BeachBuggy.Assets.Components.WheelBase:
        rim becomes Physics3D.Bodies.RigidBody with BeachBuggy.Assets.RigidBodyDefinitions.fr_wheelBody
    rear_left_wheel becomes BeachBuggy.Assets.Components.WheelBase:
        rim becomes Physics3D.Bodies.RigidBody with BeachBuggy.Assets.RigidBodyDefinitions.bl_wheelBody
    rear_right_wheel becomes BeachBuggy.Assets.Components.WheelBase:
        rim becomes Physics3D.Bodies.RigidBody with BeachBuggy.Assets.RigidBodyDefinitions.br_wheelBody

    chassis becomes Vehicles.Chassis.Rigid.Base:
        local_transform.position: {0,0,0}
        body becomes Physics3D.Bodies.RigidBody with BeachBuggy.Assets.RigidBodyDefinitions.chassiBody:
            kinematics.local_transform.position: {0,0,0}
    
    front_suspension is BeachBuggy.Assets.Components.FrontSuspension:
        chassis_body: chassis.body
    rear_suspension is BeachBuggy.Assets.Components.RearSuspension:
        chassis_body: chassis.body

    front_left_suspension becomes Vehicles.Suspensions.Base:
        fl_hub_wheel_c is Physics3D.Interactions.Hinge:
            connectors: [front_left_wheel.rim.fl_hub_wheel_c_connector, front_suspension.fl_hub.fl_hub_wheel_c_connector]
    front_right_suspension becomes Vehicles.Suspensions.Base:
        fr_hub_wheel_c is Physics3D.Interactions.Hinge:
            connectors: [front_right_wheel.rim.fr_hub_wheel_c_connector, front_suspension.fr_hub.fr_hub_wheel_c_connector]
    rear_left_suspension becomes Vehicles.Suspensions.Base:
        bl_tarm_wheel_c is Physics3D.Interactions.Hinge:
            connectors: [rear_suspension.bl_tarm.bl_tarm_wheel_c_connector, rear_left_wheel.rim.bl_tarm_wheel_c_connector]
    rear_right_suspension becomes Vehicles.Suspensions.Base:
        br_tarm_wheel_c is Physics3D.Interactions.Hinge:
            connectors: [rear_suspension.br_tarm.br_tarm_wheel_c_connector, rear_right_wheel.rim.br_tarm_wheel_c_connector]

    left_steering is Physics3D.Interactions.TorsionSpring:
        connectors: front_suspension.fl_aarml_hub_c.connectors
    right_steering is Physics3D.Interactions.TorsionSpring:
        connectors: front_suspension.fr_aarml_hub_c.connectors

    # Define collision group to handle chassis and wheel collisions
    chassis_collision_group is Simulation.CollisionGroup:
        bodies: [rear_suspension.bl_arml, chassis.body, rear_suspension.bl_armu, rear_suspension.br_arml, rear_suspension.bl_rodl, rear_suspension.bl_rodu, rear_suspension.bl_tarm, rear_suspension.br_armu, rear_suspension.br_rodl, rear_suspension.br_rodu, rear_suspension.br_tarm, front_suspension.fl_rodu, front_suspension.fl_hub, front_suspension.fl_aarml, front_suspension.fl_aarmu, front_suspension.fl_rodl, front_suspension.fr_aarml, front_suspension.fr_aarmu, front_suspension.fr_hub, front_suspension.fr_rodl, front_suspension.fr_rodu]

    wheels_collision_group is Simulation.CollisionGroup:
        bodies: [front_left_wheel.rim, rear_left_wheel.rim, front_right_wheel.rim,
                 rear_right_wheel.rim]

    disable_wheel_chassis_collisions is Simulation.DisableCollisionPair:
        group1: chassis_collision_group
        group2: wheels_collision_group

    disable_chassis_chassis_collisions is Simulation.DisableCollisionPair:
        group1: chassis_collision_group
        group2: chassis_collision_group

    # We create a signal interface we can add signals to
    signal_interface is Physics.Signals.SignalInterface:
        enable: true

        steering_left_input is Physics.Signals.Input: left_steering.target_angle_input
        steering_right_input is Physics.Signals.Input: right_steering.target_angle_input

