Commit 0fbd7727 authored by Mathieu Reymond's avatar Mathieu Reymond
Browse files

separate scene to work without simulator

parent 1d31ca79
......@@ -2,7 +2,6 @@
from features_detection.recognizer import getFeatures
from decision_api.decision_tree_gr import DecisionTreeGR
from planning.baxter import Baxter
from planning.scene import Scene
import cv2
#Baxter and ROS imports
import baxter_interface
......@@ -17,9 +16,6 @@ class BaxterAgent(object):
self.config = config
self.baxter = Baxter();
self.scene = Scene(self.baxter.get_planning_frame())
rospy.sleep(2)
self.init_scene()
self.baxter.both.move(self.baxter.both.neutral)
self.is_train = config['is_train']
......@@ -116,13 +112,6 @@ class BaxterAgent(object):
def save_decision_tree(self):
self.tree.save(self.config['tree_dir'])
def init_scene(self):
#TODO#: initialize scene with description in config
self.scene.clear_scene()
self.scene.set_table()
self.scene.set_item()
rospy.sleep(2)
def init_move(self):
self.baxter.both.move(self.baxter.both.neutral)
self.baxter.right.gripper.close()
......
......@@ -16,22 +16,27 @@ def add_item(scene, color, msg):
if msg:
scene.set_item(color=color)
def main():
if __name__ == '__main__':
moveit_commander.roscpp_initialize(sys.argv)
rospy.init_node('garbage_bot', anonymous=True)
b = BaxterAgent(config)
ab = lambda m: add_item(b.scene, 'blue', m)
ar = lambda m: add_item(b.scene, 'red', m)
# simulator flag
if len(sys.argv) > 1:
scene = Scene(b.baxter.get_planning_frame())
rospy.sleep(2)
scene.clear_scene()
scene.set_table()
scene.set_item()
rospy.sleep(2)
b.navs['left'].button2_changed.connect(ab)
b.navs['right'].button2_changed.connect(ar)
b.train()
b.run()
ab = lambda m: add_item(b.scene, 'blue', m)
ar = lambda m: add_item(b.scene, 'red', m)
b.navs['left'].button2_changed.connect(ab)
b.navs['right'].button2_changed.connect(ar)
if __name__ == '__main__':
main()
b.train()
b.run()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment