import ch.psi.pshell.epics.Positioner as Positioner


class Readback(ReadonlyRegisterBase):
    def doRead(self):
        return caget("TESTIOC:TESTCALCOUT:Output",'d') + 360.0

readback = Readback()
readback.initialize()
readback.setPolling(2000)

p = Positioner("rot", "TESTIOC:TESTCALCOUT:Input", None, readback)

#p = Positioner("RotationPositioner", "TESTIOC:TESTCALCOUT:Input", "TESTIOC:TESTCALCOUT:Output")
p.monitored=True
p.config.minValue   = -360.0
p.config.maxValue   = 360.0
p.config.precision  = 3
p.config.rotation   = True
p.config.resolution = 0.01
p.config.save()
p.initialize()


add_device(p, True)


print readback.read()