An example robot includes: a motor disposed within a housing at a joint configured to control motion of a member of a robot; a controller including one or more printed circuit boards (PCBs) disposed within the housing and including a plurality of field-effect transistors (FETs) disposed on a surface of a PCB of the one or more PCBs facing the motor; a rotary position sensor mounted on the controller; a shaft coupled to a rotor of the motor and extending therefrom to the controller; and a magnet mounted within the shaft at an end of the shaft facing the controller.