Skip to content
Snippets Groups Projects
Commit c60d1542 authored by rachelmoan's avatar rachelmoan
Browse files

The advance function should do the state update, not the run function

parent 057dc247
No related branches found
No related tags found
No related merge requests found
...@@ -50,15 +50,15 @@ class Simulator: ...@@ -50,15 +50,15 @@ class Simulator:
# Get the controls from the policy # Get the controls from the policy
x_mpc, controls = self.policy.advance(self.state, show_plots=self.settings['simulator']['show_collision_resolution']) x_mpc, controls = self.policy.advance(self.state, show_plots=self.settings['simulator']['show_collision_resolution'])
# # Update the state of each robot # Update the state of each robot
# for i in range(self.num_robots): next_states = []
# new_state = self.dynamics_models[i].next_state(self.state[i], controls[i], dt) for i in range(self.num_robots):
# self.robots[i].current_position = new_state next_states.append(self.policy.dynamics.next_state(self.state[i], controls[i], self.policy.DT))
# self.state[i] = new_state
self.state = next_states
# Update the time # Update the time
self.time += dt self.time += dt
return x_mpc, controls
def run(self, show_plots=False): def run(self, show_plots=False):
""" """
...@@ -90,13 +90,7 @@ class Simulator: ...@@ -90,13 +90,7 @@ class Simulator:
if show_plots: self.plot_current_world_state() if show_plots: self.plot_current_world_state()
# get the next control for all robots # get the next control for all robots
x_mpc, controls = self.advance(self.state, self.policy.DT) self.advance(self.state, self.policy.DT)
next_states = []
for i in range(self.num_robots):
next_states.append(self.policy.dynamics.next_state(self.state[i], controls[i], self.policy.DT))
self.state = next_states
self.state = np.array(self.state) self.state = np.array(self.state)
for i in range(self.num_robots): for i in range(self.num_robots):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment