Skip to content

Commit

Permalink
Rename GOAP to RGOAP
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Kolbe committed Jan 9, 2014
1 parent 93fa46c commit 91ac643
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 51 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion goap/mainpage.dox → rgoap/mainpage.dox
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
\mainpage
\htmlinclude manifest.html

\b goap
\b rgoap

<!--
Provide an overview of your package.
Expand Down
6 changes: 3 additions & 3 deletions goap/manifest.xml → rgoap/manifest.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<package>
<description brief="goap">
<description brief="rgoap">

GOAP implementation to be used with ROS, written in Python.
Robotic GOAP implementation to be used with ROS, written in Python.

</description>
<author>Felix Kolbe</author>
<license>BSD</license>
<review status="unreviewed" notes=""/>
<url>http://ros.org/wiki/goap</url>
<url>http://ros.org/wiki/rgoap</url>

<depend package="rospy"/>
<depend package="tf"/>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


import roslib; roslib.load_manifest('goap')
import roslib; roslib.load_manifest('rgoap')
import rospy

import rostopic
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@


class Introspector(object):
"""Gives insight to a planner's plan and GOAP net by publishing prepared
information to a smach_viewer.
"""Gives insight to a RGOAP planner's plan and planning graph by
publishing prepared information to a smach_viewer.
"""
def __init__(self):
self._pathprefix = '/GOAP_PLAN'
self._pathprefix_net = '/GOAP_NET'
self._pathprefix = '/RGOAP_PLAN'
self._pathprefix_net = '/RGOAP_NET'
self._publisher_structure = rospy.Publisher(self._pathprefix + STRUCTURE_TOPIC, SmachContainerStructure, latch=True)
self._publisher_status = rospy.Publisher(self._pathprefix + STATUS_TOPIC, SmachContainerStatus, latch=True)
self._publisher_structure_net = rospy.Publisher(self._pathprefix_net + STRUCTURE_TOPIC, SmachContainerStructure, latch=True)
self._publisher_status_net = rospy.Publisher(self._pathprefix_net + STATUS_TOPIC, SmachContainerStatus, latch=True)


def publish_net(self, goal_node, start_node=None):
"""Publishes a GOAP planning net, reconstructing it from with the goal node.
"""Publishes an RGOAP planning net, reconstructing it from the goal node.
The goal node will be set as the active state, as its userdata is displayed.
"""
Expand Down Expand Up @@ -98,7 +98,7 @@ def _add_nodes_recursively(node, structure):
rospy.sleep(5)

def publish(self, start_node, pathprefix=None):
"""Publishes a planned GOAP plan
"""Publishes a planned RGOAP plan
The start node will be set as the active state, as its userdata is displayed.
"""
Expand Down
2 changes: 1 addition & 1 deletion goap/src/goap/planning.py → rgoap/src/rgoap/planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def plan(self, start_worldstate=None, goal=None):
class PlanExecutor(object):

def execute(self, start_node, introspector=None):
"""Execute a GOAP plan, return True on success, False otherwise"""
"""Execute an RGOAP plan, return True on success, False otherwise"""
assert len(start_node.parent_nodes_path_list) == len(start_node.parent_actions_path_list)

print 'list lengths: ', len(start_node.parent_nodes_path_list), len(start_node.parent_actions_path_list)
Expand Down
26 changes: 13 additions & 13 deletions goap/src/goap/runner.py → rgoap/src/rgoap/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from inheriting import Memory
from planning import Planner, PlanExecutor
from introspection import Introspector
from smach_bridge import SMACHStateWrapperAction, GOAPNodeWrapperState
from smach_bridge import SMACHStateWrapperAction, RGOAPNodeWrapperState
from collections import OrderedDict


Expand Down Expand Up @@ -91,7 +91,7 @@ def __repr__(self):
def _setup_introspection(self):
# init what could have been initialized externally
if not rospy.core.is_initialized():
rospy.init_node('goap_runner_introspector')
rospy.init_node('rgoap_runner_introspector')
# init everything else but only once
if self._introspector is None:
self._introspector = Introspector()
Expand Down Expand Up @@ -129,7 +129,7 @@ def update_and_plan(self, goal, tries=1, introspection=False):
def plan(self, goal, tries=1, introspection=False):
"""plan for given goal and return start_node of plan or None
introspection: introspect GOAP planning via smach.introspection
introspection: introspect RGOAP planning via smach.introspection
"""
# check for any still uninitialised condition
for (condition, value) in self.worldstate._condition_values.iteritems():
Expand Down Expand Up @@ -263,7 +263,7 @@ def plan_and_execute_goals(self, goals):
def update_and_plan_and_execute(self, goal, tries=1, introspection=False):
"""loop that updates, plans and executes until the goal is reached
introspection: introspect GOAP planning and SMACH execution via
introspection: introspect RGOAP planning and SMACH execution via
smach.introspection, defaults to False
"""
outcome = None
Expand All @@ -277,7 +277,7 @@ def update_and_plan_and_execute(self, goal, tries=1, introspection=False):

if start_node is None:
# TODO: maybe at this point update and replan? reality might have changed
rospy.logerr("GOAP Runner aborts, no plan found!")
rospy.logerr("RGOAP Runner aborts, no plan found!")
return 'aborted'

#success = PlanExecutor().execute(start_node)
Expand All @@ -287,7 +287,7 @@ def update_and_plan_and_execute(self, goal, tries=1, introspection=False):
break; # retry

# check failure
rospy.logwarn("GOAP Runner execution fails, replanning..")
rospy.logwarn("RGOAP Runner execution fails, replanning..")

self._update_worldstate()
if not goal.is_valid(self.worldstate):
Expand All @@ -303,7 +303,7 @@ def execute_as_smach(self, start_node, introspection=False):
sm = self._path_to_smach(start_node)
# TODO: create proxies / userdata info for inner-sm introspection
self._current_smach = sm
outcome = execute_smach_container(sm, introspection, name='/GOAP_GENERATED_SMACH')
outcome = execute_smach_container(sm, introspection, name='/RGOAP_GENERATED_SMACH')
self._current_smach = None
return outcome

Expand All @@ -325,7 +325,7 @@ def _path_to_smach(self, start_node):
node.action.translate_worldstate_to_userdata(next_node.worldstate, sm.userdata)
else:
StateMachine.add_auto('%s_%X' % (node.action.__class__.__name__, id(node)),
GOAPNodeWrapperState(node),
RGOAPNodeWrapperState(node),
['succeeded'])

node = next_node
Expand All @@ -341,8 +341,8 @@ def print_worldstate_loop(self):



class GOAPRunnerState(State):
"""Subclass this state to activate the GOAP planner from within a
class RGOAPRunnerState(State):
"""Subclass this state to activate the RGOAP planner from within a
surrounding SMACH state container, e.g. the ActionServerWrapper
"""
# TODO: maybe make this class a smach.Container and add states dynamically?
Expand All @@ -364,18 +364,18 @@ def execute(self, userdata):
self._build_goal.__name__,
self._build_goals.__name__))

print "Generated GOAP sub state machine returns: %s" % outcome
print "Generated RGOAP sub state machine returns: %s" % outcome
if self.preempt_requested():
self.service_preempt()
return 'preempted'
return outcome

def _build_goal(self, userdata):
"""Build and return a goap.Goal the planner should accomplish"""
"""Build and return a rgoap.Goal the planner should accomplish"""
raise NotImplementedError

def _build_goals(self, userdata):
"""Build and return a goap.Goal list the planner should accomplish"""
"""Build and return a rgoap.Goal list the planner should accomplish"""
raise NotImplementedError

def request_preempt(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@



class GOAPNodeWrapperState(State):
"""Used (by the runner) to add GOAP nodes (aka instances of GOAP actions)
class RGOAPNodeWrapperState(State):
"""Used (by the runner) to add RGOAP nodes (aka instances of RGOAP actions)
to a SMACH state machine"""
def __init__(self, node):
State.__init__(self, outcomes=['succeeded', 'aborted'])
Expand All @@ -74,7 +74,7 @@ def execute(self, userdata):
class SMACHStateWrapperAction(Action):
"""A special Action to wrap a SMACH state.
Subclass this class to make a SMACH state available to GOAP planning.
Subclass this class to make a SMACH state available to RGOAP planning.
"""
def __init__(self, state, preconditions, effects, **kwargs):
Action.__init__(self, preconditions, effects, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion goap/test/ConditionTest.py → rgoap/test/ConditionTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import unittest

from goap.common import Condition
from rgoap.common import Condition


class ConditionTest(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion goap/test/MemoryTest.py → rgoap/test/MemoryTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import unittest

from goap.inheriting import Memory
from rgoap.inheriting import Memory


class MemoryTest(unittest.TestCase):
Expand Down
8 changes: 4 additions & 4 deletions goap/test/RunnerTest.py → rgoap/test/RunnerTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
@author: felix
'''
import roslib; roslib.load_manifest('goap')
import roslib; roslib.load_manifest('rgoap')
import rospy

from smach import Sequence

from uashh_smach.util import SleepState, execute_smach_container
from uashh_smach.platform.move_base import WaitForGoalState
from uashh_smach.tasks.tasker import MoveBaseGOAPState
from uashh_smach.tasks.tasker import MoveBaseRGOAPState

from goap.runner import Runner
from rgoap.runner import Runner


def test_runner():
Expand All @@ -33,7 +33,7 @@ def test_runner():
Sequence.add('WAIT_FOR_GOAL', wfg,
transitions={'aborted':'SLEEP'})

Sequence.add('MOVE_BASE_GOAP', MoveBaseGOAPState(runner),
Sequence.add('MOVE_BASE_RGOAP', MoveBaseRGOAPState(runner),
transitions={'succeeded':'SLEEP'})

execute_smach_container(sq, enable_introspection=True)
Expand Down
12 changes: 6 additions & 6 deletions goap/test/SmachGoapTest.py → rgoap/test/SmachRGOAPTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@

import rospy

from goap.common import Condition, Precondition, Goal
from goap.runner import Runner
from goap.inheriting import MemoryCondition
from rgoap.common import Condition, Precondition, Goal
from rgoap.runner import Runner
from rgoap.inheriting import MemoryCondition

from goap.smach_bridge import LookAroundAction
from rgoap.smach_bridge import LookAroundAction

from goap import config_scitos
from rgoap import config_scitos


class Test(unittest.TestCase):

@classmethod
def setUpClass(cls):
rospy.init_node('smach_goap_test')
rospy.init_node('smach_rgoap_test')

def setUp(self):
self.runner = Runner() # config_scitos
Expand Down
12 changes: 6 additions & 6 deletions goap/test/GOAPTestBumpered.py → rgoap/test/TestBumpered.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@

from geometry_msgs.msg import Pose, Point, Quaternion

from goap.common import *
from goap.inheriting import *
from goap.common_ros import *
from goap.runner import Runner
from rgoap.common import *
from rgoap.inheriting import *
from rgoap.common_ros import *
from rgoap.runner import Runner

import goap.config_scitos as config_scitos
import rgoap.config_scitos as config_scitos

from uashh_smach.platform.move_base import position_tuple_to_pose



if __name__ == "__main__":

rospy.init_node('goap_bumper_test', log_level=rospy.INFO)
rospy.init_node('rgoap_bumper_test', log_level=rospy.INFO)

runner = Runner(config_scitos)

Expand Down
8 changes: 4 additions & 4 deletions goap/test/GOAPTestMemory.py → rgoap/test/TestMemory.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@

import unittest

from goap.common import *
from goap.inheriting import *
from goap.planning import Node
from goap.runner import Runner
from rgoap.common import *
from rgoap.inheriting import *
from rgoap.planning import Node
from rgoap.runner import Runner


#@unittest.skip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import unittest

from goap import common_ros
from rgoap import common_ros

from std_msgs.msg import Bool
import rospy
Expand Down

0 comments on commit 91ac643

Please sign in to comment.