def __init__( self, app, robotDriver, *arg, **kw ):
		Plan.__init__(self, app, *arg, **kw )
		self.robot = robotDriver
		self.autonomous = False 
		self.data = sensorDataInit()
		self.current_WP_list = 0
		self.controller_State = controller_State()
		self.all_WP =0;
		
		#overall controller state
		self.state = 0
		self.dir_to_wp = 1
		self.initialized = 0

		#states used to iterate the averaging filter
		self.cur_read = 0
		self.sens1 = 0
		self.sens2 = 0
		self.num_reads = 3
		self.valid_s_reads = 0

		#INIT PATH SUB-STATES
		self.diff = 0
		self.direction = 0
		self.angle = 0
		self.got_init_diff = 0
		self.begin_search = 0
		self.found_max = 0
		self.try_move_to_line = 0
		self.f_dir = 1
		self.sens1_prev = 0

		self.found_dir_to_line = 0
		self.on_line = 0
		self.tried_move = 0
		self.ready_to_move = 1

		#path follow sub_states
		self.ready_for_forward = 1

		#other states
		self.one_wp_reached = 0



		#work 10/31
		self.prev_WP_list = None


		#things you dont have yet
		self.sens2_prev = 0
		self.drift_guess1 = 0
		self.drift_guess2 = 0
		self.drift_dir = 1
		self.old_line_angle = 0
		self.new_line_angle = 0
		self.keep_looking = 1
		self.turn_transition = 0
示例#2
0
 def __init__( self, app, *arg, **kw ):
   if kw.has_key("server"):
     self.svrAddr = (kw['server'],WAYPOINT_MSG_PORT)
     del kw['server']
   else:
     self.svrAddr = (WAYPOINT_HOST,WAYPOINT_MSG_PORT)    
   Plan.__init__(self, app, *arg, **kw )
   self.sock = None
   self.lastSensor = (0,None,None)
   self.lastWaypoints = (0,[])
   self.buf = ''
 def __init__(self, app, *arg, **kw):
     if "port" in kw:
         sPort = int(kw.pop('port'))
     else:
         sPort = WAYPOINT_MSG_PORT
     if "server" in kw:
         self.svrAddr = (kw['server'], sPort)
         del kw['server']
     else:
         self.svrAddr = (WAYPOINT_HOST, sPort)
     Plan.__init__(self, app, *arg, **kw)
     self.sock = None
     self.lastSensor = (0, None, None)
     self.lastWaypoints = (0, [])
     self.buf = b''
示例#4
0
    def __init__(self, app, sensorPlan, movePlan, turnPlan, *arg, **kw):
        # Init superclass
        Plan.__init__(self, app, *arg, **kw)
        # Establish member objects/variables

        # Sensor plan object
        self.sp = sensorPlan
        # Dictionary containing information about state
        self.stateInfo = {}
        # Initialize stateInfo with holder values
        self.initState()
        # Save movement and turning plans
        self.moveP = movePlan
        self.turnP = turnPlan
        self.stop = False
        self.wait = WAIT_DUR
示例#5
0
 def __init__(self, app, servo, **kw):
     Plan.__init__(self, app, **kw)
     assert isinstance(servo, MX64Module), "only works with MX"
     self.servo = servo
     # servo units per rotation
     self.aScl = 36000.0
     # Units for RPM
     self.rpmScl = 1 / 64.0
     # Position offset of zero position
     self.posOfs = 0
     # Orientation of motor; change to -1 to flip
     self.ori = 1
     # Update rate -- time to sleep between controller updates
     self.rate = 0.05
     ### Internal variables
     self.desAng = 0
     self.desRPM = 0
     self.Kp = 25.0
     self.Kv = 0
     self._clearV()
     self._v = nan
     self.__dict__.update(kw)
     self._ensure_motor = self._set_motor
     self._ensure_servo = self._set_servo
 def __init__(self, app, servo, **kw):
     Plan.__init__(self,app,**kw)
     assert isinstance(servo, MX64Module), "only works with MX"
     self.servo = servo
     # servo units per rotation
     self.aScl = 36000.0  
     # Units for RPM
     self.rpmScl = 1 / 64.0
     # Position offset of zero position
     self.posOfs = 0
     # Orientation of motor; change to -1 to flip
     self.ori = 1
     # Update rate -- time to sleep between controller updates
     self.rate = 0.05 
     ### Internal variables
     self.desAng = 0
     self.desRPM = 0
     self.Kp = 25.0
     self.Kv = 0
     self._clearV()
     self._v = nan
     self.__dict__.update(kw)
     self._ensure_motor = self._set_motor
     self._ensure_servo = self._set_servo
示例#7
0
 def __init__( self, app, *arg, **kw ):
   Plan.__init__(self, app, *arg, **kw )
   self.sock = None
   self.lastSensor = (0,None,None)
   self.lastWaypoints = (0,[])