TrajectoryCollector#

class do_dpc.control_utils.trajectory_collector.TrajectoryCollector(m, p, traj_length)[source]#

Bases: object

Collects system output (y) and control input (u) trajectories.

This class handles the logging and structured collection of trajectory data for data-driven control applications.

Methods#

get_trajectory_data#

do_dpc.control_utils.trajectory_collector.TrajectoryCollector.get_trajectory_data(self)#

Retrieves the collected trajectory data.

Ensures that data collection is complete before returning the trajectory. If NaN values are present, logs a warning, removes them, and proceeds with returning the cleaned data.

Returns:

The collected trajectory data with y, u, m, and p, with NaN values removed.

Return type:

InputOutputTrajectory

store_measurements#

do_dpc.control_utils.trajectory_collector.TrajectoryCollector.store_measurements(self, y_next, u_next)#

Stores the next system output (y_next) and the corresponding control input (u_next) in the trajectory dataset.

This function assigns the provided system output y_next and control input u_next to the first available (empty) column in the trajectory storage. If the trajectory is already full, a warning is logged.

Parameters:
  • y_next (np.ndarray) – The new system output observation (shape (p,)).

  • u_next (np.ndarray) – The control input applied at this step (shape (m,)).

Raises:
  • ValueError – If y_next does not match the expected shape (p,).

  • ValueError – If u_next does not match the expected shape (m,).