Ignore:
Timestamp:
07/02/10 03:17:56 (11 years ago)
Author:
sc
Message:

remote_control/puzzlebox_brainstorms_network_client.py:

  • power transmission settings added

remote_control/puzzlebox_brainstorms_remote_control.py:

  • custom power settings added

remote_control/puzzlebox_brainstorms_client_interface.py:

  • power transmission settings added
  • udpateSpeed method tracks and calculates power settings
  • power transmission settings added

remote_control/puzzlebox_brainstorms_configuration.ini:

  • DEFAULT_NXT_POWER_LEVEL added and set to 80

remote_control/interface/qt4_form.py:

  • font sizes tweaked

remote_control/puzzlebox_brainstorms_configuration.py:

  • DEFAULT_NXT_POWER_LEVEL added and set to 80

remote_control/puzzlebox_brainstorms_network_server.py

  • power transmission settings added
File:
1 edited

Legend:

Unmodified
Added
Removed
  • remote_control/puzzlebox_brainstorms_remote_control.py

    r73 r84  
    99# For more information please refer to http://www.gnu.org/copyleft/gpl.html 
    1010# 
    11 # Last Update: 2010.06.28 
     11# Last Update: 2010.07.01 
    1212# 
    1313##################################################################### 
     
    2929DISCRETE_CONTROL_COMMANDS = configuration.BRAINSTORMS_DISCRETE_CONTROL_COMMANDS 
    3030 
     31DEFAULT_NXT_POWER_LEVEL = configuration.DEFAULT_NXT_POWER_LEVEL 
     32 
    3133BLUETOOTH_DEVICE = configuration.NXT_BLUETOOTH_DEVICE 
     34 
    3235MOTORS_MOUNTED_BACKWARDS = configuration.NXT_MOTORS_MOUNTED_BACKWARDS 
    3336MOTOR_PORT_RIGHT = configuration.NXT_MOTOR_PORT_RIGHT 
     
    181184        ################################################################## 
    182185         
    183         def drive_forward(self, connection, power=80, duration=2): 
     186        def drive_forward(self, connection, power=DEFAULT_NXT_POWER_LEVEL, duration=2): 
    184187                 
    185188                "Drive the robot forward at a certain speed for a certain duration" 
     
    190193        ################################################################## 
    191194         
    192         def drive_reverse(self, connection, power=80, duration=2): 
     195        def drive_reverse(self, connection, power=DEFAULT_NXT_POWER_LEVEL, duration=2): 
    193196                 
    194197                "Drive the robot reverse at a certain speed for a certain duration" 
     
    201204        ################################################################## 
    202205         
    203         def turn_left_in_reverse(self, connection, power=80, duration=3): 
     206        def turn_left_in_reverse(self, connection, power=DEFAULT_NXT_POWER_LEVEL, duration=3): 
    204207                 
    205208                "Turn the robot counter-clockwise while backing up at a" 
     
    214217        ################################################################## 
    215218         
    216         def turn_right_in_reverse(self, connection, power=80, duration=3): 
     219        def turn_right_in_reverse(self, connection, power=DEFAULT_NXT_POWER_LEVEL, duration=3): 
    217220                 
    218221                "Turn the robot clockwise while backing up at a" 
     
    227230        ################################################################## 
    228231         
    229         def turn_left(self, connection, power=80, duration=2): 
     232        def turn_left(self, connection, power=DEFAULT_NXT_POWER_LEVEL, duration=2): 
    230233                 
    231234                "Turn the robot counter-clockwise at a" 
     
    240243        ################################################################## 
    241244         
    242         def turn_right(self, connection, power=80, duration=2): 
     245        def turn_right(self, connection, power=DEFAULT_NXT_POWER_LEVEL, duration=2): 
    243246                 
    244247                "Turn the robot counter-clockwise at a" 
     
    279282        ################################################################## 
    280283         
    281         def run(self, command): 
     284        def run(self, command, power=DEFAULT_NXT_POWER_LEVEL): 
     285                 
     286                # If the LEGO Mindstorms NXT is instructed to drive with  
     287                # power less than 50% performance is so poor that we'd be 
     288                # better off simply stopping the motors. 
     289                if power < 50: 
     290                        command = 'stop_motors' 
    282291                 
    283292                if (command == 'drive_forward'): 
    284                         self.drive_forward(self.connection, duration=3) 
     293                        self.drive_forward(self.connection, power=power, duration=3) 
    285294                 
    286295                elif (command == 'drive_reverse'): 
    287                         self.drive_reverse(self.connection) 
     296                        self.drive_reverse(self.connection, power=power) 
    288297                 
    289298                elif (command == 'turn_left'): 
    290                         self.turn_left(self.connection) 
     299                        self.turn_left(self.connection, power=power) 
    291300                 
    292301                elif (command == 'turn_right'): 
    293                         self.turn_right(self.connection) 
     302                        self.turn_right(self.connection, power=power) 
    294303                 
    295304                elif (command == 'turn_left_in_reverse'): 
    296                         self.turn_left_in_reverse(self.connection) 
     305                        self.turn_left_in_reverse(self.connection, power=power) 
    297306                 
    298307                elif (command == 'turn_right_in_reverse'): 
    299                         self.turn_right_in_reverse(self.connection) 
     308                        self.turn_right_in_reverse(self.connection, power=power) 
    300309                 
    301310                elif (command == 'stop_motors'): 
Note: See TracChangeset for help on using the changeset viewer.