Changeset 242
- Timestamp:
- 12/04/10 15:50:04 (11 years ago)
- Location:
- trunk/brainstorms/Puzzlebox/Brainstorms
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/brainstorms/Puzzlebox/Brainstorms/Interface.py
r238 r242 10 10 11 11 __changelog__ = """\ 12 Last Update: 2010.1 1.3012 Last Update: 2010.12.04 13 13 14 14 """ … … 53 53 import Puzzlebox.Brainstorms.ThinkGear.Client as thinkgear_client 54 54 import Helicopter_Control as helicopter_control 55 import Wheelchair_Control as wheelchair_control 55 56 #import puzzlebox_logger 56 57 … … 511 512 def connectToWheelchair(self): 512 513 514 device_selection = str(self.comboBoxWheelchairPortSelect.currentText()) 515 516 self.wheelchair = \ 517 wheelchair_control.puzzlebox_brainstorms_wheelchair_control( \ 518 device_address=device_selection, 519 command=None, \ 520 DEBUG=self.DEBUG) 521 522 #self.wheelchair.start() 523 513 524 self.disconnect(self.pushButtonWheelchairConnect, \ 514 525 QtCore.SIGNAL("clicked()"), \ … … 535 546 self.pushButtonWheelchairRelaxationEnable.setEnabled(True) 536 547 self.pushButtonWheelchairSpeedEnable.setEnabled(True) 548 549 # Safety Measure: Explicitely require wheelchair speed control 550 # to be enabled each time it wheelchair is connected 551 self.pushButtonWheelchairSpeedEnable.setChecked(False) 552 self.pushButtonWheelchairSpeedEnable.setText('Disabled') 553 self.progressBarWheelchairSpeed.setValue(0) 537 554 538 555 … … 540 557 541 558 def disconnectFromWheelchair(self): 559 560 self.stopWheelchair() 561 562 #self.wheelchair.stop() 542 563 543 564 self.disconnect(self.pushButtonWheelchairConnect, \ … … 565 586 self.pushButtonWheelchairRelaxationEnable.setEnabled(False) 566 587 self.pushButtonWheelchairSpeedEnable.setEnabled(False) 588 589 # Safety Measure: Explicitely require wheelchair speed control 590 # to be enabled each time it wheelchair is connected 591 self.pushButtonWheelchairSpeedEnable.setChecked(False) 592 self.pushButtonWheelchairSpeedEnable.setText('Disabled') 593 self.progressBarWheelchairSpeed.setValue(0) 567 594 568 595 … … 856 883 857 884 self.connect(self.pushButtonWheelchairForward, \ 858 QtCore.SIGNAL(" clicked()"), \885 QtCore.SIGNAL("pressed()"), \ 859 886 self.driveWheelchairForward) 887 self.connect(self.pushButtonWheelchairForward, \ 888 QtCore.SIGNAL("released()"), \ 889 self.stopWheelchair) 860 890 861 891 self.connect(self.pushButtonWheelchairReverse, \ 862 QtCore.SIGNAL(" clicked()"), \892 QtCore.SIGNAL("pressed()"), \ 863 893 self.driveWheelchairReverse) 894 self.connect(self.pushButtonWheelchairForward, \ 895 QtCore.SIGNAL("released()"), \ 896 self.stopWheelchair) 864 897 865 898 self.connect(self.pushButtonWheelchairLeft, \ 866 QtCore.SIGNAL(" clicked()"), \899 QtCore.SIGNAL("pressed()"), \ 867 900 self.driveWheelchairLeft) 901 self.connect(self.pushButtonWheelchairForward, \ 902 QtCore.SIGNAL("released()"), \ 903 self.stopWheelchair) 868 904 869 905 self.connect(self.pushButtonWheelchairRight, \ 870 QtCore.SIGNAL(" clicked()"), \906 QtCore.SIGNAL("pressed()"), \ 871 907 self.driveWheelchairRight) 872 908 873 909 self.connect(self.pushButtonWheelchairStop, \ 874 QtCore.SIGNAL(" clicked()"), \910 QtCore.SIGNAL("pressed()"), \ 875 911 self.stopWheelchair) 876 912 … … 1008 1044 action = QtGui.QAction(self) 1009 1045 action.setShortcut(QtGui.QKeySequence("k")) 1046 self.connect(action, QtCore.SIGNAL("activated()"), self.pushButtonWheelchairReverse, QtCore.SLOT("animateClick()")) 1047 self.addAction(action) 1048 action = QtGui.QAction(self) 1049 action.setShortcut(QtGui.QKeySequence("m")) 1010 1050 self.connect(action, QtCore.SIGNAL("activated()"), self.pushButtonWheelchairReverse, QtCore.SLOT("animateClick()")) 1011 1051 self.addAction(action) … … 1399 1439 1400 1440 def driveWheelchairForward(self): 1401 print "WheelchairForward" 1441 #print "WheelchairForward" 1442 speed = self.dialWheelchairSpeed.value() 1443 self.wheelchair.sendCommand(speed, 'forward') 1402 1444 1403 1445 def driveWheelchairReverse(self): 1404 1446 print "WheelchairReverse" 1447 speed = self.dialWheelchairSpeed.value() 1448 self.wheelchair.sendCommand(speed, 'reverse') 1405 1449 1406 1450 def driveWheelchairLeft(self): 1407 1451 print "WheelchairLeft" 1452 speed = self.dialWheelchairSpeed.value() 1453 self.wheelchair.sendCommand(speed, 'left') 1408 1454 1409 1455 def driveWheelchairRight(self): 1410 1456 print "WheelchairRight" 1457 speed = self.dialWheelchairSpeed.value() 1458 self.wheelchair.sendCommand(speed, 'right') 1411 1459 1412 1460 def stopWheelchair(self): 1413 1461 print "stopWheelchair" 1462 speed = self.dialWheelchairSpeed.value() 1463 self.wheelchair.sendCommand(speed, 'stop') 1414 1464 1415 1465 -
trunk/brainstorms/Puzzlebox/Brainstorms/Wheelchair_Control.py
r241 r242 193 193 194 194 195 self.send _command(self.wheelchair_speed, self.wheelchair_command)195 self.sendCommand(self.wheelchair_speed, self.wheelchair_command) 196 196 197 197 time.sleep(ARDUINO_INITIALIZATION_TIME) 198 199 return(device) 200 201 202 ################################################################## 203 204 def send_command(self, speed, command): 198 199 200 ################################################################## 201 202 def sendCommand(self, speed, command): 205 203 206 204 self.device.write('%s%s' % (COMMAND_CHARACTER, \ … … 263 261 ################################################################## 264 262 265 def console _control(self):263 def consoleControl(self): 266 264 267 265 if (sys.platform == 'win32'): … … 297 295 ################################################################## 298 296 299 #def gui _control(self):297 #def guiControl(self): 300 298 301 299 #while self.keep_running: … … 309 307 310 308 if (self.command == 'console'): 311 self.console _control()309 self.consoleControl() 312 310 313 311 #elif (self.command == 'gui'):
Note: See TracChangeset
for help on using the changeset viewer.