#A python script executed in cogserver to initialize all things
import os
import roslib; roslib.load_manifest('minecraft_bot')
import rospy
import time
from opencog.spacetime import SpaceTimeAndAtomSpace
from opencog.atomspace import AtomSpace, types
from opencog.type_constructors import set_type_ctor_atomspace
from opencog.utilities import initialize_opencog, finalize_opencog
from perception_module import PerceptionManager
from attention_module import AttentionController
from action_gen import ActionGenerator
from grounded_knowledge import GroundedKnowledge

rospy.init_node('OpenCog_Perception')
spacetime = SpaceTimeAndAtomSpace()
full_path = os.path.realpath(__file__)
config_file_name = os.path.dirname(full_path) + "/opencog_python_eval.conf"
print config_file_name
# import GSN/GPN schema
initialize_opencog(spacetime.get_atomspace(), config_file_name)

set_type_ctor_atomspace(spacetime.get_atomspace())
pm = PerceptionManager(spacetime.get_atomspace(),
                       spacetime.get_space_server(),
                       spacetime.get_time_server())
ag = ActionGenerator(spacetime.get_atomspace(),
                     spacetime.get_space_server(),
                     spacetime.get_time_server())
ac = AttentionController(spacetime.get_atomspace())
import roslib
roslib.load_manifest('minecraft_bot')
import rospy
from minecraft_bot.srv import look_srv, rel_move_srv, abs_move_srv, dig_srv
from opencog.spacetime import SpaceTimeAndAtomSpace
from opencog.spatial import get_near_free_point
from opencog.atomspace import types, TruthValue
from opencog.type_constructors import *

rospy.wait_for_service('set_relative_look')
rospy.wait_for_service('set_look')
rospy.wait_for_service('set_relative_move')
rospy.wait_for_service('set_move')
rospy.wait_for_service('set_dig')

atomspace = SpaceTimeAndAtomSpace().get_atomspace()
space_server = SpaceTimeAndAtomSpace().get_space_server()

try:
    _ros_set_relative_look = rospy.ServiceProxy('set_relative_look', look_srv)
    _ros_set_look = rospy.ServiceProxy('set_look', look_srv)
    _ros_set_relative_move = rospy.ServiceProxy(
        'set_relative_move', rel_move_srv)
    _ros_set_move = rospy.ServiceProxy('set_move', abs_move_srv)
    _ros_set_dig = rospy.ServiceProxy('set_dig', dig_srv)
except rospy.ServiceException as e:
    print "service call failed: %s" % e


def is_attractive(atom, sti_std=1):
    """
# A python script executed in cogserver to initialize all things
import os
import roslib

roslib.load_manifest("minecraft_bot")
import rospy
from opencog.spacetime import SpaceTimeAndAtomSpace
from opencog.atomspace import AtomSpace, types
from opencog.type_constructors import set_type_ctor_atomspace
from opencog.utilities import initialize_opencog, finalize_opencog
from perception_module import PerceptionManager
from attention_module import AttentionController
from action_gen import ActionGenerator

rospy.init_node("OpenCog_Perception")
spacetime = SpaceTimeAndAtomSpace()
full_path = os.path.realpath(__file__)
config_file_name = os.path.dirname(full_path) + "/opencog_python_eval.conf"
print config_file_name
# import GSN/GPN schema
initialize_opencog(spacetime.get_atomspace(), config_file_name)

set_type_ctor_atomspace(spacetime.get_atomspace())
pm = PerceptionManager(spacetime.get_atomspace(), spacetime.get_space_server(), spacetime.get_time_server())
ag = ActionGenerator(spacetime.get_atomspace(), spacetime.get_space_server(), spacetime.get_time_server())
ac = AttentionController(spacetime.get_atomspace())

while not rospy.is_shutdown():
    ac.control_av_in_atomspace()
    ag.generate_action()
    rospy.sleep(0.8)
Exemplo n.º 4
0
import os
import roslib
roslib.load_manifest('minecraft_bot')
import rospy
import time
from opencog.spacetime import SpaceTimeAndAtomSpace
from opencog.atomspace import AtomSpace, types
from opencog.type_constructors import set_type_ctor_atomspace
from opencog.utilities import initialize_opencog, finalize_opencog
from perception_module import PerceptionManager
from attention_module import AttentionController
from action_gen import ActionGenerator
from grounded_knowledge import GroundedKnowledge

rospy.init_node('OpenCog_Perception')
spacetime = SpaceTimeAndAtomSpace()
full_path = os.path.realpath(__file__)
config_file_name = os.path.dirname(full_path) + "/opencog_python_eval.conf"
print config_file_name
# import GSN/GPN schema
initialize_opencog(spacetime.get_atomspace(), config_file_name)

set_type_ctor_atomspace(spacetime.get_atomspace())
pm = PerceptionManager(spacetime.get_atomspace(), spacetime.get_space_server(),
                       spacetime.get_time_server())
ag = ActionGenerator(spacetime.get_atomspace(), spacetime.get_space_server(),
                     spacetime.get_time_server())
ac = AttentionController(spacetime.get_atomspace())

gn = GroundedKnowledge(spacetime.get_atomspace(), spacetime.get_space_server(),
                       spacetime.get_time_server())
Exemplo n.º 5
0
#A python script executed in cogserver to initialize all things
import os
import roslib

roslib.load_manifest('minecraft_bot')
import rospy
from opencog.spacetime import SpaceTimeAndAtomSpace
from opencog.atomspace import AtomSpace, types
from opencog.type_constructors import set_type_ctor_atomspace
from opencog.utilities import initialize_opencog, finalize_opencog
from perception_module import PerceptionManager
from attention_module import AttentionController
from action_gen import ActionGenerator

rospy.init_node('OpenCog_Perception')
spacetime = SpaceTimeAndAtomSpace()
full_path = os.path.realpath(__file__)
config_file_name = os.path.dirname(full_path) + "/opencog_python_eval.conf"
print config_file_name
# import GSN/GPN schema
initialize_opencog(spacetime.get_atomspace(), config_file_name)

set_type_ctor_atomspace(spacetime.get_atomspace())
pm = PerceptionManager(spacetime.get_atomspace(), spacetime.get_space_server(),
                       spacetime.get_time_server())
ag = ActionGenerator(spacetime.get_atomspace(), spacetime.get_space_server(),
                     spacetime.get_time_server())
ac = AttentionController(spacetime.get_atomspace())

while not rospy.is_shutdown():
    ac.control_av_in_atomspace()