Config optimizations (Test-drive)
Successfull test drive with new driver - set max duty from 90 to 100 - config adjust fading, calibrate joystick, disable deadtime - disable 1x button cmd - 8x sport mode: toggle accel not decel
This commit is contained in:
parent
27a94d7ab6
commit
3449bb7f34
@ -61,10 +61,11 @@ void buttonCommands::action (uint8_t count, bool lastPressLong){
|
||||
esp_restart();
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGW(TAG, "cmd %d: sending button event to control task", count);
|
||||
//-> define joystick center or toggle freeze input (executed in control task)
|
||||
control->sendButtonEvent(count); //TODO: always send button event to control task (not just at count=1) -> control.cpp has to be changed
|
||||
//note: disabled joystick calibration due to accidential trigger
|
||||
//
|
||||
// ESP_LOGW(TAG, "cmd %d: sending button event to control task", count);
|
||||
// //-> define joystick center or toggle freeze input (executed in control task)
|
||||
// control->sendButtonEvent(count); //TODO: always send button event to control task (not just at count=1) -> control.cpp has to be changed
|
||||
break;
|
||||
case 2:
|
||||
//run automatic commands to lift leg support when pressed 1x short 1x long
|
||||
@ -135,8 +136,10 @@ void buttonCommands::action (uint8_t count, bool lastPressLong){
|
||||
|
||||
case 8:
|
||||
//toggle deceleration fading between on and off
|
||||
decelEnabled = motorLeft->toggleFade(fadeType_t::DECEL);
|
||||
motorRight->toggleFade(fadeType_t::DECEL);
|
||||
//decelEnabled = motorLeft->toggleFade(fadeType_t::DECEL);
|
||||
//motorRight->toggleFade(fadeType_t::DECEL);
|
||||
decelEnabled = motorLeft->toggleFade(fadeType_t::ACCEL);
|
||||
motorRight->toggleFade(fadeType_t::ACCEL);
|
||||
ESP_LOGW(TAG, "cmd %d: toggle deceleration fading to: %d", count, (int)decelEnabled);
|
||||
if (decelEnabled){
|
||||
buzzer->beep(3, 60, 50);
|
||||
|
@ -42,23 +42,23 @@ sabertooth2x60_config_t sabertoothConfig = {
|
||||
//--- configure left motor (contol) ---
|
||||
motorctl_config_t configMotorControlLeft = {
|
||||
.msFadeAccel = 1800, //acceleration of the motor (ms it takes from 0% to 100%)
|
||||
.msFadeDecel = 2500, //deceleration of the motor (ms it takes from 100% to 0%)
|
||||
.msFadeDecel = 1900, //deceleration of the motor (ms it takes from 100% to 0%)
|
||||
.currentLimitEnabled = false,
|
||||
.currentSensor_adc = ADC1_CHANNEL_4, //GPIO32
|
||||
.currentSensor_ratedCurrent = 50,
|
||||
.currentMax = 30,
|
||||
.deadTimeMs = 300 //minimum time motor is off between direction change
|
||||
.deadTimeMs = 0 //minimum time motor is off between direction change
|
||||
};
|
||||
|
||||
//--- configure right motor (contol) ---
|
||||
motorctl_config_t configMotorControlRight = {
|
||||
.msFadeAccel = 1900, //acceleration of the motor (ms it takes from 0% to 100%)
|
||||
.msFadeDecel = 1000, //deceleration of the motor (ms it takes from 100% to 0%)
|
||||
.currentLimitEnabled = true,
|
||||
.msFadeAccel = 1800, //acceleration of the motor (ms it takes from 0% to 100%)
|
||||
.msFadeDecel = 1900, //deceleration of the motor (ms it takes from 100% to 0%)
|
||||
.currentLimitEnabled = false,
|
||||
.currentSensor_adc = ADC1_CHANNEL_5, //GPIO33
|
||||
.currentSensor_ratedCurrent = 50,
|
||||
.currentMax = 30,
|
||||
.deadTimeMs = 300 //minimum time motor is off between direction change
|
||||
.deadTimeMs = 0 //minimum time motor is off between direction change
|
||||
};
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ motorctl_config_t configMotorControlRight = {
|
||||
control_config_t configControl = {
|
||||
.defaultMode = controlMode_t::JOYSTICK, //default mode after startup and toggling IDLE
|
||||
//--- timeout ---
|
||||
.timeoutMs = 5*60*1000, //time of inactivity after which the mode gets switched to IDLE
|
||||
.timeoutMs = 3*60*1000, //time of inactivity after which the mode gets switched to IDLE
|
||||
.timeoutTolerancePer = 5, //percentage the duty can vary between timeout checks considered still inactive
|
||||
//--- http mode ---
|
||||
|
||||
@ -104,10 +104,10 @@ joystick_config_t configJoystick = {
|
||||
.tolerance_radius = 0.09,
|
||||
|
||||
//min and max adc values of each axis, !!!AFTER INVERSION!!! is applied:
|
||||
.x_min = 1392, //=> x=-1
|
||||
.x_max = 2650, //=> x=1
|
||||
.y_min = 1390, //=> y=-1
|
||||
.y_max = 2640, //=> y=1
|
||||
.x_min = 1710, //=> x=-1
|
||||
.x_max = 2980, //=> x=1
|
||||
.y_min = 1700, //=> y=-1
|
||||
.y_max = 2970, //=> y=1
|
||||
//invert adc measurement
|
||||
.x_inverted = true,
|
||||
.y_inverted = true
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
//in IDLE mode: set loglevel for evaluatedJoystick to DEBUG
|
||||
//and repeatedly read joystick e.g. for manually calibrating / testing joystick
|
||||
//#define JOYSTICK_LOG_IN_IDLE
|
||||
#define JOYSTICK_LOG_IN_IDLE
|
||||
|
||||
|
||||
//TODO outsource global variables to e.g. global.cpp and only config options here?
|
||||
|
@ -139,9 +139,9 @@ void setLoglevels(void){
|
||||
//--- set loglevel for individual tags ---
|
||||
esp_log_level_set("main", ESP_LOG_INFO);
|
||||
esp_log_level_set("buzzer", ESP_LOG_ERROR);
|
||||
esp_log_level_set("motordriver", ESP_LOG_INFO);
|
||||
esp_log_level_set("motor-control", ESP_LOG_INFO);
|
||||
//esp_log_level_set("evaluatedJoystick", ESP_LOG_DEBUG);
|
||||
//esp_log_level_set("motordriver", ESP_LOG_ERROR);
|
||||
//esp_log_level_set("motor-control", ESP_LOG_INFO);
|
||||
esp_log_level_set("evaluatedJoystick", ESP_LOG_DEBUG);
|
||||
//esp_log_level_set("joystickCommands", ESP_LOG_DEBUG);
|
||||
esp_log_level_set("button", ESP_LOG_INFO);
|
||||
esp_log_level_set("control", ESP_LOG_INFO);
|
||||
|
@ -310,7 +310,7 @@ motorCommands_t joystick_generateCommandsDriving(joystickData_t data, bool altSt
|
||||
|
||||
//--- variables ---
|
||||
motorCommands_t commands;
|
||||
float dutyMax = 90; //TODO add this to config, make changeable during runtime
|
||||
float dutyMax = 100; //TODO add this to config, make changeable during runtime
|
||||
|
||||
float dutyOffset = 5; //immediately starts with this duty, TODO add this to config
|
||||
float dutyRange = dutyMax - dutyOffset;
|
||||
|
Loading…
x
Reference in New Issue
Block a user