Changeset 8
- Timestamp:
- 01/28/10 16:05:08 (12 years ago)
- Location:
- rc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
rc/puzzlebox_brainstorms_configuration.py
r7 r8 51 51 52 52 #SERVER_HOST = '127.0.0.1' 53 SERVER_HOST = '' 53 SERVER_HOST = '192.168.1.150' 54 #SERVER_HOST = '' 54 55 SERVER_PORT = 8194 55 56 -
rc/puzzlebox_brainstorms_rc.py
r7 r8 160 160 ################################################################## 161 161 162 def drive_forward(self, connection, power=80, duration= 3):162 def drive_forward(self, connection, power=80, duration=2): 163 163 164 164 "Drive the robot forward at a certain speed for a certain duration" 165 166 self.drive(connection, power, power, duration) 167 168 169 ################################################################## 170 171 def drive_reverse(self, connection, power=80, duration=2): 172 173 "Drive the robot reverse at a certain speed for a certain duration" 174 175 power = -power 165 176 166 177 self.drive(connection, power, power, duration) … … 182 193 ################################################################## 183 194 184 def turn_left(self, connection, power=80, duration= 3):195 def turn_left(self, connection, power=80, duration=2): 185 196 186 197 "Turn the robot counter-clockwise at a" … … 195 206 ################################################################## 196 207 197 def turn_right(self, connection, power=80, duration= 3):208 def turn_right(self, connection, power=80, duration=2): 198 209 199 210 "Turn the robot counter-clockwise at a" … … 201 212 202 213 left_power = power 203 right_power = - power214 right_power = -(power/2) 204 215 205 216 self.drive(connection, left_power, right_power, duration) … … 240 251 self.drive_forward(self.connection) 241 252 253 elif (command == 'drive_reverse'): 254 self.drive_reverse(self.connection) 255 242 256 elif (command == 'turn_in_reverse'): 243 257 self.turn_in_reverse(self.connection) … … 270 284 # Collect default settings and command line parameters 271 285 device = BLUETOOTH_DEVICE 286 command = DEFAULT_RC_COMMAND 272 287 273 288 for each in sys.argv: … … 276 291 device = each[ len("--device="): ] 277 292 elif each.startswith("--command="): 278 device= each[ len("--command="): ]293 command = each[ len("--command="): ] 279 294 280 295 -
rc/puzzlebox_brainstorms_server.py
r7 r8 52 52 53 53 def process_instruction(self, instruction): 54 54 55 55 #self.log.debug("Received instruction: %s" % instruction) 56 56 #if self.DEBUG: … … 62 62 if 'command' in instruction: 63 63 response = '%s instruction received' % instruction['command'] 64 65 64 65 66 66 if 'information' in instruction: 67 67 information = instruction['information'] … … 75 75 elif instruction['command'] == 'drive_forward': 76 76 command = 'python puzzlebox_brainstorms_rc.py --command=drive_forward' 77 os.system(command) 78 79 elif instruction['command'] == 'drive_reverse': 80 command = 'python puzzlebox_brainstorms_rc.py --command=drive_reverse' 77 81 os.system(command) 78 82 … … 159 163 def send_response(self, response): 160 164 161 #if response == "browser exit":162 #self.instruction['command'] = response163 165 164 166 response = pickle.dumps(response)
Note: See TracChangeset
for help on using the changeset viewer.