sphero-inc / sphero-sdk-raspberrypi-python

Sphero RVR SDK to run on Raspberry Pi using Python
Other
78 stars 52 forks source link

Add support to change the serial port in the observer SDK #5

Closed mica-angeli closed 5 years ago

mica-angeli commented 5 years ago

While the /dev/ttyS0/ might be fine for Raspberry Pi users on the GPIO's serial port, users of other embedded computers or people using USB-to-serial converters need a way to set the serial port. Currently, this is only supported in the asyncio version of the SDK and not the observer. This adds an optional argument to fix that.

acampos81 commented 5 years ago

Hi @rangeli. We've recently updated the sdk. There's been a change to the way we open up the customization of the serial port. In order to change the default serial port for SpheroRvrObserver an instance of SerialObserverDal with the new port address must be assigned to the dal parameter, like so:

rvr = SpheroRvrObserver( 
    dal=SerialObserverDal(
        port_id='/dev/ttyAMA0'
    )
)

The syntax is different from your PR, but the functionality is the same. We did this In order to keep instantiation of SpheroRvrAsync and SpheroRvrObserver consistent.