add kick test script

This commit is contained in:
徐学颢
2026-04-19 21:16:41 +08:00
parent 2568fc1a9a
commit c8080d0815
5 changed files with 42 additions and 35 deletions

View File

@@ -104,7 +104,7 @@ class Agent:
self.agent.skills_manager.execute("Neutral") self.agent.skills_manager.execute("Neutral")
else: else:
# self.execute_support_behavior() # self.execute_support_behavior()
self.agent.skills_manager.execute("Neutral") self.kick_ball()
self.agent.robot.commit_motor_targets_pd() self.agent.robot.commit_motor_targets_pd()
@@ -205,22 +205,22 @@ class Agent:
b=target_point, b=target_point,
) )
kick_offset = MathOps.rotate_2d_vec(np.array([0.0, -0.1]), desired_orientation)
close_to_ball = my_to_ball_dist <= 0.24 close_to_ball = my_to_ball_dist <= 0.24
good_orientation = orientation_error <= 14.0 good_orientation = orientation_error <= 8.0
good_lateral_offset = lateral_error_to_shot_line <= 0.16 good_lateral_offset = lateral_error_to_shot_line <= 0.16
in_shooting_range = ball_to_target_dist <= 12.0
can_shoot = ( can_shoot = (
close_to_ball close_to_ball
and behind_ball and behind_ball
and good_orientation and good_orientation
and good_lateral_offset and good_lateral_offset
and in_shooting_range
) )
if not can_shoot: if not can_shoot:
prepare_offset = 0.06 prepare_offset = 0.1
prepare_pos = ball_pos - ball_to_target_dir * prepare_offset prepare_pos = ball_pos - ball_to_target_dir * prepare_offset + kick_offset
self.agent.skills_manager.execute( self.agent.skills_manager.execute(
"Walk", "Walk",

View File

@@ -10,16 +10,16 @@ keyframes:
Left_Shoulder_Roll: -76.000 Left_Shoulder_Roll: -76.000
Left_Elbow_Pitch: -62.000 Left_Elbow_Pitch: -62.000
Left_Elbow_Yaw: 0.000 Left_Elbow_Yaw: 0.000
Right_Shoulder_Pitch: 72.000 Right_Shoulder_Pitch: -72.000
Right_Shoulder_Roll: 52.000 Right_Shoulder_Roll: 52.000
Right_Elbow_Pitch: -70.000 Right_Elbow_Pitch: -70.000
Right_Elbow_Yaw: 0.000 Right_Elbow_Yaw: 0.000
Waist: 0.000 Waist: 0.000
Left_Hip_Pitch: -18.000 Left_Hip_Pitch: -12.000
Left_Hip_Roll: 8.000 Left_Hip_Roll: 8.000
Left_Hip_Yaw: 0.000 Left_Hip_Yaw: 0.000
Left_Knee_Pitch: 42.000 Left_Knee_Pitch: 35.000
Left_Ankle_Pitch: 10.000 Left_Ankle_Pitch: -18.000
Left_Ankle_Roll: 3.000 Left_Ankle_Roll: 3.000
Right_Hip_Pitch: 14.000 Right_Hip_Pitch: 14.000
Right_Hip_Roll: -9.000 Right_Hip_Roll: -9.000
@@ -36,16 +36,16 @@ keyframes:
Left_Shoulder_Roll: -80.000 Left_Shoulder_Roll: -80.000
Left_Elbow_Pitch: -70.000 Left_Elbow_Pitch: -70.000
Left_Elbow_Yaw: 0.000 Left_Elbow_Yaw: 0.000
Right_Shoulder_Pitch: 72.000 Right_Shoulder_Pitch: -72.000
Right_Shoulder_Roll: 50.000 Right_Shoulder_Roll: 50.000
Right_Elbow_Pitch: -70.000 Right_Elbow_Pitch: -70.000
Right_Elbow_Yaw: 0.000 Right_Elbow_Yaw: 0.000
Waist: 0.000 Waist: 0.000
Left_Hip_Pitch: -30.000 Left_Hip_Pitch: -25.000
Left_Hip_Roll: 10.000 Left_Hip_Roll: 10.000
Left_Hip_Yaw: 1.000 Left_Hip_Yaw: 1.000
Left_Knee_Pitch: 54.000 Left_Knee_Pitch: 45.000
Left_Ankle_Pitch: 10.000 Left_Ankle_Pitch: -20.000
Left_Ankle_Roll: 4.500 Left_Ankle_Roll: 4.500
Right_Hip_Pitch: 14.000 Right_Hip_Pitch: 14.000
Right_Hip_Roll: -9.000 Right_Hip_Roll: -9.000
@@ -62,16 +62,16 @@ keyframes:
Left_Shoulder_Roll: -82.000 Left_Shoulder_Roll: -82.000
Left_Elbow_Pitch: -74.000 Left_Elbow_Pitch: -74.000
Left_Elbow_Yaw: 0.000 Left_Elbow_Yaw: 0.000
Right_Shoulder_Pitch: 72.000 Right_Shoulder_Pitch: -72.000
Right_Shoulder_Roll: 48.000 Right_Shoulder_Roll: 48.000
Right_Elbow_Pitch: -68.000 Right_Elbow_Pitch: -68.000
Right_Elbow_Yaw: 0.000 Right_Elbow_Yaw: 0.000
Waist: 0.000 Waist: 0.000
Left_Hip_Pitch: -46.000 Left_Hip_Pitch: -40.000
Left_Hip_Roll: 12.000 Left_Hip_Roll: 12.000
Left_Hip_Yaw: 2.000 Left_Hip_Yaw: 2.000
Left_Knee_Pitch: 28.000 Left_Knee_Pitch: 18.000
Left_Ankle_Pitch: 10.000 Left_Ankle_Pitch: -24.000
Left_Ankle_Roll: 5.000 Left_Ankle_Roll: 5.000
Right_Hip_Pitch: 14.000 Right_Hip_Pitch: 14.000
Right_Hip_Roll: -8.000 Right_Hip_Roll: -8.000
@@ -88,16 +88,16 @@ keyframes:
Left_Shoulder_Roll: -84.000 Left_Shoulder_Roll: -84.000
Left_Elbow_Pitch: -76.000 Left_Elbow_Pitch: -76.000
Left_Elbow_Yaw: 0.000 Left_Elbow_Yaw: 0.000
Right_Shoulder_Pitch: 72.000 Right_Shoulder_Pitch: -72.000
Right_Shoulder_Roll: 46.000 Right_Shoulder_Roll: 46.000
Right_Elbow_Pitch: -66.000 Right_Elbow_Pitch: -66.000
Right_Elbow_Yaw: 0.000 Right_Elbow_Yaw: 0.000
Waist: 0.000 Waist: 0.000
Left_Hip_Pitch: -58.000 Left_Hip_Pitch: -48.000
Left_Hip_Roll: 13.000 Left_Hip_Roll: 13.000
Left_Hip_Yaw: 3.000 Left_Hip_Yaw: 3.000
Left_Knee_Pitch: -16.000 Left_Knee_Pitch: -8.000
Left_Ankle_Pitch: 8.000 Left_Ankle_Pitch: -18.000
Left_Ankle_Roll: 5.000 Left_Ankle_Roll: 5.000
Right_Hip_Pitch: 12.000 Right_Hip_Pitch: 12.000
Right_Hip_Roll: -8.000 Right_Hip_Roll: -8.000
@@ -114,16 +114,16 @@ keyframes:
Left_Shoulder_Roll: -86.000 Left_Shoulder_Roll: -86.000
Left_Elbow_Pitch: -72.000 Left_Elbow_Pitch: -72.000
Left_Elbow_Yaw: 0.000 Left_Elbow_Yaw: 0.000
Right_Shoulder_Pitch: 70.000 Right_Shoulder_Pitch: -70.000
Right_Shoulder_Roll: 44.000 Right_Shoulder_Roll: 44.000
Right_Elbow_Pitch: -64.000 Right_Elbow_Pitch: -64.000
Right_Elbow_Yaw: 0.000 Right_Elbow_Yaw: 0.000
Waist: 0.000 Waist: 0.000
Left_Hip_Pitch: -62.000 Left_Hip_Pitch: -50.000
Left_Hip_Roll: 13.000 Left_Hip_Roll: 13.000
Left_Hip_Yaw: 3.000 Left_Hip_Yaw: 3.000
Left_Knee_Pitch: 10.000 Left_Knee_Pitch: 5.000
Left_Ankle_Pitch: 6.000 Left_Ankle_Pitch: -22.000
Left_Ankle_Roll: 5.000 Left_Ankle_Roll: 5.000
Right_Hip_Pitch: 12.000 Right_Hip_Pitch: 12.000
Right_Hip_Roll: -8.000 Right_Hip_Roll: -8.000
@@ -141,16 +141,16 @@ keyframes:
Left_Shoulder_Roll: -82.000 Left_Shoulder_Roll: -82.000
Left_Elbow_Pitch: -69.000 Left_Elbow_Pitch: -69.000
Left_Elbow_Yaw: 0.000 Left_Elbow_Yaw: 0.000
Right_Shoulder_Pitch: 72.000 Right_Shoulder_Pitch: -72.000
Right_Shoulder_Roll: 48.000 Right_Shoulder_Roll: 48.000
Right_Elbow_Pitch: -68.000 Right_Elbow_Pitch: -68.000
Right_Elbow_Yaw: 0.000 Right_Elbow_Yaw: 0.000
Waist: 0.000 Waist: 0.000
Left_Hip_Pitch: -16.000 Left_Hip_Pitch: -8.000
Left_Hip_Roll: 9.000 Left_Hip_Roll: 9.000
Left_Hip_Yaw: 1.000 Left_Hip_Yaw: 1.000
Left_Knee_Pitch: 38.000 Left_Knee_Pitch: 28.000
Left_Ankle_Pitch: 9.000 Left_Ankle_Pitch: -22.000
Left_Ankle_Roll: 3.000 Left_Ankle_Roll: 3.000
Right_Hip_Pitch: 8.000 Right_Hip_Pitch: 8.000
Right_Hip_Roll: -5.000 Right_Hip_Roll: -5.000
@@ -167,16 +167,16 @@ keyframes:
Left_Shoulder_Roll: -82.000 Left_Shoulder_Roll: -82.000
Left_Elbow_Pitch: -68.000 Left_Elbow_Pitch: -68.000
Left_Elbow_Yaw: 0.000 Left_Elbow_Yaw: 0.000
Right_Shoulder_Pitch: 68.000 Right_Shoulder_Pitch: -68.000
Right_Shoulder_Roll: 48.000 Right_Shoulder_Roll: 48.000
Right_Elbow_Pitch: -62.000 Right_Elbow_Pitch: -62.000
Right_Elbow_Yaw: 0.000 Right_Elbow_Yaw: 0.000
Waist: 0.000 Waist: 0.000
Left_Hip_Pitch: -10.000 Left_Hip_Pitch: -2.000
Left_Hip_Roll: 9.000 Left_Hip_Roll: 9.000
Left_Hip_Yaw: 1.000 Left_Hip_Yaw: 1.000
Left_Knee_Pitch: 34.000 Left_Knee_Pitch: 28.000
Left_Ankle_Pitch: 9.000 Left_Ankle_Pitch: -18.000
Left_Ankle_Roll: 3.000 Left_Ankle_Roll: 3.000
Right_Hip_Pitch: 8.000 Right_Hip_Pitch: 8.000
Right_Hip_Roll: -5.000 Right_Hip_Roll: -5.000
@@ -193,7 +193,7 @@ keyframes:
Left_Shoulder_Roll: -75.000 Left_Shoulder_Roll: -75.000
Left_Elbow_Pitch: -60.000 Left_Elbow_Pitch: -60.000
Left_Elbow_Yaw: 0.000 Left_Elbow_Yaw: 0.000
Right_Shoulder_Pitch: 65.000 Right_Shoulder_Pitch: -65.000
Right_Shoulder_Roll: 45.000 Right_Shoulder_Roll: 45.000
Right_Elbow_Pitch: -60.000 Right_Elbow_Pitch: -60.000
Right_Elbow_Yaw: 0.000 Right_Elbow_Yaw: 0.000

7
kick_test.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
export OMP_NUM_THREADS=1
host=${1:-localhost}
port=${2:-60000}
python3 run_player.py --host $host --port $port -n 1 -t SE &

0
readme.md Normal file → Executable file
View File

0
start_FIFA.sh Normal file → Executable file
View File