Changeset 216 for trunk


Ignore:
Timestamp:
11/24/10 09:51:19 (11 years ago)
Author:
sc
Message:

Brainstorms/Helicopter_Control.py:

  • PROTOCOL_SYNC_TIME added (set to five seconds)
  • whitespace/comments cleanup
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/brainstorms/Puzzlebox/Brainstorms/Helicopter_Control.py

    r215 r216  
    4949DEFAULT_MODE = 'read' 
    5050 
    51 PROTOCOL_SYNC = '\x80' 
     51PROTOCOL_SYNC_TIME = 5 
    5252PROTOCOL_SYNC_HEAD1 = '\x00' 
    5353PROTOCOL_SYNC_HEAD2 = '\x00' 
     
    190190                        print "--> Command: test_mode" 
    191191                 
    192                 #self.protocol.command_packet = COMMAND_PACKET['neutral'] 
    193                 #self.protocol.command_packet = COMMAND_PACKET['minimum_thrust_minus_one'] 
    194192                self.protocol.command_packet = COMMAND_PACKET['no_thrust'] 
    195                 QtCore.QThread.msleep(4 * 1000) # 4 seconds to sync 
    196                  
    197                 #self.protocol.command_packet = COMMAND_PACKET['maximum_thrust'] 
     193                QtCore.QThread.msleep(PROTOCOL_SYNC_TIME * 1000) # 4 seconds minimum to sync 
     194                 
    198195                self.protocol.command_packet = COMMAND_PACKET['minimum_thrust'] 
    199196                QtCore.QThread.msleep(2 * 1000) # 1 second 
    200197                 
    201                 #self.protocol.command_packet = COMMAND_PACKET['neutral'] 
    202                 #self.protocol.command_packet = COMMAND_PACKET['minimum_thrust_minus_one'] 
    203198                self.protocol.command_packet = COMMAND_PACKET['no_thrust'] 
    204199         
     
    206201        ################################################################## 
    207202         
    208         def hover(self): 
     203        def hover(self, duration=2): 
    209204                 
    210205                if self.DEBUG: 
    211206                        print "--> Command: hover" 
    212207                 
    213                 #self.protocol.command_packet = COMMAND_PACKET['neutral'] 
    214                 #self.protocol.command_packet = COMMAND_PACKET['minimum_thrust_minus_one'] 
    215208                self.protocol.command_packet = COMMAND_PACKET['no_thrust'] 
    216                 QtCore.QThread.msleep(5 * 1000) # 4 seconds to sync 
    217                  
    218                 #self.protocol.command_packet = COMMAND_PACKET['maximum_thrust'] 
     209                QtCore.QThread.msleep(PROTOCOL_SYNC_TIME * 1000) # 4 seconds minimum to sync 
     210                 
    219211                self.protocol.command_packet = COMMAND_PACKET['fifty_percent_thrust'] 
    220                 QtCore.QThread.msleep(2 * 1000) # 1 second 
    221                  
    222                 #self.protocol.command_packet = COMMAND_PACKET['neutral'] 
    223                 #self.protocol.command_packet = COMMAND_PACKET['minimum_thrust_minus_one'] 
     212                QtCore.QThread.msleep(duration * 1000) 
     213                 
    224214                self.protocol.command_packet = COMMAND_PACKET['no_thrust'] 
    225215         
     
    227217        ################################################################## 
    228218         
    229         def fly_forward(self, duration): 
     219        def fly_forward(self, duration=2): 
    230220                 
    231221                if self.DEBUG: 
     
    233223                 
    234224                self.protocol.command_packet = COMMAND_PACKET['no_thrust'] 
    235                 QtCore.QThread.msleep(5 * 1000) # 1 second 
    236                  
    237                 self.protocol.command_packet = COMMAND_PACKET['fly_forward'] 
    238                 QtCore.QThread.msleep(duration * 1000) # 1 second 
     225                QtCore.QThread.msleep(PROTOCOL_SYNC_TIME * 1000) 
     226                 
     227                self.protocol.command_packet = COMMAND_PACKET['fly_forwardsvn'] 
     228                QtCore.QThread.msleep(duration * 1000) 
    239229                 
    240230                self.protocol.command_packet = COMMAND_PACKET['no_thrust'] 
Note: See TracChangeset for help on using the changeset viewer.