- fixed not exitting executor thread
- fixed PID params
This commit is contained in:
@@ -11,6 +11,7 @@ from utils.value import Value, ValueChanged
|
||||
|
||||
TC_DT = 0.1
|
||||
|
||||
|
||||
class ATask:
|
||||
def __init__(self, interval):
|
||||
self.interval = interval
|
||||
@@ -67,7 +68,7 @@ class HeaterTask(ATask):
|
||||
self.heater = heater
|
||||
|
||||
def actor(self, y):
|
||||
self.heater.setPower(max(0, 200 + self.heater.get_power_max() * y))
|
||||
self.heater.setPower(max(0, 0 + self.heater.get_power_max() * y))
|
||||
|
||||
async def recv(self, data):
|
||||
print(data)
|
||||
@@ -202,7 +203,7 @@ if __name__ == '__main__':
|
||||
"dt" : 1.0,
|
||||
"theta" : 20,
|
||||
"C" : 4190,
|
||||
"M" : 10,
|
||||
"M" : 20,
|
||||
"L" : 0.02,
|
||||
"Td" : 12,
|
||||
"kn" : 0.2
|
||||
@@ -222,8 +223,8 @@ if __name__ == '__main__':
|
||||
"dt": 1.0,
|
||||
"Hold": {
|
||||
"Pid": {
|
||||
"kp": 0.4,
|
||||
"ki": 0.0,
|
||||
"kp": 0.8,
|
||||
"ki": 0.000004,
|
||||
"kd": 0.0,
|
||||
"rho": 1.0
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ from ws.client.ws_client import WsClient
|
||||
from ws.message import MessageDispatcherSync
|
||||
from queue import Queue
|
||||
import asyncio
|
||||
from ws.connection import IConnection
|
||||
|
||||
|
||||
class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
+6
-1
@@ -129,7 +129,12 @@ class MessageDispatcherSync(IConnection):
|
||||
await asyncio.get_event_loop().run_in_executor(None, h.on_recv, d)
|
||||
|
||||
async def on_send(self):
|
||||
return await asyncio.get_event_loop().run_in_executor(None, self.state.get)
|
||||
result = None
|
||||
try:
|
||||
result = await asyncio.get_event_loop().run_in_executor(None, self.state.get, True, 1.0)
|
||||
except:
|
||||
pass
|
||||
return result
|
||||
|
||||
def send(self, data):
|
||||
self.state.put(data)
|
||||
|
||||
Reference in New Issue
Block a user