This repository was archived by the owner on Apr 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.py
More file actions
88 lines (70 loc) · 3.63 KB
/
config.py
File metadata and controls
88 lines (70 loc) · 3.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Version 2.0.2
########## Configuration for the motors.
'''This defines the parameters for the motors.
MAX_DUTY: Set to lower than the maximum not to overload the motors. Absolute maximum is 65535.
MIN_DUTY: Set this to the minimum duty cycle that the motor needs to start moving.
MIN_SPEED: Only 0 is making sense here but if you want you can change that. Must be above 0 though. You set set this to a higher appropriate value.
MAX_SPEED: If you want another scale than 0-100, set the maximum here.
BATTERY_MIN: Minimal value that still powers the robot.
BATTERY_MAX: Maximum value for the used battery.
DEBOUNCE_WAIT: This defines the waiting time for the debouncing of the buttons. Leave as it is if
you don't know what it means.
WHITE_DETECTED: Use these constants to check for white or black with the IR-sensor. Don't change!
BLACK_DETECTED: Use these constants to check for white or black with the IR-sensor. Don't change!
Motors and ultrasonic sensor must use consecutive pins. so, f. ex. the left motor uses pins 12 and 13. Use >None< if you don't use the device.
MLF and LRF are for four wheel drive.
ML: pin number for left motor (or left rear motor for four wheel drive).
MR: pin number for right motor (or right rear motor for four wheel drive).
MLF: pin number for left motor (or left front motor for four wheel drive). Use None if not used.
MRF: pin number for right motor (or right front motor for four wheel drive). Use None if not used.
US: pin number for the ultrasonic sensor. Use None if not used.
IR: pin number for the infrared sensor. Use None if not used.
SERVO: pin number for the servo motor. Use None if not used.
JS_X_MEDIAN: These define the parameters for the joystick. You need to calibrate the numbers. Look at joystick.py for details.
JS_Y_MEDIAN: These define the parameters for the joystick. You need to calibrate the numbers. Look at joystick.py for details.
JS_MAX_DUTY
JS_MIN_DUTY
X_PIN = 26 Pin for the x direction in the joystick.
Y_PIN = 27 Pin for the y direction in the joystick.
B_PIN = 0 Pin for the button in the joystick.
ROBOT_NAME: You need to set a custom name if you use a remote control.
SERVO_MIN_DUTY: Only change if the servo doesn't move the required 180°.
SERVO_MAX_DUTY: Only change if the servo doesn't move the required 180°.
'''
MAX_DUTY = 60000 # Maximum duty for the motors. Absolute maximum is 65535.
MIN_DUTY = 0 # Minimum duty for the motors. Absolute minimum is 0.
MIN_SPEED = 0 # <-- Set this
MAX_SPEED = 100
BATTERY_MIN = 30000
BATTERY_MAX = 59453 #Wert für Akku: ?
########## Waiting time in milliseconds for any debouncing of buttons.
DEBOUNCE_WAIT = 30
########## Configuration for the detecting black or white with the IR-sensor.
WHITE_DETECTED = 0
BLACK_DETECTED = 1
########## Configuration of pins
ML=12
MR=14
MLF=None #10
MRF=None #20
US=None #16
IR=None #11
SERVO=None #9
BATTERY=None #28
########## Configuration for the Joystick remote control
JS_X_MEDIAN = 33306
JS_Y_MEDIAN = 32796
JS_MAX_DUTY = 65535
JS_MIN_DUTY = 260
X_PIN = 26
Y_PIN = 27
B_PIN = 0
JS_REVERSED = -1 # -1 for false, 1 for true.
########## Configuration of the name of the robot for matching with the remote control.
ROBOT_NAME = "HAL9000"
########## Configuration for the Servo in the robot
# If you mix different servo types with different duty cycles, you can use the type2 constant for this.
SERVO_MIN_DUTY = 1350 # Change only if the servo doesn't move 180°.
SERVO_MAX_DUTY = 8100 # Change only if the servo doesn't move 180°.
#SERVO_MIN_DUTY_TYPE2 = 1800 # In case you use different types of servos with different duty_cycles.
#SERVO_MAX_DUTY_TYPE2 = 7600 # In case you use different types of servos with different duty_cycles.