Exemplo n.º 1
0
def app():
  platform.stop()
  
  switches.start()
  
  positionWatcher.start()
  print('started position watcher')
  
  container.set('positionWatcher', positionWatcher)
  container.set('platform', platform)
  container.set('switches', switches)

  nav = Navigation(container)

  nav.goToPath([
    #{ 'x': 200, 'y': 900, 'speed': 50, 'orienation': pi },
    { 'x': -200, 'y': 900, 'speed': 20, 'orienation': pi, 'stopOn': 'front' }
  ])
from src.PositionWatcher import PositionWatcher
from time import sleep

container = Container()

positionWatcher = PositionWatcher()
positionWatcher.start()
container.set('positionWatcher', positionWatcher)

driver = PWMDriver()
container.set('PWMDriver', driver)

platform = MotorizedPlatform(container)
container.set('platform', platform)

nav = Navigation(container)
container.set('navigation', nav)

nav = Navigation(container)


def app():
    platform.stop()
    sleep(1.5)

    input('Start ?')

    positionWatcher.start()

    nav.orientTo(0)
    container.set('commandsManager', commandsManager)

    positionWatcher = PositionWatcher(container)
    #positionWatcher.start()
    container.set('positionWatcher', positionWatcher)

    switches = Switches(container)
    container.set('switches', switches)

    driver = PWMDriver()
    container.set('PWMDriver', driver)

    platform = MotorizedPlatform(container)
    container.set('platform', platform)

    navigation = Navigation(container)
    container.set('navigation', navigation)

    elevator = Elevator(container)
    container.set('elevator', elevator)

    schlager = Schlager(container)
    container.set('schlager', schlager)

    # lidar = Lidar(container)
    # lidar.start()
    # container.set('lidar', lidar)
    commandsManager.init()

    def onPos(x, y, t):
        ws.sendData('mainPosition', [x, y, t])
from time import sleep
import Adafruit_PCA9685
from src.dualshock.DualshockThroughtPygame import DualshockThroughtPygame
from src.dualshock.DualshockThroughtNode import DualshockThroughtNode
from src.Navigation import Navigation
from src.ControlDispatcher import ControlDispatcher

servoInterface = Adafruit_PCA9685.PCA9685()
servoInterface.set_pwm_freq(50)
# servoInterface = None

dualshock = DualshockThroughtNode()
#dualshock = DualshockThroughtPygame()

navigation = Navigation(servoInterface)


def main():
    controlDispatcher = ControlDispatcher(dualshock, navigation)

    #navigation.frontLeft()

    dualshock.start()

    while True:
        sleep(0)


''' 
def mappyt(x, inMin, inMax, outMin, outMax):