def if __name__=='__main__': aicontrol = AIControl() count=5 while not rospy.is_shutdown() and not self.aicontrol.isFail(count): aicontrol.stop() count-=1 rospy.sleep(5)
def __init__(self): print 'now do flare' ## vision service gate_srv = 'gate' rospy.wait_for_service(flare_srv) print 'flare_srv start' self.detect_gate = rospy.ServiceProxy(flare_srv) self.check_flare = False self.pos_center = self.detect_gate.data_gate.pos_flare self.aicontrol = AIControl()
def __init__(self) : self.data = vision_chip self.aiccontrol = AIControl() print '<===INIT BUY_GOLD_CHIP===>' rospy.wait_for_service(vision_chip) self.detect_chip = rospy.ServiceProxy('vision_chip', vision_srv_chip)
def __init__(self): self.data = vision_slots() self.aicontrol = AIControl() print '<====INIT SLOTS===>' print 'wait for vision service' rospy.wait_for_service('vision_slots') self.detect_slots = rospy.ServiceProxy('vision_slots', vision_srv_slots)
def __init__(self) : self.data = vision_path() print '<===INIT PATH===>' self.aicontrol = AIControl() rospy.wait_for_service('vision_path') self.detect_path = rospy.ServiceProxy('vision_path', vision_srv_path) self.centerx = 0 self.resetx = 0 self.failed = False
def __init__(self): rospy.init_node('mission_gate', anonymous=True) print 'now do flare' self.check_flare = False self.detect = self.detect_flare.data_flare self.aicontrol = AIControl()
def __init__(self): print '<===INIT MARKER===>' self.aicontrol = AIControl() print '---wait for vision service---' rospy.wait_for_service('vision_qualifying_marker') self.marker_req = rospy.ServiceProxy('vision_qualifying_marker', vision_srv_qualifying_marker) self.data = vision_qualifying_marker()
def __init__(self): print '<===INIT BIN===>' self.aicontrol = AIControl() self.data = vision_roulette rospy.wait_for_service('vision_roulette') self.detect_roulette = rospy.ServiceProxy('vision_roulette', vision_srv_roulette) self.center = 0 self.reset = 0
def __init__(self): rospy.init_node('mission_gate', anonymous=True) print 'now do gate' ## vision service # print 'gate_srv start' # self.detect = self.detect_gate.data_gate self.aicontrol = AIControl()
def __init__(self): print '<===INIT GATE===>' self.aicontrol = AIControl() # wait for vision service and declare variables for store data from vision print '---wait for vision service---' rospy.wait_for_service('vision_qualifying_gate') self.gate_req = rospy.ServiceProxy('vision_qualifying_gate', vision_srv_qualifying_gate) self.gate_data = vision_qualifying_gate()
class Flare(object): def __init__(self): print 'now do flare' ## vision service gate_srv = 'gate' rospy.wait_for_service(flare_srv) print 'flare_srv start' self.detect_gate = rospy.ServiceProxy(flare_srv) self.check_flare = False self.pos_center = self.detect_gate.data_gate.pos_flare self.aicontrol = AIControl() def bump(self): auv = self.aicontrol count = 15 print "mv to center" while rospy.is_shutdown() and self.aicontrol.isFail(count) : if self.pos_center >= 152 and self.pos_center <= 168: print("good aim") break elif self.pos_center < 152: auv.move('right',cons.AUV_SPEED) elif self.pos_center > 168: auv.move('left',cons.AUV_SPEED) count-=1 ## move to center print "move complete" print "bump!!" while rospy.is_shutdown() and self.aicontrol.isFail(count) auv.move('forward',cons.FLARE_SPEED) ## bump flare auv.stop() if __init__ == '__main__': mission_gate = Flare() mission_gate.bump() print "finish gate"
def __init__(self,x,y,z,yaw): ''' - x,y,z, and yaw is relativeDistance. if the value is None that means equal to current state - Task A to Task B - Relative distance between task A and B - Previous state is postion task A - Next state is position task B ''' self.aicontrol = AIControl() self.relativeDistance = {'x':x, 'y': y, 'z': z, 'yaw': yaw} self.previousState = {'x':0,'y': 0, 'z': z, 'yaw': 0}
def __init__(self): print '<===INIT BUY_GOLD_CHIP===>' self.data = vision_buy_a_gold_chip() self.plate = vision_buy_a_gold_chip() self.ball = vision_buy_a_gold_chip() self.aicontrol = AIControl() print 'wait for vision service' rospy.wait_for_service('vision_buy_a_gold_chip') self.detect_buy_a_gold_chip = rospy.ServiceProxy( 'vision_buy_a_gold_chip', vision_srv_buy_a_gold_chip) self.center = 0 self.reset = 0
def __init__(self): print '<===INIT QUALIFY===>' self.aicontrol = AIControl() self.marker = Marker() self.gate = Gate()
def __init__(self): print '<===INIT GATE _PATH===>' self.aicontrol = AIControl() self.gate = Gate() self.path = Path()
#!/usr/bin/python2 from aicontrol import AIControl as aicontrol import rospy global AIControl if __name__=='__main__': aicontrol = AIControl() count=5 while not rospy.is_shutdown(): aicontrol.stop() count-=1 rospy.sleep(5)
#!/usr/bin/python2 from aicontrol import AIControl import rospy global aicontrol if __name__ == '__main__': aicontrol = AIControl() cmd = raw_input( 'command \'stop or 1\' , \'depth or 2\' , \'move or 3\' : ') if cmd == 'stop' or cmd == '1': aicontrol.stop() elif cmd == 'depth' or cmd == '2': pos = int(raw_input('position : ')) aicontrol.depthAbs(pos) elif cmd == 'move' or cmd == '3': count = 5 pos = raw_input('pos : ') speed = int(raw_input('speed : ')) while not rospy.is_shutdown() and not aicontrol.isFail(count): aicontrol.move(pos, speed) # rospy.loginfo('x: %f\ny: %f\nz: %f'%(aicontrol.auv_state[0], aicontrol.auv_state[1], aicontrol.auv_state[2])) count -= 1 aicontrol.stop() rospy.sleep(1)
def __init__(self): self.data = vision_path print '<===INIT PATH===>' self.aicontrol = AIControl() rospy.wait_for_service('vision_path') self.detect_path = rospy.ServiceProxy('vision_path', vision_srv_path)