Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Support SourceBots Arduino #66

Closed
trickeydan opened this issue Feb 8, 2019 · 5 comments
Closed

Support SourceBots Arduino #66

trickeydan opened this issue Feb 8, 2019 · 5 comments
Assignees

Comments

@trickeydan
Copy link
Contributor

Requires:

@trickeydan trickeydan added this to the Soft Boards Complete milestone Feb 8, 2019
@kierdavis
Copy link
Contributor

I think canonically ultrasound sensors should be a component; however this may require a rethink of the component API due to how ultrasound sensors are addressed as a pair of pin numbers (trigger pin and echo pin).

@trickeydan
Copy link
Contributor Author

For ultrasound sensors, we could have a 'virtual' Component. Two GPIOPins can be passed to it in the constructor?

@kierdavis
Copy link
Contributor

yeah. There's no reason why we couldn't have high-level components built on top of low-level components. I'm thinking something like:

class ServoAssembly:
  ...
  def ultrasound_sensor(self, trigger_pin, echo_pin):
    if isinstance(trigger_pin, int): trigger_pin = self.gpio[trigger_pin]
    if isinstance(echo_pin, int): echo_pin = self.gpio[echo_pin]
    return UltrasoundProximitySensor(self._backend, trigger_pin, echo_pin)
  ...
class UltrasoundProximitySensor:
  @property
  def distance(self):
    return self._backend.read_ultrasound_sensor(self._trigger_pin.identifier, self._echo_pin.identifier)

@trickeydan trickeydan removed this from the Soft Boards Complete milestone Mar 7, 2019
@trickeydan trickeydan added this to the v0.5.0 milestone Apr 23, 2019
@trickeydan trickeydan self-assigned this May 18, 2019
@trickeydan trickeydan modified the milestones: v0.5.0, Smallpeice 2019 May 26, 2019
@kierdavis kierdavis changed the title Support SourceBots Servo Assembly Support SourceBots Arduino Jul 13, 2019
@kierdavis kierdavis assigned kierdavis and unassigned trickeydan Jul 13, 2019
@kierdavis kierdavis reopened this Aug 4, 2019
@kierdavis
Copy link
Contributor

kierdavis commented Aug 4, 2019

Ultrasound isn't implemented in the hardware backend yet. Fortunately this is just a matter of extending the existing SBArduinoHardwareBackend with UltrasoundInterface; pretty much all of the infrastructure is already in place.

EDIT: also need to implement SBArduinoBoard.get_ultrasound(trigger_pin: PinNumber, echo_pin: PinNumber) -> UltrasoundSensor.

@kierdavis
Copy link
Contributor

#365 fixed this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants