A system including an input sensor, a summer, a controller, and a feedback sensor. The input sensor: detects a first amount of force or torque applied on a component of an x-ray scanner gantry in a direction and generates a command signal. The command signal indicates the first amount of force or torque. The summer generates an error signal based on the command signal and a feedback signal. The controller controls operation of a motor based on the error signal to: reduce the error signal provide counterbalancing of the gantry in the direction and provide a net force or torque on the gantry that is equal to a predetermined value or is within a predetermined range of the predetermined value. The feedback sensor detects a second amount of force or torque applied on the gantry in the direction as a result of the controlled operation and generates the feedback signal.