Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RWC2018 #101

Merged
merged 74 commits into from
Apr 23, 2019
Merged
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
1efdb80
Fix dependencies
Rayman Jun 17, 2018
8bc7dbd
feat(count_and_tell): dummy action for counting objects and reporting
rokusottervanger Jun 17, 2018
8634596
feat(count_and_tell): dummy action for asking name and reporting
rokusottervanger Jun 17, 2018
9bc40ac
feat(): expose dummy actions for asking name and counting objects
rokusottervanger Jun 17, 2018
aa0a7a5
refactor(answer_question): apply context structure
rokusottervanger Jun 17, 2018
ab09656
fix(say): use lower case keywords as upper case messes up grammar
rokusottervanger Jun 17, 2018
45bf1c4
fix(entity_description): entity location is also entity description
rokusottervanger Jun 17, 2018
d6783bd
fix(find): find person not based on name
rokusottervanger Jun 17, 2018
54935de
added TellMeNameOfPerson action, not tested
SamAlexandrov Jun 17, 2018
4e576a3
fix(tell_name_of_person): fixes after sim testing
rokusottervanger Jun 18, 2018
52d19e8
added functionality count objects on the inspected location
SamAlexandrov Jun 18, 2018
6aeae01
some refactoring on robocup
rokusottervanger Jun 19, 2018
d3f1558
Add state machine to count objects and write them to a VariableDesign…
LoyVanBeek Jun 19, 2018
7d4c6b0
Remove debug statement
LoyVanBeek Jun 19, 2018
1058c35
Move CountObjectOnLocation to robot_smach_states and wrap that state …
LoyVanBeek Jun 19, 2018
9b86b6d
Include the result when debugging
LoyVanBeek Jun 19, 2018
9faac8f
fix(find): move to found person
rokusottervanger Jun 19, 2018
d0eec6c
fix(find): add execute result succeeded
rokusottervanger Jun 19, 2018
efa2756
fix(tell_name_of_person): some context fixes
rokusottervanger Jun 19, 2018
15530cb
change state_machine for count and tell
MatthijsBurgh Jun 19, 2018
19e8505
fix(count_and_tell): clearer report of counting
rokusottervanger Jun 19, 2018
24df4ca
fix(find): only find on manipulation locations
rokusottervanger Jun 19, 2018
e84923e
fix(find): clearer reporting
rokusottervanger Jun 19, 2018
95868d0
fix(find): remove references to unassigned self._location
rokusottervanger Jun 19, 2018
2b0105c
fix(count_and_tell): report if failed
rokusottervanger Jun 19, 2018
22e1eb1
no logic here and fixed is_running bug
reinzor Jun 19, 2018
7bf04d4
fix(send_picture): use new context structure
rokusottervanger Jun 19, 2018
53ecffe
fix(find): increase radius of found person
rokusottervanger Jun 19, 2018
a517a5c
fix(guide): check if found a person
rokusottervanger Jun 19, 2018
bef6633
fix(navigate_to): fix waypoint navigation
rokusottervanger Jun 19, 2018
3d83c03
fix(find): select person based on label
rokusottervanger Jun 19, 2018
b30e9ed
fix(guide): use navigate state
rokusottervanger Jun 19, 2018
878056c
fix(navigate_to): if person found, nav to waypoint
rokusottervanger Jun 19, 2018
455d346
fix(navigate_to): fix nav to, assign to entity_designator
rokusottervanger Jun 19, 2018
086eb95
feat(say): you shall not pass
rokusottervanger Jun 19, 2018
db310c8
feat(say): start the party soundboard string
rokusottervanger Jun 19, 2018
26feed1
fix(find): not looking for specific persons in eegpsr
rokusottervanger Jun 20, 2018
97c620a
fix(say): better question for more info
rokusottervanger Jun 20, 2018
2d7daee
refactor(follow): new semantics and context parsing, if no target, fine
rokusottervanger Jun 20, 2018
cb1291f
fix(guide): clearer msg when no target specified
rokusottervanger Jun 20, 2018
88c37fe
fix(pick up): source location required field
rokusottervanger Jun 20, 2018
0da360e
fix(pick up): object also found if category matches
rokusottervanger Jun 20, 2018
d6e4cc9
fix(server): wait for tc to get in position
rokusottervanger Jun 20, 2018
61ea670
fix(guide): target is required
rokusottervanger Jun 20, 2018
cdfd4cc
fix(follow): sucessfully followed None
rokusottervanger Jun 20, 2018
ecb697a
feat(open door): add open door action
rokusottervanger Jun 21, 2018
4bfc3fb
feat(clear table): add action
rokusottervanger Jun 21, 2018
e156223
fix(server): remove robocup hack
rokusottervanger Jun 21, 2018
0d05ff7
fix(init): add open door and clear table
rokusottervanger Jun 21, 2018
2800114
Merge branch 'robocup' of roboticssrv.local:tue-robotics/action_serve…
rokusottervanger Jun 21, 2018
fc61eec
fix(open_door): add functionality of open door
rokusottervanger Jun 21, 2018
dd32a30
Correct imports
reinzor Jun 21, 2018
61bc8e0
hardcoded cupboard in open_door action
MatthijsBurgh Jun 21, 2018
e6951de
fixed sm imports
reinzor Jun 21, 2018
1ee9d46
Fixed merge conflict
reinzor Jun 21, 2018
0688eec
constructor fixes
reinzor Jun 21, 2018
ba5e264
fix(guide final challenge): hard coded guide state. Hacky hacky!
rokusottervanger Jun 21, 2018
004250e
fix(guide final): speak after guide
rokusottervanger Jun 21, 2018
2e89756
fix(clear_table): first navigate, then open dishwasher
reinzor Jun 21, 2018
688224c
feat(find): if find person, select on label
rokusottervanger Jun 21, 2018
dccac75
remove double dep
MatthijsBurgh Sep 26, 2018
d56823b
add dep on robot_smach_states
MatthijsBurgh Nov 18, 2018
1048326
convert recipe to lowercase
MatthijsBurgh Nov 19, 2018
3d55154
Update docstring
LarsJanssenTUe Feb 12, 2019
d72d58e
Remove commented code
LarsJanssenTUe Feb 12, 2019
8446ebf
Remove RWC2018 specific naming
LarsJanssenTUe Feb 26, 2019
1ac2563
Removed the clear_table action since it is a very ugly implementation.
JosjaG Mar 9, 2019
c0144a6
Rename inspect.py to inspect_action.py, to avoid conflicts with the '…
LoyVanBeek Mar 19, 2019
f67e837
add hero as a robot
LarsJanssenTUe Mar 19, 2019
9131e7c
completed __main__ in guide.py
PetervDooren Mar 26, 2019
8715110
find smach state is called differently when looking for anyone
PetervDooren Apr 2, 2019
d853180
Merge branch 'master' into robocup
MatthijsBurgh Apr 2, 2019
37ac1d2
TEMP - simple temp fix to allow further development
JosjaG Apr 9, 2019
7244973
Clean up(count and tell):fix docstring
LarsJanssenTUe Apr 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions action_server/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

<buildtool_depend>catkin</buildtool_depend>

<depend>action_server_msgs</depend>
<depend>grammar_parser</depend>
<depend>robot_skills</depend>
<depend>actionlib</depend>

<exec_depend>action_server_msgs</exec_depend>
<exec_depend>grammar_parser</exec_depend>
<exec_depend>robot_skills</exec_depend>
LoyVanBeek marked this conversation as resolved.
Show resolved Hide resolved
<exec_depend>actionlib</exec_depend>
<exec_depend>challenge_presentation</exec_depend>
</package>
6 changes: 6 additions & 0 deletions action_server/src/action_server/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from answer_question import AnswerQuestion
from arm_goal import ArmGoal
from count_and_tell import CountAndTell
from demo_presentation import DemoPresentation
from find import Find
from follow import Follow
Expand All @@ -16,4 +17,9 @@
from reset_wm import ResetWM
from say import Say
from send_picture import SendPicture
from tell_name_of_person import TellNameOfPerson
from turn_toward_sound import TurnTowardSound

from clear_table import ClearTable
from open_door import OpenDoor
from guide_final_challenge import GuideFinalChallenge
JosjaG marked this conversation as resolved.
Show resolved Hide resolved
62 changes: 40 additions & 22 deletions action_server/src/action_server/actions/answer_question.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from action import Action, ConfigurationData
from find import Find
from entity_description import resolve_entity_description

import rospy
from robocup_knowledge import load_knowledge
Expand All @@ -18,6 +19,33 @@ class AnswerQuestion(Action):
def __init__(self):
Action.__init__(self)
self._required_skills = ['speech', 'hmi']
self._preempt_requested = False

class Semantics:
def __init__(self):
self.target_person = None

@staticmethod
def _parse_semantics(semantics_dict):
semantics = AnswerQuestion.Semantics()

if 'target-person' in semantics_dict:
semantics.target_person = resolve_entity_description(semantics_dict['target-person'])

return semantics

class Context:
def __init__(self):
self.object = None

@staticmethod
def _parse_context(context_dict):
context = AnswerQuestion.Context()

if 'object' in context_dict:
context.object = resolve_entity_description(context_dict['object'])

return context

def _configure(self, robot, config):
self._robot = robot
Expand All @@ -27,38 +55,29 @@ def _configure(self, robot, config):
rospy.logerr("Failed to load speech data for 'AnswerQuestion' action")
return

semantics = AnswerQuestion._parse_semantics(config.semantics)
context = AnswerQuestion._parse_context(config.context)

# If a person is specified in the task description, we need to go and find that person first
if 'target-person' in config.semantics:
self._find_action = Find()
location_id = config.semantics['target-person']['loc']
find_semantics = {'object' : config.semantics['target-person'],
'location' : {'id': location_id,
'type': "furniture" if self._knowledge.is_location(location_id)
else "room"}}
find_config = ConfigurationData(find_semantics, config.knowledge)
find_config_result = self._find_action.configure(robot, find_config)
if not find_config_result.succeeded:
self._config_result = find_config_result
if semantics.target_person and not context.object:
self._config_result.required_context = {
'action': 'find',
'object': config.semantics['target-person']
}
if semantics.target_person.location:
self._config_result.required_context['source-location'] = config.semantics['target-person']['location']
return
else:
self._find_action = None

self._config_result.succeeded = True

def _start(self):
if self._find_action:
find_exec_res = self._find_action.start()
if not find_exec_res.succeeded:
self._execute_result = find_exec_res
return

self._robot.head.look_at_standing_person()
self._robot.head.wait_for_motion_done()

self._robot.speech.speak("What is your question?")

tries = 0
while tries < 3:
while tries < 3 and not self._preempt_requested:
try:
res = self._robot.hmi.query(description="",
grammar=self._speech_data.grammar,
Expand Down Expand Up @@ -90,9 +109,8 @@ def _start(self):
self._execute_result.message = " I did not understand the question. "
tries += 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior implementation above should be moved to the smach states, but I would leave it for this PR and fx it in a refactor.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue #96



def _cancel(self):
pass
self._preempt_requested = True


if __name__ == "__main__":
Expand Down
28 changes: 28 additions & 0 deletions action_server/src/action_server/actions/clear_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from action import Action, ConfigurationData
from challenge_dishwasher.dishwasher import NavigateAndPlaceDishwasher, GrabRobust, NavigateAndOpenDishwasher

class ClearTable(Action):
def __init__(self):
Action.__init__(self)

def _configure(self, robot, config):
self._state_machines = [GrabRobust(robot), NavigateAndOpenDishwasher(robot), NavigateAndPlaceDishwasher(robot)]

self._config_result.succeeded = True
self._active_state_machine = None
return

def _start(self):
for sm in self._state_machines:
self._active_state_machine = sm
self._active_state_machine.execute()

self._active_state_machine = None

self._execute_result.message = " I cleaned the table! "
self._execute_result.succeeded = True
return

def _cancel(self):
if self._active_state_machine:
self._active_state_machine.request_preempt()
JosjaG marked this conversation as resolved.
Show resolved Hide resolved
93 changes: 93 additions & 0 deletions action_server/src/action_server/actions/count_and_tell.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
from action import Action, ConfigurationData
from entity_description import resolve_entity_description

import rospy
import robot_smach_states as states
import robot_smach_states.util.designators as ds



class CountAndTell(Action):
''' The CountAndTell class implements the action to count the number of objects and tell the operator.

Parameters to pass to the configure() method are:
- `sentence` (required): The sentence to speak. May be a keyword to tell something more intelligent.
'''
LarsJanssenTUe marked this conversation as resolved.
Show resolved Hide resolved
def __init__(self):
Action.__init__(self)
self._required_skills = ['speech']

class Semantics:
def __init__(self):
self.location = None
self.object = None

@staticmethod
def _parse_semantics(semantics_dict):
semantics = CountAndTell.Semantics()

semantics.location = resolve_entity_description(semantics_dict['location'])
semantics.object = resolve_entity_description(semantics_dict['object'])

return semantics

def _configure(self, robot, config):
self._robot = robot

semantics = CountAndTell._parse_semantics(config.semantics)

self._count_designator = ds.VariableDesignator(-1)
self._where_to_count_designator = ds.EntityByIdDesignator(robot, id=semantics.location.id)
self._what_to_count_designator = ds.Designator(semantics.object.type)
self._count_state_machine = states.InspectAndCount(robot,
self._where_to_count_designator,
self._what_to_count_designator,
self._count_designator)

# Here we set up a message that is formatted further later, in self._start
self._execute_result.message = "I counted {{c}} {t}s on the {l}".format(t=semantics.object.type,
l=semantics.location.id)
self._config_result.succeeded = True
return

def _start(self):
res = self._count_state_machine.execute()
if res == 'Aborted':
self._execute_result.succeeded = False
self._execute_result.message = "I failed to count the objects."
return

self._execute_result.succeeded = True

# This message is instantiated in _configure but leaves some stuff to be formatted
self._execute_result.message = self._execute_result.message.format(c=self._count_designator.resolve())
self._robot.speech.speak(self._execute_result.message)

def _cancel(self):
pass


if __name__ == "__main__":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be placed in a separate testing script? @MatthijsBurgh @jlunenburg

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I indeed prefer putting these tests (and hence the entire __main__) in a separate test file. It's good though that there's a good and easy way to test it!

rospy.init_node('say_test')

import sys
robot_name = sys.argv[1]
if robot_name == 'amigo':
from robot_skills.amigo import Amigo as Robot
elif robot_name == 'sergio':
from robot_skills.sergio import Sergio as Robot
else:
from robot_skills.mockbot import Mockbot as Robot

robot = Robot()

action = CountAndTell()

config = ConfigurationData({'action': 'count-and-tell',
'location': {'id': 'counter'},
'object': {'type': 'apple'}})

action.configure(robot, config)
action.start()

rospy.loginfo(action._execute_result)
6 changes: 2 additions & 4 deletions action_server/src/action_server/actions/entity_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ def resolve_entity_description(parameters):
description.type = parameters["type"]
if "category" in parameters:
description.category = parameters["category"]
if "loc" in parameters:
description.location = resolve_entity_description(parameters["loc"])
if "location" in parameters:
description.location = resolve_entity_description(parameters["location"])
if "designator" in parameters:
description.designator = parameters["designator"]
if "location" in parameters:
description.location = EntityDescription(id=parameters["location"])

return description
Loading