source: remote_control/puzzlebox_brainstorms_configuration.py @ 42

Last change on this file since 42 was 42, checked in by sc, 11 years ago
  • initial support for discrete control commands
File size: 4.4 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# Last Update: 2010.05.03
12#
13#####################################################################
14
15import os
16import pygame
17
18#####################################################################
19# General configuration
20#####################################################################
21
22DEBUG = 1
23
24DISCRETE_CONTROL_COMMANDS = False
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
54#SERVER_HOST = '192.168.1.150'
55SERVER_HOST = '127.0.0.1' # localhost
56SERVER_PORT = 8194
57
58
59#####################################################################
60# Remote Control configuration
61#####################################################################
62
63BLUETOOTH_DEVICE = '/dev/rfcomm0'
64MOTORS_MOUNTED_BACKWARDS = True
65MOTOR_PORT_RIGHT = 'a'
66MOTOR_PORT_LEFT = 'b'
67DEFAULT_RC_COMMAND = 'test_drive'
68
69
70#####################################################################
71# Server configuration
72#####################################################################
73
74MAX_COMPONENTS = 16
75
76
77#####################################################################
78# Client configuration
79#####################################################################
80
81MAX_CONNECTION_ATTEMPTS = 5
82HEALTH_CHECK_CONNECTION_ATTEMPTS = 5
83NO_REPLY_WAIT = 10 # how many seconds before considering a component dead
84
85
86#####################################################################
87# Client Interface configuration
88#####################################################################
89
90DISPLAY_WINDOW_X_COORDINATE = 0
91DISPLAY_WINDOW_Y_COORDINATE = 0
92DISPLAY_WINDOW_X_DIMENSION = 254
93DISPLAY_WINDOW_Y_DIMENSION = 424
94
95#WINDOW_BACKGROUND_COLOR = (255,255,255) # white background
96#WINDOW_BACKGROUND_COLOR = (128,128,128) # grey background
97#WINDOW_BACKGROUND_COLOR = (64,64,64)    # dark grek background
98WINDOW_BACKGROUND_COLOR = (0,0,0)       # black background
99
100IMAGE_DIRECTORY = os.path.join(os.getcwd(), 'images')
101
102# Keyboard key reference at http://www.pygame.org/docs/ref/key.html#pygame.key
103BUTTON_LAYOUT = { \
104       
105        'left': { \
106                'command': 'turn_left', \
107                'active': False, \
108                'button_image': '1-upper_left-white.png', \
109                'activated_image': '1-upper_left-orange.png', \
110                'image_x': 0, \
111                'image_y': 0, \
112                'match_keys': [pygame.K_LEFT, pygame.K_a, pygame.K_q]
113                }, \
114       
115        'forward': { \
116                'command': 'drive_forward', \
117                'active': False, \
118                'button_image': '2-up-white.png', \
119                'activated_image': '2-up-orange.png', \
120                'image_x': 98, \
121                'image_y': 0, \
122                'match_keys': [pygame.K_UP, pygame.K_w]
123                }, \
124       
125        'right': { \
126                'command': 'turn_right', \
127                'active': False, \
128                'button_image': '3-upper_right-white.png', \
129                'activated_image': '3-upper_right-orange.png', \
130                'image_x': 157, \
131                'image_y': 0, \
132                'match_keys': [pygame.K_RIGHT, pygame.K_d, pygame.K_e]
133                }, \
134       
135        'reverse_left': { \
136                'command': 'turn_left_in_reverse', \
137                'active': False, \
138                'button_image': '7-lower_left-white.png', \
139                'activated_image': '7-lower_left-orange.png', \
140                'image_x': 0, \
141                'image_y': 220, \
142                'match_keys': [pygame.K_z]
143                }, \
144       
145        'reverse': { \
146                'command': 'drive_reverse', \
147                'active': False, \
148                'button_image': '8-down-white.png', \
149                'activated_image': '8-down-orange.png', \
150                'image_x': 98, \
151                'image_y': 220, \
152                'match_keys': [pygame.K_DOWN, pygame.K_s, pygame.K_x]
153                }, \
154       
155        'reverse_right': { \
156                'command': 'turn_right_in_reverse', \
157                'active': False, \
158                'button_image': '9-lower_right-white.png', \
159                'activated_image': '9-lower_right-orange.png', \
160                'image_x': 157, \
161                'image_y': 220, \
162                'match_keys': [pygame.K_PAGEDOWN, pygame.K_c]
163                }, \
164       
165} # BUTTON_LAYOUT
166
Note: See TracBrowser for help on using the repository browser.