def execute(self, userdata):
        
        if(self.pose == ""):
            self.pose2 = userdata.base_pose_to_approach
        else:
	    	self.pose2 = self.pose 
        
        handle_base = action_cmdr.move_base(self.pose2)

        while True:                
            rospy.sleep(0.1)
            base_state = handle_base.get_state()
            if (base_state == actionlib.simple_action_client.GoalStatus.SUCCEEDED):
                return "succeeded"
            elif (base_state == actionlib.simple_action_client.GoalStatus.ACTIVE):
                continue
            else:
                print 'last state: ',base_state
                return "failed"
    def execute(self, userdata):

        if (self.pose == ""):
            self.pose2 = userdata.base_pose_to_approach
        else:
            self.pose2 = self.pose

        handle_base = action_cmdr.move_base(self.pose2)

        while True:
            rospy.sleep(0.1)
            base_state = handle_base.get_state()
            if (base_state ==
                    actionlib.simple_action_client.GoalStatus.SUCCEEDED):
                return "succeeded"
            elif (base_state ==
                  actionlib.simple_action_client.GoalStatus.ACTIVE):
                continue
            else:
                print 'last state: ', base_state
                return "failed"
Beispiel #3
0
#!/usr/bin/python
import roslib
roslib.load_manifest('action_cmdr')
import rospy
import action_cmdr
action_cmdr.load(["generic_actions", "youbot_actions"])
from geometry_msgs.msg import PoseStamped

if __name__ == "__main__":
    rospy.init_node(
        'test'
    )  # needed to add this so I could make trajectory messages, require timestamp
    rospy.sleep(2)

    action_cmdr.move_base(target="S1", blocking=True)

    action_cmdr.prepare_perception()

    det_objects = action_cmdr.execute_perception(wait_time=1,
                                                 retries=10,
                                                 blocking=True)
    if len(det_objects) > 0:
        print("Got: %s", det_objects)
        obj = det_objects[0]
        ret = action_cmdr.pick_up(target=obj, blocking=True)
        print("Got: %s", ret)
        action_cmdr.move_base(target="D1", blocking=True)
        action_cmdr.move_gripper(target="open", blocking=True)
    else:
        print("didn't find anything!")
Beispiel #4
0
#!/usr/bin/python
import roslib
roslib.load_manifest('action_cmdr')
import rospy
import action_cmdr
action_cmdr.load(["generic_actions","youbot_actions"])
from geometry_msgs.msg import PoseStamped

if __name__ == "__main__":
    rospy.init_node('test') # needed to add this so I could make trajectory messages, require timestamp
    rospy.sleep(2)

    action_cmdr.move_base(target="S1",blocking=True)
    
    action_cmdr.prepare_perception()
    
    det_objects = action_cmdr.execute_perception(wait_time=1,retries=10,blocking=True)
    if len(det_objects) > 0:
        print("Got: %s",det_objects);
	obj = det_objects[0]
	ret = action_cmdr.pick_up(target=obj,blocking=True)
        print("Got: %s",ret);
	action_cmdr.move_base(target="D1",blocking=True)
	action_cmdr.move_gripper(target="open",blocking=True)
    else:
	print("didn't find anything!")

    #action_cmdr.test("foo")
    
    
    #action_cmdr.move_gripper(target="cylopen", blocking=True)