The lifter bit is relatively easy.

Trying to get it to figure out which way up the machine is and therefore rotate to touch the floor is the difficult part (I'm aiming for a shovelhead like robot).