I'm starting to think forward to how I am going to architect my robot software, and wondering if I need to do anything special to wrap the PDALib because I am importing packages which import PDALib and each other?
My s/w architecture at the moment:
usDistance.py
# HC-S04 UltraSonic Distance Sensor -adjusted to center of bot based on positionOfTiltPanInDeg()
import PDALib
import tiltpan
def initSensor()
def inInches(readings=75)
def off()
irDistance.py
# Sharp IR Distance Sensor -adjusted to center of bot based on positionOfTiltPanInDeg()
import PDALib
import tiltpan
def inInches(readings=75)
currentsensor.py
# ACS712 Current Sensor
import PDALib
def inMA(readings=75)
battery.py
# 6-cell battery through 2:1 divider
import PDALib
def inVolts(readings=75)
tiltpan.py
# tilt/pan servos with camera, HC-S04, and IR distance sensors
import PDALib
def center()
def centerTilt()
def centerPan()
def tiltDegUp(upDegFromCenter)
def panDegLeft(leftDegFromCenter)
def tiltPanDegUpLeft(upDegFromCenter, leftDegFromCenter)
def positionOfTiltPanInDeg() # returns current position of both servos[ tilt_upDegFromCenter, pan_leftDegFromCenter]
encoders.py
# wheel encoders - direct read or interrupt read
import PDALib
def initWithInterrupts()
def initNoInterrupts()
def off() #remove interrupt
def reset()
def countsLR()
motors.py
# motor drive and rotate commands
import PDALib
import encoders
import currentsensor
import bumpers
import irDistance
import usDistance
**************
Eventually, I want to have multiple async threads collecting sensor data with async data consumers, and async effectors (motor/tiltPan/speaker) but I don't know enough Python yet to design that.