示例#1
0
文件: main.py 项目: elec-otago/agbase
 def __init__(self):
   self.animals = []
   for x in range(0, 10):
     a = Animal(str(123456789-x),"{}".format(x),1,1)
     self.animals.append(a)
     #a.toString()
     #print "{}/10".format(x)
     
   sc = ServerCom()
   sc.uploadData(self.animals)  
示例#2
0
import sys
sys.path.append('/usr/local/lib/python2.7/site-packages')

from picamera.array import PiRGBArray
from picamera import PiCamera

import cv2
import numpy as np

import socket
import scipy.integrate

robot = SerialCommands('/dev/ttyAMA0',115200)

serverCom = ServerCom() # Data used by robot
#serverCom.displayData() # Test


cruise_dist =300
v_desr = 100

host = '192.168.30.37'   ###address of the server
port = 9092

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host , port))

print robot.init()

# initialize the camera and grab a reference to the raw camera capture
示例#3
0
import sys
sys.path.append('/usr/local/lib/python2.7/site-packages')

from picamera.array import PiRGBArray
from picamera import PiCamera

import cv2
import numpy as np

import socket
import scipy.integrate

robot = SerialCommands('/dev/ttyAMA0', 115200)

serverCom = ServerCom()  # Data used by robot
#serverCom.displayData() # Test

cruise_dist = 300
v_desr = 100

host = '192.168.30.37'  ###address of the server
port = 9092

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host, port))

print robot.init()

# initialize the camera and grab a reference to the raw camera capture
camera = PiCamera()
示例#4
0
from ServerCom import ServerCom
import lcm
from robotlcm import robotFeedback_t, robotSettings_t
import thread
import time

serverCom = ServerCom()  # Data used by robot
#serverCom.displayData() # Test


def my_handler(channel, data):
    print "received " + channel
    if channel in "ServerToRobot":
        global serverCom
        msg = robotSettings_t.decode(data)
        serverCom.setDesiredSpeed = msg.desiredSpeed
        serverCom.longitude = msg.positionFromGPS[0]
        serverCom.latitude = msg.positionFromGPS[1]
        serverCom.jawRate = msg.positionFromGPS[2]
        serverCom.setChangeLane = msg.changeLane


def receiveFromServer(freq):
    lc = lcm.LCM("udpm://239.255.76.67:7667?ttl=1")
    subscription = lc.subscribe("ServerToRobot", my_handler)
    try:
        while 1:
            time.sleep(1.0 / freq)
            lc.handle()
    except KeyboardInterrupt:
        pass