Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
robot_behaviour
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
Service Desk
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
Antonio Andriella
robot_behaviour
Commits
ec97c583
Commit
ec97c583
authored
4 years ago
by
Antonio Andriella
Browse files
Options
Downloads
Patches
Plain Diff
Add reproduce end game and fix instruction method
parent
88ae1e06
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/robot_behaviour/robot_reproducer.py
+18
-12
18 additions, 12 deletions
src/robot_behaviour/robot_reproducer.py
with
18 additions
and
12 deletions
src/robot_behaviour/robot_reproducer.py
+
18
−
12
View file @
ec97c583
...
...
@@ -10,7 +10,6 @@ import ast
from
robot_behaviour.face_reproducer
import
Face
from
robot_behaviour.speech_reproducer
import
Speech
from
robot_behaviour.gesture_reproducer
import
Gesture
import
robot_behaviour.sentences
as
s
class
Robot
:
def
__init__
(
self
,
speech
,
sentences_file
,
face
=
None
,
gesture
=
None
):
...
...
@@ -433,7 +432,7 @@ class Robot:
b_executed
=
True
return
b_executed
def
instruction
(
self
,
counter
,
facial_expression
):
def
instruction
(
self
,
objective
,
facial_expression
):
'''
The agent provides the instructions of the exercise
Args:
Return:
...
...
@@ -442,16 +441,23 @@ class Robot:
'''
print
(
"
instruction
"
)
b_executed
=
False
if
counter
>=
len
(
self
.
sentences
[
'
instruction
'
])
-
1
:
counter
=
random
.
randint
(
0
,
len
(
self
.
sentences
[
'
instruction
'
])
-
1
)
if
self
.
face
!=
None
and
self
.
gesture
==
None
:
self
.
speech
.
text_to_speech
(
self
.
sentences
[
'
instruction
'
][
counter
],
locked
=
True
)
rospy
.
sleep
(
0.1
)
self
.
face
.
reproduce_face_expression
(
facial_expression
)
b_executed
=
True
elif
self
.
face
==
None
and
self
.
gesture
!=
None
:
assert
"
Error Instruction does not contemplate any gesture
"
else
:
assert
"
Error Instruction does not contemplate any gesture
"
self
.
speech
.
text_to_speech
(
self
.
sentences
[
objective
][
0
],
locked
=
True
)
rospy
.
sleep
(
20
)
self
.
face
.
reproduce_face_expression
(
facial_expression
)
def
end_game
(
self
,
facial_expression
):
'''
The agent provides the instructions of the exercise
Args:
Return:
Bool:
if the action has been executed successfully
'''
print
(
"
end_game
"
)
b_executed
=
False
self
.
speech
.
text_to_speech
(
self
.
sentences
[
'
end_game
'
][
0
],
locked
=
True
)
rospy
.
sleep
(
0.1
)
self
.
face
.
reproduce_face_expression
(
facial_expression
)
def
cancel_action
(
self
):
if
self
.
gesture
!=
None
:
...
...
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