source: trunk/brainstorms/Puzzlebox/Brainstorms/Configuration.py @ 224

Last change on this file since 224 was 224, checked in by sc, 11 years ago

trunk/brainstorms/interface/puzzlebox_brainstorms_interface_design.ui:
trunk/brainstorms/Puzzlebox/Brainstorms/Interface_Design.py:

  • SVG image paths fixed

trunk/brainstorms/Puzzlebox/Brainstorms/Interface.py:

  • rc helicopters progress bars working
  • rc helicopter progress bars enable/disable working
  • control panel configuration settings working

trunk/brainstorms/Puzzlebox/Brainstorms/Configuration.py:
trunk/brainstorms/puzzlebox_brainstorms_configuration.ini:

  • motor port display order swapped
File size: 5.9 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#
4# Puzzlebox - Brainstorms - Configuration
5#
6# Copyright Puzzlebox Productions, LLC (2010)
7#
8# This code is released under the GNU Pulic License (GPL) version 2
9# For more information please refer to http://www.gnu.org/copyleft/gpl.html
10
11__changelog__ = """\
12Last Update: 2010.10.01
13
14"""
15
16import os, sys
17#import pygame
18
19#####################################################################
20# General configuration
21#####################################################################
22
23DEBUG = 1
24
25ENABLE_CONTROL_PANEL = True
26
27AUTOCONNECT_TO_NXT_DEVICE = False
28
29BRAINSTORMS_CONFIGURATION_FILE_PATH = 'puzzlebox_brainstorms_configuration.ini'
30
31#####################################################################
32# Logging
33#####################################################################
34
35LOG_LEVEL_DEBUG = 2
36LOG_LEVEL_INFO = 1
37LOG_LEVEL_ERROR = 0
38LOG_LEVEL_DISABLE = -1
39
40DEFAULT_LOG_LEVEL = LOG_LEVEL_DEBUG
41DEFAULT_LOGFILE = 'brainstorms'
42
43LOGFILE_DIR = '/var/log/puzzlebox'
44LOGFILE_SUFFIX = '.log'
45LOGFILE_SUFFIX_DEBUG = '_debug.log'
46LOGFILE_SUFFIX_INFO = '_info.log'
47LOGFILE_SUFFIX_ERROR = '_error.log'
48
49SPLIT_LOGFILES = False
50
51
52#####################################################################
53# Network addresses
54#####################################################################
55
56BRAINSTORMS_SERVER_INTERFACE = '' # listen on all of server's network interfaces
57BRAINSTORMS_SERVER_HOST = '127.0.0.1' # localhost
58BRAINSTORMS_SERVER_PORT = 8194
59
60THINKGEAR_SERVER_INTERFACE = '' # listen on all of server's network interfaces
61THINKGEAR_SERVER_HOST = '127.0.0.1'
62THINKGEAR_SERVER_PORT = 13854
63
64
65#####################################################################
66# Remote Control configuration
67#####################################################################
68
69# Discrete control drives the robot for a set time period per detection.
70# Setting Variable control to "True" will drive the robot in a
71# particular direction for as long as the detection occurs
72BRAINSTORMS_VARIABLE_CONTROL_DURATION = True
73
74DEFAULT_NXT_POWER_LEVEL = 80
75
76DEFAULT_NXT_BLUETOOTH_DEVICE_WINDOWS = 'COM1'
77DEFAULT_NXT_BLUETOOTH_DEVICE_LINUX = '/dev/rfcomm0'
78
79if (sys.platform == 'win32'):
80        NXT_BLUETOOTH_DEVICE = DEFAULT_NXT_BLUETOOTH_DEVICE_WINDOWS
81else:
82        NXT_BLUETOOTH_DEVICE = DEFAULT_NXT_BLUETOOTH_DEVICE_LINUX
83
84NXT_MOTORS_MOUNTED_BACKWARDS = True
85NXT_MOTOR_PORT_LEFT = 'b'
86NXT_MOTOR_PORT_RIGHT = 'a'
87NXT_DEFAULT_RC_COMMAND = 'test_drive'
88
89
90#####################################################################
91# Server configuration
92#####################################################################
93
94BRAINSTORMS_DELIMITER = '\r'
95
96#TWISTED_SERVER_MAX_COMPONENTS = 16
97
98
99#####################################################################
100# Client configuration
101#####################################################################
102
103CLIENT_NO_REPLY_WAIT = 5 # how many seconds before considering a component dead
104
105#TWISTED_CLIENT_MAX_CONNECTION_ATTEMPTS = 5
106
107
108#####################################################################
109# ThinkGear Connect configuration
110#####################################################################
111
112THINKGEAR_DELIMITER = '\r'
113
114THINKGEAR_CONFIGURATION_PARAMETERS = {"enableRawOutput": False, "format": "Json"}
115
116THINKGEAR_AUTHORIZATION_ENABLED = False
117
118THINKGEAR_AUTHORIZATION_REQUEST = { \
119        "appName": "Puzzlebox Brainstorms", \
120        "appKey": "2e285d7bd5565c0ea73e7e265c73f0691d932408"
121}
122
123
124#####################################################################
125# ThinkGear Connect Server Emulator configuration
126#####################################################################
127
128THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA = True
129
130THINKGEAR_BLINK_FREQUENCY_TIMER = 6 # blink every 6 seconds
131                                    # (6 seconds is listed by Wikipedia
132                                    # as being the average number of times
133                                    # an adult blinks in a laboratory setting)
134
135THINKGEAR_DEFAULT_SAMPLE_WAVELENGTH = 30 # number of seconds from 0 to max
136                                         # and back to 0 for any given
137                                         # detection value below
138
139
140#####################################################################
141# Client Interface configuration [Qt]
142#####################################################################
143
144THINKGEAR_POWER_THRESHOLDS = { \
145       
146        'concentration': { \
147                0: 0, \
148                10: 0, \
149                20: 0, \
150                30: 0, \
151                40: 60, \
152                50: 65, \
153                60: 70, \
154                70: 75, \
155                75: 80, \
156                80: 85, \
157                90: 90, \
158                100: 90, \
159                }, \
160       
161        'relaxation': { \
162                0: 0, \
163                10: 0, \
164                20: 0, \
165                30: 0, \
166                40: 0, \
167                50: 10, \
168                60: 10, \
169                70: 15, \
170                80: 15, \
171                90: 20, \
172                100: 20, \
173                }, \
174       
175} # THINKGEAR_POWER_THRESHOLDS
176
177
178#####################################################################
179# Flash socket policy handling
180#####################################################################
181
182FLASH_POLICY_FILE_REQUEST = \
183        '<policy-file-request/>%c' % 0 # NULL byte termination
184FLASH_SOCKET_POLICY_FILE = '''<?xml version="1.0"?>
185<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
186<cross-domain-policy>
187   <site-control permitted-cross-domain-policies="all" />
188   <allow-access-from domain="*" to-ports="%i" />
189</cross-domain-policy>%c''' % (THINKGEAR_SERVER_PORT, 0)
190
191
192#####################################################################
193# Configuration File Parser
194#####################################################################
195
196if os.path.exists(BRAINSTORMS_CONFIGURATION_FILE_PATH):
197       
198        file = open(BRAINSTORMS_CONFIGURATION_FILE_PATH, 'r')
199       
200        for line in file.readlines():
201                line = line.strip()
202                if len(line) == 0:
203                        continue
204                if line[0] == '#':
205                        continue
206                if line.find('=') == -1:
207                        continue
208                if (line == "NXT_BLUETOOTH_DEVICE = ''"):
209                        # use operating system default if device not set manually
210                        continue
211                try:
212                        exec line
213                except:
214                        if DEBUG:
215                                print "Error recognizing Puzzlebox Brainstorms configuration option:",
216                                print line
217
Note: See TracBrowser for help on using the repository browser.