0 modification mais ça se voit pas
This commit is contained in:
parent
f06589562c
commit
d67a33203b
2 changed files with 4 additions and 21 deletions
|
@ -3,6 +3,7 @@ import socket
|
||||||
import GCode_Interpreterdc
|
import GCode_Interpreterdc
|
||||||
from controller import DummyController
|
from controller import DummyController
|
||||||
|
|
||||||
|
|
||||||
class Hardware:
|
class Hardware:
|
||||||
def __init__(self, bind):
|
def __init__(self, bind):
|
||||||
self.s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
self.s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||||
|
@ -19,7 +20,6 @@ class SimuHardware(Hardware):
|
||||||
def __init__(self, bind):
|
def __init__(self, bind):
|
||||||
Hardware.__init__(self, bind)
|
Hardware.__init__(self, bind)
|
||||||
|
|
||||||
|
|
||||||
def probe(self, gtm):
|
def probe(self, gtm):
|
||||||
self.s.send("request\n".encode())
|
self.s.send("request\n".encode())
|
||||||
encoder_x = int(socket.SocketIO(self.s, "rw").readline())
|
encoder_x = int(socket.SocketIO(self.s, "rw").readline())
|
||||||
|
@ -67,11 +67,10 @@ class SimuHardware(Hardware):
|
||||||
self.s.send(str(gtm.z_direction).encode() + b" " + str(gtm.FAST_Z_FEEDRATE / gtm.z_throttle).encode() + b"\n")
|
self.s.send(str(gtm.z_direction).encode() + b" " + str(gtm.FAST_Z_FEEDRATE / gtm.z_throttle).encode() + b"\n")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
b = "socket.sock"
|
b = "socket.sock"
|
||||||
sh = SimuHardware(b)
|
sh = SimuHardware(b)
|
||||||
ctrl=DummyController()
|
ctrl = DummyController()
|
||||||
gtm1 = GCode_Interpreterdc.GCodeToMotors(ctrl, sh)
|
gtm1 = GCode_Interpreterdc.GCodeToMotors(ctrl, sh)
|
||||||
sh.probe(gtm1)
|
sh.probe(gtm1)
|
||||||
print(gtm1.current_units)
|
print(gtm1.current_units)
|
||||||
|
|
18
simulator.py
18
simulator.py
|
@ -3,17 +3,6 @@ import os
|
||||||
import time
|
import time
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
#from color import Color
|
|
||||||
|
|
||||||
|
|
||||||
#c1 = Color("#7d1dd3")
|
|
||||||
#c2 = Color("#ffe500")
|
|
||||||
#colors = list(c1.range_to(c2, 42))
|
|
||||||
|
|
||||||
|
|
||||||
def infinite_colors():
|
|
||||||
for x in iter(int, 1):
|
|
||||||
yield colors[x % 42]
|
|
||||||
|
|
||||||
|
|
||||||
def parse_speed(text):
|
def parse_speed(text):
|
||||||
|
@ -99,11 +88,6 @@ class Simulator:
|
||||||
|
|
||||||
|
|
||||||
class Douche:
|
class Douche:
|
||||||
colors = infinite_colors()
|
|
||||||
|
|
||||||
last_x = None
|
|
||||||
last_y = None
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# We will assume no points are `really` in 3D.
|
# We will assume no points are `really` in 3D.
|
||||||
plt.ion()
|
plt.ion()
|
||||||
|
@ -113,7 +97,7 @@ class Douche:
|
||||||
self.ys = []
|
self.ys = []
|
||||||
ax.set_xlim([0, 300])
|
ax.set_xlim([0, 300])
|
||||||
ax.set_ylim([0, 300])
|
ax.set_ylim([0, 300])
|
||||||
self.line, = ax.plot(self.xs, self.ys)
|
self.line, = ax.plot(self.xs, self.ys, c="#7d1dd3")
|
||||||
|
|
||||||
def add_point(self, x, y):
|
def add_point(self, x, y):
|
||||||
self.xs.append(x)
|
self.xs.append(x)
|
||||||
|
|
Loading…
Reference in a new issue