Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Vicente Castellano Gómez
/
robotAmbientales
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1116eaa4
authored
May 07, 2024
by
Vicente Castellano Gómez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
- Limpieza y pequeña correccion de media vuelta, falta probar
parent
51c3f537
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
44 deletions
mensajeRobot.py
robot.py
mensajeRobot.py
View file @
1116eaa4
...
...
@@ -75,9 +75,6 @@ class MensajeRobot:
def
getMapa
(
self
):
while
(
self
.
mensaje
.
split
(
self
.
sepMsg
)[
0
]
!=
self
.
prefMsg
[
'mapa'
]):
self
.
conex
.
checkMensages
()
time
.
sleep
(
2
)
...
...
robot.py
View file @
1116eaa4
...
...
@@ -64,38 +64,11 @@ class Robot:
return
True
return
False
def
is_blue
(
self
,
rgb
):
if
(
rgb
[
0
]
>=
(
Robot
.
blue_rgb
[
0
]
-
Robot
.
tolerancia
)
and
rgb
[
0
]
<=
(
Robot
.
blue_rgb
[
0
]
+
Robot
.
tolerancia
))
and
(
rgb
[
1
]
>=
(
Robot
.
blue_rgb
[
1
]
-
Robot
.
tolerancia
)
and
rgb
[
1
]
<=
(
Robot
.
blue_rgb
[
1
]
+
Robot
.
tolerancia
))
and
(
rgb
[
2
]
>=
(
Robot
.
blue_rgb
[
2
]
-
Robot
.
tolerancia
)
and
rgb
[
2
]
<=
(
Robot
.
blue_rgb
[
2
]
+
Robot
.
tolerancia
)):
return
True
return
False
def
calibraSensorColor
(
self
):
while
True
:
print
(
self
.
colorSensor
.
rgb
())
wait
(
20
)
def
calibraSensorColorReal
(
self
):
self
.
ev3
.
screen
.
print
(
"Presiona el botón para calibrar el color verde"
)
while
not
Button
.
CENTER
in
self
.
ev3
.
buttons
.
pressed
():
wait
(
10
)
# Medir color verde
green_rgb_medido
=
self
.
colorSensor
.
rgb
()
self
.
ev3
.
screen
.
print
(
"Color verde calibrado:"
,
green_rgb_medido
)
self
.
ev3
.
screen
.
print
(
"Presiona el botón para calibrar el color negro"
)
while
not
self
.
ev3
.
buttons
.
pressed
():
wait
(
10
)
# Medir color negro
black_rgb_medido
=
self
.
colorSensor
.
rgb
()
self
.
ev3
.
screen
.
print
(
"Color negro calibrado:"
,
black_rgb_medido
)
self
.
green_rgb
=
green_rgb_medido
self
.
black_rgb
=
black_rgb_medido
self
.
ev3
.
screen
.
print
(
"Calibración completa."
)
#Metodos para el movimiento
def
giro
(
self
,
grados
):
self
.
giroSensor
.
reset_angle
(
0
)
...
...
@@ -109,18 +82,6 @@ class Robot:
elif
(
ajuste
<
0
):
self
.
robot
.
turn
(
-
1
)
def
girov2
(
self
,
grados
):
self
.
giroSensor
.
reset_angle
(
0
)
self
.
robot
.
curve
(
radius
=
self
.
radiusCurve
,
angle
=
grados
)
while
(
self
.
giroSensor
.
angle
()
!=
grados
):
diferencia
=
self
.
giroSensor
.
angle
()
-
grados
ajuste
=
diferencia
*
-
1
for
i
in
range
(
abs
(
ajuste
)):
if
(
ajuste
>
0
):
self
.
robot
.
turn
(
1
)
elif
(
ajuste
<
0
):
self
.
robot
.
turn
(
-
1
)
def
giraDerecha
(
self
):
self
.
robot
.
straight
(
62
)
#60
self
.
giro
(
90
)
...
...
@@ -135,6 +96,7 @@ class Robot:
self
.
robot
.
straight
(
70
)
self
.
giro
(
90
)
self
.
giro
(
90
)
self
.
giro
(
-
10
)
def
sigueRecto
(
self
,
color
=
green_rgb
):
# Valores iniciales
...
...
@@ -189,7 +151,6 @@ class Robot:
def
soltarPaquete
(
self
):
self
.
robot
.
stop
()
self
.
pala
.
run_target
(
70
,
0
)
self
.
robot
.
straight
(
-
30
)
#Deficnición y realización de la ruta
...
...
@@ -200,7 +161,7 @@ class Robot:
def
actualizaCasilla
(
self
):
self
.
casillaActual
=
self
.
casillaSig
self
.
interfono
.
sendPosicion
(
self
.
casilla
Actual
)
self
.
interfono
.
sendPosicion
(
self
.
casilla
Sig
)
def
recorreRuta
(
self
,
rutaDirecciones
,
rutaCoordenadas
):
for
dir
,
coor
in
zip
(
rutaDirecciones
,
rutaCoordenadas
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment