The mechanism of ammonium perchlorate burning