At present, the most commonly used harmonic current detection algorithms are the p-q algorithm and the ip-iq algorithm based on the instantaneous reactive power theory. The premise of using the above algorithms is that the three-phase voltage is the ideal sinusoidal voltage. However, harmonic pollution distorts the voltage of the power grid to different degrees, which will affect the detection accuracy and compensation effect of APF. This paper presents a current detection algorithm based on positive sequence fundamental wave extractor, which can avoid the detection of positive sequence fundamental wave voltage of power grid, and can effectively avoid the shortcomings of p-q algorithm and ip-iq algorithm without using PLL, complex coordinate transformation and low-pass filter. In the current control algorithm, according to the characteristic that the gain of the generalized integrator is infinite when resonance occurs, the sinusoidal and cosine instructions can be tracked without static difference, this paper which is based on the generalized integrator adaptively adjusts the coefficients of the generalized integrator to improve the robustness of the current controller. Finally, the simulation model is established by MATLAB, and the simulation results show that the improved harmonic current detection algorithm and control algorithm are advanced and effective.