simulation physics fixed
fuck them physics
This commit is contained in:
+6
-13
@@ -6,31 +6,27 @@ import numpy as np
|
||||
from ml.env import JackBotEnv, CurriculumPhase
|
||||
|
||||
def evaluate_kinematics(episode_length: int = 1000):
|
||||
# Use kinematics_only mode so inverse kinematics generates gait motion from commands
|
||||
env = JackBotEnv(
|
||||
use_gui=True,
|
||||
random_command=False,
|
||||
max_episode_steps=episode_length,
|
||||
robot_mode="kinematics_only"
|
||||
robot_mode="kinematics"
|
||||
)
|
||||
|
||||
print("\n" + "=" * 70)
|
||||
print(" RUNNING MULTI-PHASE REWARD BENCHMARK (KINEMATICS MODE)")
|
||||
print("=" * 70 + "\n")
|
||||
|
||||
# Define test suite covering every curriculum stage
|
||||
phase_configs = [
|
||||
(CurriculumPhase.STAND_ONLY, "STAND ONLY", np.array([0.0, 0.0, 0.0, 0.0], dtype=np.float32)),
|
||||
(CurriculumPhase.FORWARD, "FORWARD GAIT", np.array([0.1, 0.0, 0.0, 0.0], dtype=np.float32)),
|
||||
(CurriculumPhase.TURN_AND_DIRECTION, "FORWARD + YAW TURN", np.array([0.3, 0.0, 0.0, 0.4], dtype=np.float32)),
|
||||
(CurriculumPhase.OMNI_DIRECTION, "STRIDE LATERAL", np.array([0.2, 0.3, 0.0, 0.0], dtype=np.float32)),
|
||||
(CurriculumPhase.FULL_COMMAND, "FULL OMNI COMBINATION",np.array([0.3, 0.2, 0.0, 0.3], dtype=np.float32)),
|
||||
(CurriculumPhase.FORWARD, "FORWARD GAIT", np.array([1.0, 0.0, 0.0], dtype=np.float32)),
|
||||
(CurriculumPhase.TURN_AND_DIRECTION, "FORWARD + YAW TURN", np.array([0.5, 0.0, 0.4], dtype=np.float32)),
|
||||
(CurriculumPhase.OMNI_DIRECTION, "STRIDE LATERAL", np.array([0.5, 0.5, 0.0], dtype=np.float32)),
|
||||
(CurriculumPhase.FULL_COMMAND, "FULL OMNI COMBINATION",np.array([0.3, 0.2, 0.3], dtype=np.float32)),
|
||||
]
|
||||
|
||||
for phase_enum, label, cmd in phase_configs:
|
||||
obs, _ = env.reset()
|
||||
|
||||
# Force specific curriculum phase & target command
|
||||
env.curriculum_phase = phase_enum
|
||||
env.command = cmd.copy()
|
||||
|
||||
@@ -39,9 +35,7 @@ def evaluate_kinematics(episode_length: int = 1000):
|
||||
step_count = 0
|
||||
|
||||
while not done:
|
||||
# Action array is unused in kinematics_only mode
|
||||
dummy_action = np.zeros(18, dtype=np.float32)
|
||||
|
||||
obs, reward, terminated, truncated, _ = env.step(dummy_action)
|
||||
total_reward += reward
|
||||
step_count += 1
|
||||
@@ -49,11 +43,10 @@ def evaluate_kinematics(episode_length: int = 1000):
|
||||
|
||||
time.sleep(1.0 / 60.0)
|
||||
|
||||
# Retrieve detailed component averages
|
||||
comp_averages = env.get_reward_component_averages()
|
||||
|
||||
print(f"\n--- Episode Stage: [{phase_enum.name}] ({label}) ---")
|
||||
print(f"Command Applied: vx={cmd[0]:.2f}, vy={cmd[1]:.2f}, vz={cmd[2]:.2f}, yaw={cmd[3]:.2f}")
|
||||
print(f"Command Applied: vx={cmd[0]:.2f}, vy={cmd[1]:.2f}, yaw={cmd[2]:.2f}")
|
||||
print(f"Total Episode Reward: {total_reward:.4f}")
|
||||
print("Component Step Averages:")
|
||||
for name, value in comp_averages.items():
|
||||
|
||||
Reference in New Issue
Block a user