@@ -46,7 +46,7 @@ impl Strategy for MyStrategy {
46
46
// Choose My Role 1. GK, 2. DEF, 3. OFF 4. SUP
47
47
let my_role = self . coach . find_role ( me, _game, _rules) ;
48
48
// Execute My Role
49
- let oppGoal = Vec2 :: new ( 0.0 , self . rules . arena . depth /2.0 ) ;
49
+ let oppGoal = Vec2 :: new ( 0.0 , - self . rules . arena . depth /2.0 ) ;
50
50
51
51
match my_role {
52
52
Role :: NONE => println ! ( "No Role is Selected" ) ,
@@ -85,24 +85,28 @@ impl MyStrategy {
85
85
} ;
86
86
let ball_seg = Seg2 :: new ( self . game . ball . position ( ) , self . game . ball . velocity ( ) * 100.0 ) ;
87
87
let biset = get_bisect ( & goal_line, & ball_pos) ;
88
- let mut target = Vec2 { x : 0.0 , y : - self . rules . arena . depth / 2.0 } ;
88
+ let mut target = biset . terminal ( ) ;
89
89
println ! ( "DFAS" ) ;
90
90
if self . game . ball . velocity ( ) . y < -1.0 { // KICK
91
91
target = goal_line. intersection ( ball_seg) ;
92
- if target. is_valid ( ) {
92
+ if ! target. is_valid ( ) {
93
93
target = Vec2 :: new ( ball_pos. x , -self . rules . arena . depth /2.0 ) ;
94
94
}
95
- } else if self . game . ball . position ( ) . y < 1 .0 {
96
- target = biset . terminal ( ) ;
95
+ } else if self . game . ball . position ( ) . y < 0 .0 {
96
+ target = Vec2 { x : self . game . ball . position ( ) . x , y : - self . rules . arena . depth / 2.0 } ;
97
97
}
98
98
if target. x < -self . rules . arena . goal_width /2.0 + 1.5 {
99
99
target. x = -self . rules . arena . goal_width /2.0 + 1.5 ;
100
100
} else if target. x > self . rules . arena . goal_width /2.0 - 1.5 {
101
101
target. x = self . rules . arena . goal_width /2.0 - 1.5 ;
102
102
}
103
103
self . gtp ( & target) ;
104
+ // let my = self.me.position();
105
+ // if self.game.ball.position().dist(Vec2::new(0.0, -self.rules.arena.depth/2.0)) < 20.0 && self.game.ball.velocity().len() < 2.0 {
106
+ // self.kick(&((ball_pos - my) * 10.0));
107
+ // }
104
108
105
- if ( ball_pos. dist ( self . me . position ( ) ) < 4 .0 && self . game . ball . height ( ) > 3.0 ) {
109
+ if ball_pos. dist ( self . me . position ( ) ) < 3 .0 && self . game . ball . height ( ) > 2.5 {
106
110
self . action . jump_speed = self . rules . ROBOT_MAX_JUMP_SPEED ;
107
111
} else {
108
112
self . action . jump_speed = 0.0 ;
@@ -132,24 +136,16 @@ impl MyStrategy {
132
136
let robotpos = self . me . position ( ) ;
133
137
let finalDir = ( * target - ballpos) . th ( ) ;
134
138
let mut idealPath = ( ballpos - robotpos) . th ( ) . deg ( ) ;
135
- <<<<<<< HEAD
136
- let mut movementDir = ( idealPath - finalDir) ;
137
- =======
138
139
let mut movementDir = ( ( ballpos - robotpos) . th ( ) - finalDir) . deg ( ) ;
139
- >>>>>>> origin/kickV2
140
140
let ballVel = self . game . ball . velocity ( ) ;
141
141
if movementDir >= 180.0 {
142
142
movementDir -= 360.0 ;
143
143
}
144
144
if movementDir < -180.0 {
145
145
movementDir += 360.0 ;
146
146
}
147
- <<<<<<< HEAD
148
- println ! ( "movementDir {}" , movementDir) ;
149
- =======
150
147
151
148
println ! ( "movementDir {}" , movementDir ) ;
152
- >>>>>>> origin/kickV2
153
149
154
150
let mut shift = 0.0 ;
155
151
@@ -165,34 +161,24 @@ impl MyStrategy {
165
161
if self . game . ball . height ( ) >= 4.0 && ballVel. len ( ) > 0.0 {
166
162
let touchPrediction = self . ballTouchPrediction ( ) ;
167
163
let mut locationByPredict = touchPrediction + ( touchPrediction - * target) . normalize ( ) * ( self . me . radius + self . game . ball . radius + ( self . game . ball . height ( ) - self . game . ball . radius ) * 0.2 ) + ballVel * 0.05 ;
168
-
164
+
169
165
self . gtp ( & locationByPredict) ;
170
166
} else {
171
167
if ( movementDir. abs ( ) < 25.0 ) {
172
168
idealPath = ( * target - robotpos) . th ( ) . deg ( ) ;
173
169
let sagPath = ( ballpos - robotpos) . th ( ) . deg ( ) ;
174
- <<<<<<< HEAD
175
- if ( ( robotCurrentPath - sagPath) . abs ( ) ) < 40.0 || self . me. velocity( ) . len( ) < 0.1 {
176
- =======
177
170
if ( ( robotCurrentPath - sagPath) . abs ( ) ) < 15.0 && self . me . velocity ( ) . len ( ) > 10.0 {
178
- >>>>>>> origin/kickV2
179
171
jump = self . rules . ROBOT_MAX_JUMP_SPEED ;
180
172
} else {
181
173
jump = 0.0 ;
182
174
}
183
175
} else {
184
176
jump = 0.0 ;
185
- <<<<<<< HEAD
186
- idealPath += shift;
187
- }
188
- self . set_robot_vel ( idealPath , 100.0 , jump ) ;
189
- =======
190
177
idealPath = ( idealPath + shift) ;
191
178
}
192
179
193
180
194
- self . set_robot_vel ( idealPath * 3 . 1415 /180 . 0 , 100.0 , jump ) ;
195
- >>>>>>> origin/kickV2
181
+ self . set_robot_vel ( idealPath* DEG2RAD , 100.0 , jump) ;
196
182
}
197
183
198
184
}
0 commit comments