Physics are now making a bit more sense

Still random jumps though
This commit is contained in:
Sélène Corbineau 2025-01-14 23:38:25 +01:00
parent 263565c98f
commit 4cec7b86d7

View file

@ -40,6 +40,7 @@ class Simulator:
while True: while True:
try: try:
self.s, _ = self.s.accept() self.s, _ = self.s.accept()
self.s.setblocking(False)
break break
except BlockingIOError: except BlockingIOError:
print("Waiting for connection") print("Waiting for connection")
@ -141,7 +142,7 @@ class NaiveSimulator(Simulator, Douche):
self.last_update = lt self.last_update = lt
gamma = self.G*(self.command_spd - self.speed) gamma = self.G*(self.command_spd - self.speed)
self.speed += 1./self.J * (self.G - self.f*self.speed ) * self.time_step self.speed += 1./self.J * (gamma - self.f*self.speed ) * self.time_step
self.pos += self.speed * self.time_step self.pos += self.speed * self.time_step
self.steps = np.ceil(self.pos * np.array([self.X_STEPS_PER_MM, self.steps = np.ceil(self.pos * np.array([self.X_STEPS_PER_MM,