Skip to content

Commit

Permalink
Add overlapping windows search
Browse files Browse the repository at this point in the history
  • Loading branch information
hbuurmei committed Feb 12, 2025
1 parent 27895b2 commit edbd9cb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions stack/main/src/executor/executor/test_mpc_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,18 @@ def service_callback(self, async_response):
self.uopt_previous = safe_control_inputs

# Use MPC optimized performance variable to update observations
self.update_observations(response.zopt)
self.update_observations(response.t, response.zopt)

except Exception as e:
self.get_logger().error(f'Service call failed: {e}.')

def update_observations(self, z_opt, eps=1e-4):
def update_observations(self, t_opt, z_opt, eps=1e-4):
"""
Update the latest observations using predicted observations from MPC plus added noise.
"""
# Figure out what predictions to use for observations update
idx0 = jnp.searchsorted(t_opt, t0, side='right')

# Convert from list to JAX array
y_centered_tip = jnp.array(z_opt)
print(y_centered_tip)
Expand Down

0 comments on commit edbd9cb

Please sign in to comment.