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)
+ r).streamline() p_GPSLocationMessage.setParseAction(lambda x: messaging.GPSLocationMessage(*x[0])) p_SonarLocationMessage = pp.Group(l \ + p_floatXY \ + r).streamline() p_SonarLocationMessage.setParseAction(lambda x: messaging.SonarLocationMessage(*x[0])) p_ImageMessage = pp.Group(l \ + p_CameraID + c \ + p_Image + c \ + p_TimeStamp \ + r).streamline() p_ImageMessage.setParseAction(lambda x: messaging.ImageMessage(*x[0])) p_SonarDataMessage = pp.Group(l \ + p_SonarDataLine \ + r).streamline() p_SonarDataMessage.setParseAction(lambda x: messaging.SonarDataMessage(*x[0])) p_SonarImageMessage = pp.Group(l \ + p_SonarID + c \ + p_PolarImage \ + r).streamline() p_SonarImageMessage.setParseAction(lambda x: messaging.SonarImageMessage(*x[0])) p_SpeedOfSoundMessage = pp.Group(l \ + p_float \ + r).streamline() p_SpeedOfSoundMessage.setParseAction(lambda x: messaging.SpeedOfSoundMessage(*x[0])) p_GeminiStatusMessage = pp.Group(l \ + p_int + c \ + p_int + c \ + p_int + c \ + p_int + c \ + p_GeminiTemperatures + c \
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") time.sleep(0.05)