|
|
|
@ -9,18 +9,18 @@ import time
@@ -9,18 +9,18 @@ import time
|
|
|
|
|
import binascii |
|
|
|
|
from base64 import b64decode, b64encode |
|
|
|
|
|
|
|
|
|
from e32 import E32 |
|
|
|
|
import messages_pb2 as messages |
|
|
|
|
from google.protobuf.message import Message |
|
|
|
|
|
|
|
|
|
log = logging.getLogger("ugv") |
|
|
|
|
|
|
|
|
|
class UGVComms(E32): |
|
|
|
|
|
|
|
|
|
class UGVComms: |
|
|
|
|
MAX_WRITE_RETRY = 5 |
|
|
|
|
RETRY_TIME = 3.0 |
|
|
|
|
|
|
|
|
|
def __init__(self, serial_port: serial.Serial): |
|
|
|
|
E32.__init__(self, serial_port) |
|
|
|
|
self.ser = serial_port |
|
|
|
|
self.msg_acks = [] |
|
|
|
|
self.ack_cv = threading.Condition() |
|
|
|
|
self.next_command_id = 1 |
|
|
|
@ -118,7 +118,7 @@ class UGVComms(E32):
@@ -118,7 +118,7 @@ class UGVComms(E32):
|
|
|
|
|
msg = self.read_message() |
|
|
|
|
self.process_message(msg) |
|
|
|
|
except serial.SerialException: |
|
|
|
|
if not self.ser.is_open or not self.is_running: # port was probably just closed |
|
|
|
|
if not self.ser.is_open or not self.is_running: # port was probably just closed |
|
|
|
|
return |
|
|
|
|
log.error("serial error", exc_info=True) |
|
|
|
|
return |
|
|
|
@ -146,7 +146,7 @@ def main():
@@ -146,7 +146,7 @@ def main():
|
|
|
|
|
# ugv.write_command(cmd) |
|
|
|
|
cmd.type = messages.CMD_SET_CONFIG |
|
|
|
|
cmd.config.angle_pid.kp = 0.10 |
|
|
|
|
cmd.config.angle_pid.ki = 0#.00005 |
|
|
|
|
cmd.config.angle_pid.ki = 0 # .00005 |
|
|
|
|
cmd.config.angle_pid.kd = 0.4 |
|
|
|
|
cmd.config.angle_pid.max_output = 0.5 |
|
|
|
|
cmd.config.angle_pid.max_i_error = 15.0 |
|
|
|
|