A perfect obstruction theory for moduli of coherent systems