Move some common sensor code out to a base class