Ejemplo n.º 1
0
 def SonarDataLine(self):
     dl = msg.byteVec()
     for b in self.data:
         dl.append(b)
     # default value for new field!
     if not hasattr(self, 'scanWidth'):
         self.scanWidth = 6400
     return msg.SonarDataLine(dl, self.bearing, self.bearingRange, self.range, self.scanWidth)
Ejemplo n.º 2
0
def sendSonarTest(off, on, sleeptime=0.05):
    print("Sending sonar test data")
    for b in range(0, 64):
        line = msg.SonarDataLine()
        line.data.clear()
        for i in range(0, 6):
            line.data.append(bitVal(b, 1 << i, off, on))
        line.bearing = b * 100
        line.bearingRange = 100
        node.send(msg.SonarDataMessage(line))
        time.sleep(sleeptime)
    + p_str \
    + r)
p_NodeOutputArc.setParseAction(lambda x: messaging.NodeOutputArc(*x[0]))
p_TimeStamp << pp.Group(l \
    + p_int + c \
    + p_int \
    + r)
p_TimeStamp.setParseAction(lambda x: messaging.TimeStamp(*x[0]))
p_SonarDataLine << pp.Group(l \
    + p_byteVec + c \
    + p_int + c \
    + p_int + c \
    + p_int + c \
    + p_int \
    + r)
p_SonarDataLine.setParseAction(lambda x: messaging.SonarDataLine(*x[0]))
p_PolarImage << pp.Group(l \
    + p_byteVec + c \
    + p_ImageEncodingType + c \
    + p_int32Vec + c \
    + p_float + c \
    + p_float + c \
    + p_float + c \
    + p_TimeStamp \
    + r)
p_PolarImage.setParseAction(lambda x: messaging.PolarImage(*x[0]))
p_GeminiTemperatures << pp.Group(l \
    + p_float + c \
    + p_float + c \
    + p_float + c \
    + p_float + c \
Ejemplo n.º 4
0
 def __init__(self, sdl = msg.SonarDataLine()):
     self.data = tuple(sdl.data)
     self.bearing = sdl.bearing
     self.bearingRange = sdl.bearingRange
     self.range = sdl.range
     self.scanWidth = sdl.scanWidth
Ejemplo n.º 5
0
#
# See license.txt for details.
#

import cauv
import cauv.node as node
import cauv.messaging as msg
from cauv.debug import debug, warning, error, info

import time
import random
import sys

n = node.Node("sonar-t",sys.argv[1:])

data_line = msg.SonarDataLine()
data_line.bearing = 0
data_line.bearingRange = 6400/32
data_line.range = 10

while True:
    data_line.data = msg.byteVec()
    for i in xrange(0, 50):
        data_line.data.append(i + random.randrange(0, 50) % 0xff)

    data_line.bearing += data_line.bearingRange
    if(data_line.bearing > 6400):
        data_line.bearing -= 6400
    info('%s' % data_line.bearing)

    n.send(msg.SonarDataMessage(data_line), "sonarout")