// -----------------------------------------------------------------------------
double ChShaftsDriveline4WD::GetWheelTorque(const WheelID& wheel_id) const {
    if (wheel_id.axle() == m_driven_axles[0]) {
        switch (wheel_id.side()) {
            case LEFT:
                return -m_front_differential->GetTorqueReactionOn2() - m_front_clutch->GetTorqueReactionOn1();
            case RIGHT:
                return -m_front_differential->GetTorqueReactionOn3() - m_front_clutch->GetTorqueReactionOn2();
        }
    }

    if (wheel_id.axle() == m_driven_axles[1]) {
        switch (wheel_id.side()) {
            case LEFT:
                return -m_rear_differential->GetTorqueReactionOn2() - m_rear_clutch->GetTorqueReactionOn1();
            case RIGHT:
                return -m_rear_differential->GetTorqueReactionOn3() - m_rear_clutch->GetTorqueReactionOn2();
        }
    }

    return 0;
}
double Generic_Vehicle::GetShockVelocity(const WheelID& wheel_id) const {
    switch (m_suspType) {
        case SuspensionType::SOLID_AXLE:
            return std::static_pointer_cast<ChSolidAxle>(m_suspensions[wheel_id.axle()])
                ->GetShockVelocity(wheel_id.side());
        case SuspensionType::MULTI_LINK:
            return std::static_pointer_cast<ChMultiLink>(m_suspensions[wheel_id.axle()])
                ->GetShockVelocity(wheel_id.side());
        case SuspensionType::DOUBLE_WISHBONE:
            return std::static_pointer_cast<ChDoubleWishbone>(m_suspensions[wheel_id.axle()])
                ->GetShockVelocity(wheel_id.side());
        case SuspensionType::MACPHERSON_STRUT:
            return std::static_pointer_cast<ChMacPhersonStrut>(m_suspensions[wheel_id.axle()])
                ->GetShockVelocity(wheel_id.side());
        default:
            return -1;
    }
}