Tesla acquires automated machine maker amid factory woes