<?xml version="1.0"?>
<motor_driver xmlns:xi="http://www.w3.org/2001/XInclude">

    <motor
            pole_pairs="11"
            speed_constant="134"
            torque_constant="71.2/1000.0"
            max_winding_current="100.0"
            max_motor_speed="5000"
            max_winding_temperature="125"
            winding_resistance="0.216"
            winding_inductance="0.232/1000.0"
            torque_temp_constant="nan"
            velocity_temp_constant="nan"
    />

    <thermal_model
            housing_thermal_resistance="1.87"
            winding_thermal_resistance="1.43"
            housing_thermal_time_const="278"
            winding_thermal_time_const="27.7"
            temperature_source="SENSOR"
            model_start_percentage="0.5"
    />

    <!-- Valid Modes: DISABLED, BLOCK_COMMUTATION, FOC, SINUSOIDAL_CONTROL-->
    <controller 
        mode="FOC" 
        overmodulation="1.15">
        <foc_iq_gains 
            k="0.76" 
            ki="0.07" 
            i_clamp="8.0"
        />
        <foc_id_gains 
            k="0.76" 
            ki="0.07" 
            i_clamp="8.0"
        />
    </controller>

    <encoders 
        motor_encoder="B1" 
        output_encoder="NONE" 
        deflection_encoder="NONE" 
        torque_source="CURRENT_ESTIMATE">
        <hall_switches 
            direction="REVERSE" 
            absolute="true" 
            ticks_per_revolution="66.0" 
            position_filter_size="1.0" 
            velocity_filter_size="1.0"
        />
        <encoder_a1 type="NONE" calibration_type="NONE"/>
        <encoder_a2 type="NONE" calibration_type="NONE"/>
        <encoder_b1 
            type="SPI_AS5047U" 
            calibration_type="OFFSET" 
            direction="REVERSE" 
            absolute="true" 
            ticks_per_revolution="16384.0" 
            position_filter_size="1.0" 
            velocity_filter_size="1.0" 
            calibration_offset="0.199"
        />
        <encoder_b2 type="NONE" calibration_type="NONE"/>
    </encoders>

    <board 
        min_duty_cycle="0.05" 
        max_duty_cycle="0.95" 
        max_board_current="50.0" 
        switching_frequency_hz="97660.0" 
        current_sense_threshold_vds="880.0" 
        current_sense_threshold_winding="200.0" 
        current_sense_gain="40.0" 
        current_filter_size="10.0" 
        control_divider="8" 
        winding_order="CBA" 
        hall_order="ABC"
    />

    <board_calibration 
        offset_i_a="nan" 
        offset_i_b="nan" 
        offset_i_c="nan" 
        offset_i_bus="nan" 
        offset_v_a="0.0" 
        offset_v_b="0.0" 
        offset_v_c="0.0"
    />

    <gear_train 
        gear_ratio_numerator="1" 
        gear_ratio_denominator="1"
        efficiency="1.0" 
        max_output_torque="0.0"
    />
</motor_driver>