source: rc/puzzlebox_brainstorms_configuration.py @ 27

Last change on this file since 27 was 27, checked in by sc, 12 years ago

configuration:

  • BUTTON_LAYOUT converted for key up/down event notification

client_interface_button:

  • match_keys indexing added

client_interface:

  • converted to key up/down event notification
File size: 4.4 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#
4# Puzzlebox - Brainstorms - Configuration
5#
6# Copyright Steven M. Castellotti (2010)
7#
8# Portions of this code have been previously
9# released under the GNU Pulic License (GPL) version 2
10# and is Copyright Steven M. Castellotti (2010)
11# For more information please refer to http://www.gnu.org/copyleft/gpl.htm
12#
13# Last Update: 2010.02.03
14#
15#####################################################################
16
17import os
18import pygame
19
20#####################################################################
21# General configuration
22#####################################################################
23
24DEBUG = 1
25
26#####################################################################
27# Logging
28#####################################################################
29
30LOG_LEVEL_DEBUG = 2
31LOG_LEVEL_INFO = 1
32LOG_LEVEL_ERROR = 0
33LOG_LEVEL_DISABLE = -1
34
35DEFAULT_LOG_LEVEL = LOG_LEVEL_DEBUG
36DEFAULT_LOGFILE = 'puzzlebox'
37
38LOGFILE_DIR = '/var/log/puzzlebox'
39LOGFILE_SUFFIX = '.log'
40LOGFILE_SUFFIX_DEBUG = '_debug.log'
41LOGFILE_SUFFIX_INFO = '_info.log'
42LOGFILE_SUFFIX_ERROR = '_error.log'
43
44SPLIT_LOGFILES = False
45
46#BRAINSTORMS_LOGFILE = 'brainstorms'
47
48
49#####################################################################
50# Network addresses
51#####################################################################
52
53SERVER_INTERFACE = '' # listen on all of server's network interfaces
54SERVER_HOST = '192.168.1.150'
55SERVER_PORT = 8194
56
57
58#####################################################################
59# Remote Control configuration
60#####################################################################
61
62BLUETOOTH_DEVICE = '/dev/rfcomm0'
63MOTORS_MOUNTED_BACKWARDS = True
64MOTOR_PORT_RIGHT = 'a'
65MOTOR_PORT_LEFT = 'b'
66DEFAULT_RC_COMMAND = 'test_drive'
67
68
69#####################################################################
70# Server configuration
71#####################################################################
72
73MAX_COMPONENTS = 16
74
75
76#####################################################################
77# Client configuration
78#####################################################################
79
80MAX_CONNECTION_ATTEMPTS = 5
81HEALTH_CHECK_CONNECTION_ATTEMPTS = 5
82NO_REPLY_WAIT = 10 # how many seconds before considering a component dead
83
84
85#####################################################################
86# Client Interface configuration
87#####################################################################
88
89DISPLAY_WINDOW_X_COORDINATE = 0
90DISPLAY_WINDOW_Y_COORDINATE = 0
91DISPLAY_WINDOW_X_DIMENSION = 254
92DISPLAY_WINDOW_Y_DIMENSION = 424
93
94#WINDOW_BACKGROUND_COLOR = (255,255,255) # white background
95#WINDOW_BACKGROUND_COLOR = (128,128,128) # grey background
96#WINDOW_BACKGROUND_COLOR = (64,64,64)    # dark grek background
97WINDOW_BACKGROUND_COLOR = (0,0,0)       # black background
98
99IMAGE_DIRECTORY = os.path.join(os.getcwd(), 'images')
100
101# Keyboard key reference at http://www.pygame.org/docs/ref/key.html#pygame.key
102BUTTON_LAYOUT = { \
103       
104        'left': { \
105                'command': 'turn_left', \
106                'active': False, \
107                'button_image': '1-upper_left-white.png', \
108                'activated_image': '1-upper_left-orange.png', \
109                'image_x': 0, \
110                'image_y': 0, \
111                'match_keys': [pygame.K_LEFT, pygame.K_a, pygame.K_q]
112                }, \
113       
114        'forward': { \
115                'command': 'drive_forward', \
116                'active': False, \
117                'button_image': '2-up-white.png', \
118                'activated_image': '2-up-orange.png', \
119                'image_x': 98, \
120                'image_y': 0, \
121                'match_keys': [pygame.K_UP, pygame.K_w]
122                }, \
123       
124        'right': { \
125                'command': 'turn_right', \
126                'active': False, \
127                'button_image': '3-upper_right-white.png', \
128                'activated_image': '3-upper_right-orange.png', \
129                'image_x': 157, \
130                'image_y': 0, \
131                'match_keys': [pygame.K_RIGHT, pygame.K_d, pygame.K_e]
132                }, \
133       
134        'reverse_left': { \
135                'command': 'turn_left_in_reverse', \
136                'active': False, \
137                'button_image': '7-lower_left-white.png', \
138                'activated_image': '7-lower_left-orange.png', \
139                'image_x': 0, \
140                'image_y': 220, \
141                'match_keys': [pygame.K_z]
142                }, \
143       
144        'reverse': { \
145                'command': 'drive_reverse', \
146                'active': False, \
147                'button_image': '8-down-white.png', \
148                'activated_image': '8-down-orange.png', \
149                'image_x': 98, \
150                'image_y': 220, \
151                'match_keys': [pygame.K_DOWN, pygame.K_s, pygame.K_x]
152                }, \
153       
154        'reverse_right': { \
155                'command': 'turn_right_in_reverse', \
156                'active': False, \
157                'button_image': '9-lower_right-white.png', \
158                'activated_image': '9-lower_right-orange.png', \
159                'image_x': 157, \
160                'image_y': 220, \
161                'match_keys': [pygame.K_PAGEDOWN, pygame.K_c]
162                }, \
163       
164} # BUTTON_LAYOUT
165
Note: See TracBrowser for help on using the repository browser.