Active inference for adaptive and fault tolerant control