Smart leg brace locks and unlocks knee automatically