Can adults with cognitive impairment consent to take part in research?

Can adults with cognitive impairment consent to take part in research?