Create a left right shake followed by an up down shake trajectory.
(
offset_xyz_m: np.ndarray,
distance_m: float,
num_steps: int,
num_repeats: int,
)
| 122 | |
| 123 | |
| 124 | def create_eye_trajectory_shake( |
| 125 | offset_xyz_m: np.ndarray, |
| 126 | distance_m: float, |
| 127 | num_steps: int, |
| 128 | num_repeats: int, |
| 129 | ) -> list[torch.Tensor]: |
| 130 | """Create a left right shake followed by an up down shake trajectory.""" |
| 131 | num_steps_total = num_steps * num_repeats |
| 132 | num_steps_horizontal = num_steps_total // 2 |
| 133 | num_steps_vertical = num_steps_total - num_steps_horizontal |
| 134 | |
| 135 | offset_x_m, offset_y_m, _ = offset_xyz_m |
| 136 | eye_positions: list[torch.Tensor] = [] |
| 137 | eye_positions.extend( |
| 138 | torch.tensor( |
| 139 | [offset_x_m * np.sin(2 * np.pi * t), 0.0, distance_m], |
| 140 | dtype=torch.float32, |
| 141 | ) |
| 142 | for t in np.linspace(0, num_repeats, num_steps_horizontal) |
| 143 | ) |
| 144 | eye_positions.extend( |
| 145 | torch.tensor( |
| 146 | [0.0, offset_y_m * np.sin(2 * np.pi * t), distance_m], |
| 147 | dtype=torch.float32, |
| 148 | ) |
| 149 | for t in np.linspace(0, num_repeats, num_steps_vertical) |
| 150 | ) |
| 151 | |
| 152 | return eye_positions |
| 153 | |
| 154 | |
| 155 | def create_eye_trajectory_rotate( |
no outgoing calls
no test coverage detected