Beispiel #1
0
def main():
    logger()

    logging.info('Started')

    communicator = centralizedComm.uavComm()

    communicator.start()
    logging.info('Communicator initialized.')

    plane = planeGenerator.generate_planes(
        defaultValues.NUM_PLANES,
        defaultValues.NUM_WAY_POINTS,
        defaultValues.GRID_SIZE,
        communicator
    )

    planeMover = list()

    for i in range(0, defaultValues.NUM_PLANES):
        planeMover.append(Thread(target=movementSimulator.move, args=(plane[i], communicator, 0)))

    for i in range(0, defaultValues.NUM_PLANES):
        planeMover[i].setDaemon(True)
        planeMover[i].start()

    while communicator.isAlive():
        pass

    logging.info('Communicator terminated.')
    logging.info('Finished')
Beispiel #2
0
def main():
    logger()

    logging.info('Started')

    communicator = centralizedComm.uavComm()

    communicator.start()
    logging.info('Communicator initialized.')

    plane = planeGenerator.generate_planes(defaultValues.NUM_PLANES,
                                           defaultValues.NUM_WAY_POINTS,
                                           defaultValues.GRID_SIZE,
                                           communicator)

    planeMover = list()

    for i in range(0, defaultValues.NUM_PLANES):
        planeMover.append(
            Thread(target=movementSimulator.move,
                   args=(plane[i], communicator, 0)))

    for i in range(0, defaultValues.NUM_PLANES):
        planeMover[i].setDaemon(True)
        planeMover[i].start()

    # Just randomly testing certain funcs.

    while communicator.isAlive():
        pass

    logging.info('Communicator terminated.')
    logging.info('Finished')
Beispiel #3
0
import standardFuncs
import defaultValues
import vMath
import logging

standardFuncs.logger()


# TODO: Adapt this to waypoints
def straightline (plane):


    if plane.avoid:

        target = plane.avoidanceWaypoint
        logging.info ("UAV #3i is moving toward an avoidance waypoint" % plane.id)

    else: target = plane.tLoc


    speed = plane.speed  # Get speed from plane
    distanceTraveled = plane.speed * defaultValues.DELAY #Get frequency of updates.
    plane.distanceTraveled += distanceTraveled  #The total distance travelled.

    # Calculate new position
    position = vMath.vector(distanceTraveled, plane.cBearing, plane.cElevation)

    new_lat = plane.cLoc.latitude + (position.x / standardFuncs.LATITUDE_TO_METERS)
    new_lon = plane.cLoc.longitude + (position.y / standardFuncs.LONGITUDE_TO_METERS)
    new_alt = plane.cLoc.altitude + position.z