pub struct TrajectoryRecorder {
pub q_history: Vec<Vec<f64>>,
pub v_history: Vec<Vec<f64>>,
pub ctrl_history: Vec<Vec<f64>>,
pub time_history: Vec<f64>,
pub sensor_history: Vec<Vec<SensorOutput>>,
}Expand description
Records trajectories of (q, v, ctrl, time) for ML training.
Fields§
§q_history: Vec<Vec<f64>>Recorded positions at each timestep.
v_history: Vec<Vec<f64>>Recorded velocities at each timestep.
ctrl_history: Vec<Vec<f64>>Recorded control inputs at each timestep.
time_history: Vec<f64>Timestamps for each step.
sensor_history: Vec<Vec<SensorOutput>>Sensor outputs at each timestep.
Implementations§
Source§impl TrajectoryRecorder
impl TrajectoryRecorder
Sourcepub fn new() -> TrajectoryRecorder
pub fn new() -> TrajectoryRecorder
Create a new empty trajectory recorder.
Sourcepub fn record_with_sensors(&mut self, state: &State, sensors: Vec<SensorOutput>)
pub fn record_with_sensors(&mut self, state: &State, sensors: Vec<SensorOutput>)
Record state with sensor outputs.
Sourcepub fn to_flat_dict(&self) -> HashMap<String, Vec<f64>>
pub fn to_flat_dict(&self) -> HashMap<String, Vec<f64>>
Convert to a dictionary-like structure suitable for numpy/ML frameworks.
Returns:
- “q”: (nsteps, nq) flattened data
- “v”: (nsteps, nv) flattened data
- “ctrl”: (nsteps, nv) flattened data
- “time”: (nsteps,) flattened data
Sourcepub fn stats(&self) -> TrajectoryStats
pub fn stats(&self) -> TrajectoryStats
Get trajectory statistics.
Trait Implementations§
Source§impl Default for TrajectoryRecorder
impl Default for TrajectoryRecorder
Source§fn default() -> TrajectoryRecorder
fn default() -> TrajectoryRecorder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TrajectoryRecorder
impl RefUnwindSafe for TrajectoryRecorder
impl Send for TrajectoryRecorder
impl Sync for TrajectoryRecorder
impl Unpin for TrajectoryRecorder
impl UnsafeUnpin for TrajectoryRecorder
impl UnwindSafe for TrajectoryRecorder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.