An optical encoder and motor assembly, comprising: a motor and brake device, the motor and brake device including a motor shaft that rotates or remains stationary based on operation of the motor and brake device; an encoder housing including an opening; an encoder shaft associated with the motor shaft so that the encoder shaft rotates relative to the encoder housing as the motor shaft rotates; an encoder disk secured to the encoder shaft, the encoder disk rotating with the encoder shaft, the encoder disk being within the encoder housing; at least one detector (64, 66) within the encoder housing, the at least one detector (64, 66) being situated relative to the encoder disk to detect rotary movement of the encoder disk; a motor and brake housing at least partially enclosing the motor and brake device, the motor and brake housing including at least one cavity aligned with the motor shaft, wherein the encoder housing is at least partially received in the at least one cavity, the encoder shaft being supported partially within the encoder housing and partially extending through the opening of the encoder housing; a seal at an interface between the encoder shaft and the encoder housing, the seal surrounding the encoder shaft, the seal being outside of the encoder housing, the seal being situated to prevent contaminants from the cavity from entering the encoder housing through the opening; and a packing inside the encoder housing between the opening and the encoder disk, the packing being situated to prevent any debris associated with rotation of the encoder shaft relative to the seal from contacting the encoder disk. a motor and brake device, the motor and brake device including a motor shaft that rotates or remains stationary based on operation of the motor and brake device; an encoder housing including an opening; an encoder shaft associated with the motor shaft so that the encoder shaft rotates relative to the encoder housing as the motor shaft rotates; an encoder disk secured to the encoder shaft, the encoder disk rotating with the encoder shaft, the encoder disk being within the encoder housing; at least one detector (64, 66) within the encoder housing, the at least one detector (64, 66) being situated relative to the encoder disk to detect rotary movement of the encoder disk; a motor and brake housing at least partially enclosing the motor and brake device, the motor and brake housing including at least one cavity aligned with the motor shaft, wherein the encoder housing is at least partially received in the at least one cavity, the encoder shaft being supported partially within the encoder housing and partially extending through the opening of the encoder housing; a seal at an interface between the encoder shaft and the encoder housing, the seal surrounding the encoder shaft, the seal being outside of the encoder housing, the seal being situated to prevent contaminants from the cavity from entering the encoder housing through the opening; and a packing inside the encoder housing between the opening and the encoder disk, the packing being situated to prevent any debris associated with rotation of the encoder shaft relative to the seal from contacting the encoder disk.