Added PS3 Controller

New strategy in moveControl
This commit is contained in:
2021-04-19 13:08:15 +02:00
parent a33b4a2e4c
commit 89050ae2d3
8 changed files with 221 additions and 140 deletions
+23 -15
View File
@@ -1,15 +1,19 @@
//Pin config
#define M_DIR_11 27
#define M_DIR_12 12
#define M_PWM_1 13
#define M_ENCODE_1A 33
#define M_ENCODE_1B 32
// The front is where the boards are
#define M_DIR_21 23
#define M_DIR_22 14
#define M_PWM_2 22
#define M_ENCODE_2A 25
#define M_ENCODE_2B 26
//Pin config
//Left
#define M_DIR_11 27
#define M_DIR_12 12
#define M_PWM_1 13
#define M_ENCODE_1A 33
#define M_ENCODE_1B 32
//Right
#define M_DIR_21 23
#define M_DIR_22 14
#define M_PWM_2 22
#define M_ENCODE_2A 26
#define M_ENCODE_2B 25
//Motors
#define LEFT_MOTOR 1
@@ -22,12 +26,12 @@
#define BACKWARD 2
//MotorControl config
#define RUN_MOTOR_CONTROL_DELAY 20 // Normal 10
#define RUN_MOTOR_CONTROL_DELAY 10 // Normal 10
#define PWM_FREQ 16000
#define PWM_RES 8
#define PWM_CHANNEL_M1 0
#define PWM_CHANNEL_M2 1
#define SPEED_STEPS 2 // A total of 20 levels ( 100 / SPEED_STEPS ) * RUN_MOTOR_CONTROL_DELAY = 500ms
#define POWER_STEPS 2 // A total of 20 levels ( 100 / SPEED_STEPS ) * RUN_MOTOR_CONTROL_DELAY = 500ms
#define PWM_MIN 120
#define PWM_MAX 245 // Max 98% of 2^PWM_RES
@@ -36,7 +40,11 @@
#define ENC_FILTER 1023 // 1023 is max
#define ENC_STEPS 1024
#define WHEEL_DIAMETER 0.1263 //meter
#define BUF_SIZE 40
#define BUF_SIZE 10
//MoveControl config
#define RUN_MOVE_CONTROL_DELAY 600 // Normal 10 untested
#define RUN_MOVE_CONTROL_DELAY 150 // Normal 10 untested
#define ACCELERATE_STEPS 1
// PS3 Controller
// ESP32 MAC BL 24:62:AB:F2:4B:3A