pollen-robotics / rosa

Rosa : le robot qui ramasse des objets
2 stars 1 forks source link

API access to APDS-9960 gestures #2

Open davidjsherman opened 3 years ago

davidjsherman commented 3 years ago

The apds9960 library provides an interface for retrieving gestures from the ADPS-9960 IC, in particular swiping up, down, left, and right. Providing these discrete values to clients should make it easier to

The changes to the API in rosa/rpi/io_controller.py should be straightforward, essentially

if apds.isGestureAvailable():
    # return constant from liske/python-apds9960/apds9960/const.py#L155
    #  APDS9960_DIR_LEFT = 1
    #  APDS9960_DIR_RIGHT = 2
    #  APDS9960_DIR_UP = 3
    #  APDS9960_DIR_DOWN = 4
    return apds.readGesture()

Although since the Rosa is polled by WsIOHandler.StateGetter, probably that should be two separate methods.

Testing will be difficult in CI because there is not (yet) a mock for the hardware