コード例 #1
0
    def __init__(self, stationsInfo, clientsInfo, handler):
        # stations initialization
        self.stations = {}
        for stationInfo in stationsInfo:
            self.stations[stationInfo['id']] = BaseStation.BaseStation(
                stationInfo['center'], stationInfo['radius'],
                stationInfo['id'])

        self.calculateNearbyBs(NearbyRange)

        # clients initialization
        self.clients = {}
        for clientInfo in clientsInfo:
            self.clients[clientInfo['id']] = Client.Client(
                clientInfo['id'], clientInfo['startPosition'],
                clientInfo['speed'])

        # map initialization
        #self.tkHandler = handler
        #self.map = Tkinter.Canvas( self.tkHandler, width=MapWidth, height=MapHeight )
        #self.map.pack()
        #self.showBaseStations()

        self.timer = -1
        while (1):
            self.mainProcess()
コード例 #2
0
ファイル: Accel.py プロジェクト: nesl/netcar
 def __init__(self):
     self.tableOPEN = "<table>\n"
     self.tableCLOSE = "</table>\n"
     self.rowOPEN = "\t<row>\n"
     self.rowCLOSE = "\t</row>\n"
     self.fieldOPEN = "\t\t<field name=\""
     self.fieldOPEN2 = "\">"
     self.fieldCLOSE = "</field>\n"
     self.NoofBurst = 1
     self.Acc = BaseStation.BaseStation()
     time.sleep(1)
コード例 #3
0
def loadBases(filename):
    f = open(filename, 'r')
    lines = f.readlines()
    f.close()

    allBases = []
    for line in lines:
        data = line.strip("\n").split(" ")
        listOfLinks = data[4:]
        allBases.append(
            BaseStation.BaseStation(data[0], int(data[1]), int(data[2]),
                                    int(data[3]), listOfLinks))

    return allBases
コード例 #4
0
authors: Kevin Peterson
Modification on 2011-03-7:

"""

import numpy as np
from lib import command
from struct import *
import time, serial, sys, os
from BaseStation import *

#Define constants to use
DEST_ADDR = '\x20\x12'

#Initialize the basestation and the helper functions
xb = BaseStation('COM3', 57600, verbose=False)

if __name__ == '__main__':

    print "Type Ctrl+C to exit at any time."

    print "Initial settings:"
    print "-----------------"
    chan = xb.getChannel()
    print "xbee CHAN : 0x%x" % chan
    src = xb.getSrcAddr()
    print "xbee SRC addr : 0x%x" % src
    pan = xb.getPanID()
    print "xbee PAN ID : 0x%x" % pan

    # Change xbee settings
コード例 #5
0
ファイル: xbee2xbee.py プロジェクト: apullin/pyrobotcontrol
import numpy as np
from lib import command
from struct import *
import time, serial, sys, os
import traceback
from BaseStation import *

#Define constants to use
XB1_ADDR = '\x20\x00'
XB2_ADDR = '\x30\x00'
XB_CHAN  = '\x0e'
XB_PANID = '\x99\x99'

#Initialize the basestation and the helper functions
xb1 = BaseStation('COM3', baudrate = 57600 , verbose = False)
xb2 = BaseStation('COM4', baudrate = 57600 , verbose = False)

if __name__ == '__main__':
    
    XBEES = [xb1, xb2]
    
    print "Setting temporary XBee config..."
    
    # Change xbee settings
    xb1.setChannel(XB_CHAN)
    xb1.setSrcAddr(XB1_ADDR)
    xb1.setPanID(XB_PANID)
    
    print "--------  XBee #1  ----------"
    chan = xb1.getChannel()