A robotically assisted self-aligning portable x-ray machine is disclosed. The machine includes an accelerometer in a digital cassette and an accelerometer in the collimator box. Both accelerators are connected to a micro control unit (MCU), which receives the inclination along at least two axes from both accelerometers. The MCU controls a first stepper motor and a second stepper motor to align the collimator box with the cassette according to an x-ray exam protocol. Inclination of the components is based on the exam protocol. Inclination data is recorded on an x-ray image exposed after alignment. The inclination data may be used by a radiologist or a physician in making a diagnosis based on the x-ray image.