From c8080d08153743aa3eeb4ce588085ee47489f26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=AD=A6=E9=A2=A2?= Date: Sun, 19 Apr 2026 21:16:41 +0800 Subject: [PATCH] add kick test script --- agent/agent.py | 12 ++-- .../custom/keyframe/kick/kick_short.yaml | 58 +++++++++---------- kick_test.sh | 7 +++ readme.md | 0 start_FIFA.sh | 0 5 files changed, 42 insertions(+), 35 deletions(-) create mode 100755 kick_test.sh mode change 100644 => 100755 readme.md mode change 100644 => 100755 start_FIFA.sh diff --git a/agent/agent.py b/agent/agent.py index 6efe0d8..9df79df 100644 --- a/agent/agent.py +++ b/agent/agent.py @@ -104,7 +104,7 @@ class Agent: self.agent.skills_manager.execute("Neutral") else: # self.execute_support_behavior() - self.agent.skills_manager.execute("Neutral") + self.kick_ball() self.agent.robot.commit_motor_targets_pd() @@ -205,22 +205,22 @@ class Agent: 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 - good_orientation = orientation_error <= 14.0 + good_orientation = orientation_error <= 8.0 good_lateral_offset = lateral_error_to_shot_line <= 0.16 - in_shooting_range = ball_to_target_dist <= 12.0 can_shoot = ( close_to_ball and behind_ball and good_orientation and good_lateral_offset - and in_shooting_range ) if not can_shoot: - prepare_offset = 0.06 - prepare_pos = ball_pos - ball_to_target_dir * prepare_offset + prepare_offset = 0.1 + prepare_pos = ball_pos - ball_to_target_dir * prepare_offset + kick_offset self.agent.skills_manager.execute( "Walk", diff --git a/behaviors/custom/keyframe/kick/kick_short.yaml b/behaviors/custom/keyframe/kick/kick_short.yaml index b4a242d..981c99c 100644 --- a/behaviors/custom/keyframe/kick/kick_short.yaml +++ b/behaviors/custom/keyframe/kick/kick_short.yaml @@ -10,16 +10,16 @@ keyframes: Left_Shoulder_Roll: -76.000 Left_Elbow_Pitch: -62.000 Left_Elbow_Yaw: 0.000 - Right_Shoulder_Pitch: 72.000 + Right_Shoulder_Pitch: -72.000 Right_Shoulder_Roll: 52.000 Right_Elbow_Pitch: -70.000 Right_Elbow_Yaw: 0.000 Waist: 0.000 - Left_Hip_Pitch: -18.000 + Left_Hip_Pitch: -12.000 Left_Hip_Roll: 8.000 Left_Hip_Yaw: 0.000 - Left_Knee_Pitch: 42.000 - Left_Ankle_Pitch: 10.000 + Left_Knee_Pitch: 35.000 + Left_Ankle_Pitch: -18.000 Left_Ankle_Roll: 3.000 Right_Hip_Pitch: 14.000 Right_Hip_Roll: -9.000 @@ -36,16 +36,16 @@ keyframes: Left_Shoulder_Roll: -80.000 Left_Elbow_Pitch: -70.000 Left_Elbow_Yaw: 0.000 - Right_Shoulder_Pitch: 72.000 + Right_Shoulder_Pitch: -72.000 Right_Shoulder_Roll: 50.000 Right_Elbow_Pitch: -70.000 Right_Elbow_Yaw: 0.000 Waist: 0.000 - Left_Hip_Pitch: -30.000 + Left_Hip_Pitch: -25.000 Left_Hip_Roll: 10.000 Left_Hip_Yaw: 1.000 - Left_Knee_Pitch: 54.000 - Left_Ankle_Pitch: 10.000 + Left_Knee_Pitch: 45.000 + Left_Ankle_Pitch: -20.000 Left_Ankle_Roll: 4.500 Right_Hip_Pitch: 14.000 Right_Hip_Roll: -9.000 @@ -62,16 +62,16 @@ keyframes: Left_Shoulder_Roll: -82.000 Left_Elbow_Pitch: -74.000 Left_Elbow_Yaw: 0.000 - Right_Shoulder_Pitch: 72.000 + Right_Shoulder_Pitch: -72.000 Right_Shoulder_Roll: 48.000 Right_Elbow_Pitch: -68.000 Right_Elbow_Yaw: 0.000 Waist: 0.000 - Left_Hip_Pitch: -46.000 + Left_Hip_Pitch: -40.000 Left_Hip_Roll: 12.000 Left_Hip_Yaw: 2.000 - Left_Knee_Pitch: 28.000 - Left_Ankle_Pitch: 10.000 + Left_Knee_Pitch: 18.000 + Left_Ankle_Pitch: -24.000 Left_Ankle_Roll: 5.000 Right_Hip_Pitch: 14.000 Right_Hip_Roll: -8.000 @@ -88,16 +88,16 @@ keyframes: Left_Shoulder_Roll: -84.000 Left_Elbow_Pitch: -76.000 Left_Elbow_Yaw: 0.000 - Right_Shoulder_Pitch: 72.000 + Right_Shoulder_Pitch: -72.000 Right_Shoulder_Roll: 46.000 Right_Elbow_Pitch: -66.000 Right_Elbow_Yaw: 0.000 Waist: 0.000 - Left_Hip_Pitch: -58.000 + Left_Hip_Pitch: -48.000 Left_Hip_Roll: 13.000 Left_Hip_Yaw: 3.000 - Left_Knee_Pitch: -16.000 - Left_Ankle_Pitch: 8.000 + Left_Knee_Pitch: -8.000 + Left_Ankle_Pitch: -18.000 Left_Ankle_Roll: 5.000 Right_Hip_Pitch: 12.000 Right_Hip_Roll: -8.000 @@ -114,16 +114,16 @@ keyframes: Left_Shoulder_Roll: -86.000 Left_Elbow_Pitch: -72.000 Left_Elbow_Yaw: 0.000 - Right_Shoulder_Pitch: 70.000 + Right_Shoulder_Pitch: -70.000 Right_Shoulder_Roll: 44.000 Right_Elbow_Pitch: -64.000 Right_Elbow_Yaw: 0.000 Waist: 0.000 - Left_Hip_Pitch: -62.000 + Left_Hip_Pitch: -50.000 Left_Hip_Roll: 13.000 Left_Hip_Yaw: 3.000 - Left_Knee_Pitch: 10.000 - Left_Ankle_Pitch: 6.000 + Left_Knee_Pitch: 5.000 + Left_Ankle_Pitch: -22.000 Left_Ankle_Roll: 5.000 Right_Hip_Pitch: 12.000 Right_Hip_Roll: -8.000 @@ -141,16 +141,16 @@ keyframes: Left_Shoulder_Roll: -82.000 Left_Elbow_Pitch: -69.000 Left_Elbow_Yaw: 0.000 - Right_Shoulder_Pitch: 72.000 + Right_Shoulder_Pitch: -72.000 Right_Shoulder_Roll: 48.000 Right_Elbow_Pitch: -68.000 Right_Elbow_Yaw: 0.000 Waist: 0.000 - Left_Hip_Pitch: -16.000 + Left_Hip_Pitch: -8.000 Left_Hip_Roll: 9.000 Left_Hip_Yaw: 1.000 - Left_Knee_Pitch: 38.000 - Left_Ankle_Pitch: 9.000 + Left_Knee_Pitch: 28.000 + Left_Ankle_Pitch: -22.000 Left_Ankle_Roll: 3.000 Right_Hip_Pitch: 8.000 Right_Hip_Roll: -5.000 @@ -167,16 +167,16 @@ keyframes: Left_Shoulder_Roll: -82.000 Left_Elbow_Pitch: -68.000 Left_Elbow_Yaw: 0.000 - Right_Shoulder_Pitch: 68.000 + Right_Shoulder_Pitch: -68.000 Right_Shoulder_Roll: 48.000 Right_Elbow_Pitch: -62.000 Right_Elbow_Yaw: 0.000 Waist: 0.000 - Left_Hip_Pitch: -10.000 + Left_Hip_Pitch: -2.000 Left_Hip_Roll: 9.000 Left_Hip_Yaw: 1.000 - Left_Knee_Pitch: 34.000 - Left_Ankle_Pitch: 9.000 + Left_Knee_Pitch: 28.000 + Left_Ankle_Pitch: -18.000 Left_Ankle_Roll: 3.000 Right_Hip_Pitch: 8.000 Right_Hip_Roll: -5.000 @@ -193,7 +193,7 @@ keyframes: Left_Shoulder_Roll: -75.000 Left_Elbow_Pitch: -60.000 Left_Elbow_Yaw: 0.000 - Right_Shoulder_Pitch: 65.000 + Right_Shoulder_Pitch: -65.000 Right_Shoulder_Roll: 45.000 Right_Elbow_Pitch: -60.000 Right_Elbow_Yaw: 0.000 diff --git a/kick_test.sh b/kick_test.sh new file mode 100755 index 0000000..5ed91b2 --- /dev/null +++ b/kick_test.sh @@ -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 & diff --git a/readme.md b/readme.md old mode 100644 new mode 100755 diff --git a/start_FIFA.sh b/start_FIFA.sh old mode 100644 new mode 100755