|
6 | 6 | import h5py
|
7 | 7 | import numpy as np
|
8 | 8 |
|
| 9 | +from flybody.tasks.synthetic_trajectories import constant_speed_trajectory |
| 10 | +from flybody.tasks.constants import _WALK_CONTROL_TIMESTEP |
| 11 | + |
9 | 12 |
|
10 | 13 | class HDF5TrajectoryLoader(ABC):
|
11 | 14 | """Base class for loading and serving trajectories from hdf5 datasets."""
|
@@ -216,14 +219,21 @@ class InferenceWalkingTrajectoryLoader():
|
216 | 219 | This trajectory loader can be used for bypassing loading actual walking
|
217 | 220 | datasets and loading custom trajectories instead, e.g. at inference time.
|
218 | 221 |
|
219 |
| - To use this class, create qpos and qvel for your custom trajectory and then |
220 |
| - set this trajectory for loading in the walking task by calling: |
221 |
| - env.task._traj_generator.set_next_trajectory(qpos, qvel) |
| 222 | + A simple synthetic walking trajectory is automatically set upon this class |
| 223 | + initialization. |
| 224 | +
|
| 225 | + To use this class with other custom trajectories, create qpos and qvel for |
| 226 | + your custom trajectory and then set this trajectory for loading in the |
| 227 | + walking task by calling: |
| 228 | + env.task._traj_generator.set_next_trajectory(qpos, qvel) |
222 | 229 | """
|
223 | 230 |
|
224 | 231 | def __init__(self):
|
225 |
| - # Nothing here! |
226 |
| - pass |
| 232 | + # Initially, set a simple synthetic trajectory, e.g. for quick testing. |
| 233 | + qpos, qvel = constant_speed_trajectory( |
| 234 | + n_steps=300, speed=2, init_pos=(0, 0, 0.1278), |
| 235 | + control_timestep=_WALK_CONTROL_TIMESTEP) |
| 236 | + self.set_next_trajectory(qpos, qvel) |
227 | 237 |
|
228 | 238 | def set_next_trajectory(self, qpos: np.ndarray, qvel: np.ndarray):
|
229 | 239 | """Set new trajectory to be returned by get_trajectory.
|
|
0 commit comments