feature_lsp_com #8
25
main.py
25
main.py
@@ -440,6 +440,11 @@ class ArduinoGUI:
|
||||
self.csv_writer.writerow([formatted_time, formatted_angle, formatted_setpoint, formatted_torque, formatted_output])
|
||||
|
||||
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
||||
if self.ser:
|
||||
if self.ser.in_waiting:
|
||||
try:
|
||||
@@ -458,7 +463,6 @@ class ArduinoGUI:
|
||||
try:
|
||||
pass
|
||||
self.connect_lsp()
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
@@ -466,7 +470,26 @@ class ArduinoGUI:
|
||||
|
||||
def lsp_communication_loop(self):
|
||||
while self.running:
|
||||
if self.ser:
|
||||
if self.ser.in_waiting:
|
||||
try:
|
||||
command = self.ser.readline().decode(errors='ignore').strip()
|
||||
print(command)
|
||||
if command == 'a':
|
||||
message = f"{self.current_angle};{self.current_torque};{self.analogInput};{self.currentSetpoint};{self.currentOutput}\n"
|
||||
self.ser.write(message.encode())
|
||||
time.sleep(0.1)
|
||||
while self.ser.out_waiting:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(e)
|
||||
#self.ser.write(b'Hallo\n')
|
||||
else :
|
||||
try:
|
||||
pass
|
||||
self.connect_lsp()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
||||
def send_pid_parameters(self):
|
||||
|
||||
Reference in New Issue
Block a user