Convert normalized actions (-1 to 1) to actual values using the specified range
(
normalized_actions,
action_low=np.array([-0.05, -0.05, -0.05, -3.14, -3.14, -3.14, 0]),
action_high=np.array([0.05, 0.05, 0.05, 3.14, 3.14, 3.14, 1]),
)
| 46 | |
| 47 | |
| 48 | def denormalize_actions( |
| 49 | normalized_actions, |
| 50 | action_low=np.array([-0.05, -0.05, -0.05, -3.14, -3.14, -3.14, 0]), |
| 51 | action_high=np.array([0.05, 0.05, 0.05, 3.14, 3.14, 3.14, 1]), |
| 52 | ): |
| 53 | """Convert normalized actions (-1 to 1) to actual values using the specified range""" |
| 54 | mask = np.ones_like(normalized_actions, dtype=bool) |
| 55 | raw_action = np.where( |
| 56 | mask, |
| 57 | 0.5 * (normalized_actions + 1) * (action_high - action_low) + action_low, |
| 58 | normalized_actions, |
| 59 | ) |
| 60 | return raw_action |
| 61 | |
| 62 | |
| 63 | def generate_response(image, user_prompt): |