Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
omniwheels_x4_soccer_goal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kurtfalk
omniwheels_x4_soccer_goal
Commits
b48a1559
Commit
b48a1559
authored
3 years ago
by
ft-Demo
Browse files
Options
Downloads
Patches
Plain Diff
commit by robo pro coding
parent
0a387609
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
omniwheels_x4_soccer_goal.blockly
+241
-123
241 additions, 123 deletions
omniwheels_x4_soccer_goal.blockly
omniwheels_x4_soccer_goal.py
+21
-15
21 additions, 15 deletions
omniwheels_x4_soccer_goal.py
with
262 additions
and
138 deletions
omniwheels_x4_soccer_goal.blockly
+
241
−
123
View file @
b48a1559
This diff is collapsed.
Click to expand it.
omniwheels_x4_soccer_goal.py
+
21
−
15
View file @
b48a1559
...
...
@@ -58,19 +58,22 @@ def checkTimeoutsSetGoalBoth():
def
stepOnlyGoal
():
global
shot
,
v
,
ticks
,
factor_x
,
state
,
ts_ball
,
ts_goal_left
,
ts_goal_right
,
cmd
,
factor_y
,
goal_width
,
posx_ball
,
posx_goal_left
,
posx_goal_right
,
x_min
,
posx_goal_both
,
posy_ball
,
posy_goal_left
,
posy_goal_right
,
v_slow
,
x_max
,
v_var_ball_xpos
,
y_ball_far
,
v_fast
,
y_ball_touch
,
v_var_ball_ypos
,
y_ball_near
,
search_dir_left
,
ts_deltas
if
posx_goal_both
>=
x_min
and
posx_goal_both
<=
x_max
:
if
goal_width
<
130
:
fwd
(
v_slow
,
10
)
elif
goal_width
>
40
:
bwd
(
v_slow
,
10
)
if
posx_goal_left
!=
None
and
posx_goal_right
!=
None
:
if
posx_goal_both
>=
x_min
and
posx_goal_both
<=
x_max
:
if
goal_width
<
130
:
fwd
(
v_slow
,
10
)
elif
goal_width
>
40
:
bwd
(
v_slow
,
10
)
else
:
pass
elif
posx_goal_both
<
x_min
:
left
(
v_slow
,
10
)
elif
posx_goal_both
>
x_max
:
right
(
v_slow
,
10
)
else
:
pass
elif
posx_goal_both
<
x_min
:
left
(
v_slow
,
10
)
elif
posx_goal_both
>
x_max
:
right
(
v_slow
,
10
)
else
:
pass
left
(
v_slow
,
10
)
def
stepBall
(
shot
):
...
...
@@ -315,12 +318,12 @@ while True:
turnSideRight
(
v_slow
,
20
)
elif
posx_goal_left
!=
None
and
posx_goal_right
==
None
:
state
=
'
BALL_GOAL_LEFT
'
right
(
v_slow
,
1
0
)
turnSideLeft
(
v_slow
,
1
0
)
right
(
v_slow
,
2
0
)
turnSideLeft
(
v_slow
,
2
0
)
elif
posx_goal_left
==
None
and
posx_goal_right
!=
None
:
state
=
'
BALL_GOAL_RIGHT
'
left
(
v_slow
,
1
0
)
turnSideRight
(
v_slow
,
1
0
)
left
(
v_slow
,
2
0
)
turnSideRight
(
v_slow
,
2
0
)
else
:
state
=
'
BALL_NO_GOAL
'
stepBall
(
False
)
...
...
@@ -350,6 +353,9 @@ while True:
ts_deltas
=
[(
time
.
time
()
*
1000
)
-
ts_ball
,
(
time
.
time
()
*
1000
)
-
ts_goal_left
,
(
time
.
time
()
*
1000
)
-
ts_goal_right
]
print
(
'
{:.1f} {:.1f} {:.1f} {}:{} GOAL left: {} {}, right:{} {}, p:{}, w:{} BALL_pos:{},{} v_x:{} v_y:{}
'
.
format
(
ts_deltas
[
0
],
ts_deltas
[
1
],
ts_deltas
[
2
],
state
,
cmd
,
posx_goal_left
,
posy_goal_left
,
posx_goal_right
,
posy_goal_right
,
posx_goal_both
,
goal_width
,
posx_ball
,
posy_ball
,
v_var_ball_xpos
,
v_var_ball_ypos
))
checkTimeoutsSetGoalBoth
()
time
.
sleep
(
min
(
ts_deltas
)
/
1000
)
if
posx_ball
!=
None
and
posx_goal_left
!=
None
and
posx_goal_right
!=
None
:
time
.
sleep
(
min
(
ts_deltas
)
/
1000
)
else
:
time
.
sleep
(
0.01
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment