2019-08-10, 10:04 AM
Hi Sean,
I modified nmea.py with this:
if line[1:6] == 'APAPB' and time.time() - self.last_apb_time > 1:
self.last_apb_time = time.time()
data = line[7:len(line)-3].split(',')
if self.last_values['ap.enabled']:
mode = 'compass' if data[13] == 'M' else 'gps'
if self.last_values['ap.mode'] != mode:
self.client.set('ap.mode', mode)
try:
command = float(data[12])
xte = float(data[2])
xte = min(xte, 0.15) # maximum 0.15 miles
if data[3] == 'L':
xte = -xte
command += 300*xte; # 30 degrees for 1/10th mile
if abs(self.last_values['ap.heading_command'] - command) > .1:
self.client.set('ap.heading_command', command)
except: return False
return True
elif line[1:6] == 'GPAPB' and time.time() - self.last_apb_time > 1:
self.last_apb_time = time.time()
data = line[7:len(line)-3].split(',')
if self.last_values['ap.enabled'] and self.last_values['ap.mode'] == 'gps':
try:
command = float(data[12])
xte = float(data[2])
xte = min(xte, 0.15) # maximum 0.15 miles
if data[3] == 'L':
xte = -xte
command += 300*xte; # 30 degrees for 1/10th mile
if abs(self.last_values['ap.heading_command'] - command) > .1:
self.client.set('ap.heading_command', command)
return True
except: return False
return False
tested it and nmea communication doesn't crash anymore. i can select other modes when i have an active waypoint so it seems to work. I just haven't done actual navigating to a waypoint as the wheather is not good today. It is stil a bit unclear to me what would be the easyest/correct procedure to get it in the squashed filesystem but eventualy i got it in there.
Greetings Rob
I modified nmea.py with this:
if line[1:6] == 'APAPB' and time.time() - self.last_apb_time > 1:
self.last_apb_time = time.time()
data = line[7:len(line)-3].split(',')
if self.last_values['ap.enabled']:
mode = 'compass' if data[13] == 'M' else 'gps'
if self.last_values['ap.mode'] != mode:
self.client.set('ap.mode', mode)
try:
command = float(data[12])
xte = float(data[2])
xte = min(xte, 0.15) # maximum 0.15 miles
if data[3] == 'L':
xte = -xte
command += 300*xte; # 30 degrees for 1/10th mile
if abs(self.last_values['ap.heading_command'] - command) > .1:
self.client.set('ap.heading_command', command)
except: return False
return True
elif line[1:6] == 'GPAPB' and time.time() - self.last_apb_time > 1:
self.last_apb_time = time.time()
data = line[7:len(line)-3].split(',')
if self.last_values['ap.enabled'] and self.last_values['ap.mode'] == 'gps':
try:
command = float(data[12])
xte = float(data[2])
xte = min(xte, 0.15) # maximum 0.15 miles
if data[3] == 'L':
xte = -xte
command += 300*xte; # 30 degrees for 1/10th mile
if abs(self.last_values['ap.heading_command'] - command) > .1:
self.client.set('ap.heading_command', command)
return True
except: return False
return False
tested it and nmea communication doesn't crash anymore. i can select other modes when i have an active waypoint so it seems to work. I just haven't done actual navigating to a waypoint as the wheather is not good today. It is stil a bit unclear to me what would be the easyest/correct procedure to get it in the squashed filesystem but eventualy i got it in there.
Greetings Rob