moving files

This commit is contained in:
2021-12-13 18:25:47 +01:00
parent a7940c887b
commit 3aa3789e36
18 changed files with 22 additions and 41 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
#include <PID_v1.h>
#include "motorControl.h"
#include "speedometer"
#include "speedometer.h"
#include "config.h"
#include "debugMqtt.h"
#include "debugTimes.h"
+2 -2
View File
@@ -6,8 +6,8 @@
#include <TinyGPS++.h>
#include <Arduino.h>
#include "hardware/motorControl.h"
#include "hardware/speedometer.h"
#include "motorControl.h"
#include "speedometer.h"
#include "debugMqtt.h"
#include "config.h"
@@ -94,14 +94,14 @@ void MotorControl::runMotorControl() {
void MotorControl::setMinPwm(uint8_t min) {
if (min > 80) min = 80;
//transform percentage to real pwm value
min = (uint8_t) ((1 >> pwm_res - 1) * (min / 100));
min = (uint8_t) (((1 >> pwm_res) - 1) * (min / 100));
this->dutycycle_min = min;
}
void MotorControl::setMaxPwm(uint8_t max) {
if (max > 100) max = 100;
//transform percentage to real pwm value
max = (uint8_t) ((1 >> pwm_res - 1) * (max / 100));
max = (uint8_t) (((1 >> pwm_res) - 1) * (max / 100));
this->dutycycle_max = max;
}
@@ -25,7 +25,7 @@
* @brief Default value for min Millisseconds between each loop
* @see setDelay(uint8_t val)
*/
#define DELAY 30
#define DELAY_SPEEDOMETER 30
#define PI 3.1415926535897932384626433832795
/**
@@ -57,7 +57,7 @@ class Speedometer {
* This function should be called every mainloop. If the delay is not reached, than the
* functions returns immediately.
* @see runSpeedometer()
* @see DELAY
* @see DELAY_SPEEDOMETER
*/
void loop();
@@ -112,7 +112,7 @@ class Speedometer {
uint8_t bufSize = BUFSIZE;
uint16_t steps;
uint8_t delay = DELAY;
uint8_t delay = DELAY_SPEEDOMETER;
int16_t *buf;
};
-1
View File
@@ -1,5 +1,4 @@
#include "consolControl.h"
#include <string>
ConsolControl::ConsolControl() {
this->debug = new DebugMqtt("ConsolControl");
+2
View File
@@ -1,6 +1,8 @@
#ifndef CONSOL_CONTROL_H
#define CONSOL_CONTROL_H
#include <string>
#include "moveControl.h"
#include "debugMqtt.h"
-4
View File
@@ -15,8 +15,6 @@ void ManualControl::init(MoveControl *moveControl, MotorControl *motorControlLef
}
void ManualControl::runManualControl() {
DebugTimes runManualDebuginFunction;
//Cancel if delay is not reached
if (millis() - this->last_millis < RUN_MANUALCONTROL_DELAY) {
return;
@@ -29,8 +27,6 @@ void ManualControl::runManualControl() {
}
this->last_millis = millis();
runManualDebuginFunction.stop("Ober teil von runManualControl", 100);
//Change controlMode
if (this->controlMode == ControMode::halt && Ps3.data.button.l3) {
this->reset();
+1 -1
View File
@@ -4,7 +4,7 @@
#include <Ps3Controller.h>
#include "moveControl.h"
#include "hardware/motorControl.h"
#include "motorControl.h"
#include "debugMqtt.h"
#include "debugTimes.h"
+8 -24
View File
@@ -6,8 +6,8 @@
#include "config.h"
#include "hardware/motorControl.h"
#include "hardware/speedometer.h"
#include "motorControl.h"
#include "speedometer.h"
#include "driveModi/autopilot.h"
#include "driveModi/captureRoute.h"
#include "driveModi/manualControl.h"
@@ -82,7 +82,6 @@ void setup() {
configTime(3600, 3600, "2.de.pool.ntp.org");
DebugMqtt::init(&mqtt_client, Loglevel::debug);
DebugMqtt::initRealMillis();
Ps3.attach(callbackControllerAction);
Ps3.attachOnConnect(callbackControllerConnect);
@@ -91,11 +90,11 @@ void setup() {
Ps3.begin();
// Init hardware
left_motor.init(M_PWM_1, PWM_CHANNEL_M1, M_DIR_11, M_DIR_12, "left");
right_motor.init(M_PWM_2, PWM_CHANNEL_M2, M_DIR_21, M_DIR_22, "right");
left_motor.init(M_PWM_1, PWM_CHANNEL_M1, M_DIR_11, M_DIR_12);
right_motor.init(M_PWM_2, PWM_CHANNEL_M2, M_DIR_21, M_DIR_22);
speedometer_left.init(M_ENCODE_1A, M_ENCODE_1B, "left");
speedometer_right.init(M_ENCODE_2A, M_ENCODE_2B, "right");
speedometer_left.init(M_ENCODE_1A, M_ENCODE_1B, WHEEL_DIAMETER, ENC_STEPS);
speedometer_right.init(M_ENCODE_2A, M_ENCODE_2B, WHEEL_DIAMETER, ENC_STEPS);
moveController.init(&left_motor, &right_motor, &speedometer_left, &speedometer_right);
@@ -104,11 +103,6 @@ void setup() {
captureRoute.init(&route, &moveController, &left_motor, &right_motor);
autopilot.init(&route, &moveController);
consolControl.init(&moveController);
//Test checkTimes function
DebugTimes testDebugTimes;
delay(2);
testDebugTimes.stop("Test checkTimes");
}
void loop() {
@@ -125,18 +119,11 @@ void loop() {
}
} else {
// Client connected
DebugTimes mqttClientLoop;
mqtt_client.loop();
mqttClientLoop.stop("mqttloop", 100);
}
DebugTimes runMotorLeft;
left_motor.runMotorControl();
runMotorLeft.stop("left_motor", 100);
DebugTimes runMotorRight;
right_motor.runMotorControl();
runMotorRight.stop("right_motor", 100);
speedometer_left.runSpeedometer();
speedometer_right.runSpeedometer();
@@ -144,11 +131,8 @@ void loop() {
// route.runRoute();
switch (driveMode) {
case manualControl_e: {
DebugTimes manControlDebug;
case manualControl_e:
manualControl.runManualControl();
manControlDebug.stop("manualControl run", 100);
}
break;
case captureRoute_e:
+3 -3
View File
@@ -47,11 +47,11 @@ void MoveControl::runMoveControl() {
DebugTimes pidTimes;
this->right_pid->Compute();
this->left_pid->Compute();
pidTimes.stop("PID Calulate", 100);
pidTimes.stopConsol("PID Calulate", 100);
DebugTimes regMotorTime;
this->regulateMotors();
regMotorTime.stop("regulateMotors", 100);
regMotorTime.stopConsol("regulateMotors", 100);
static uint32_t functioncalls = 0;
functioncalls++;
@@ -62,7 +62,7 @@ void MoveControl::runMoveControl() {
this->wheelspeed_right);
DebugTimes debugMsgTime;
debug->sendMsg(Loglevel::debug, str);
debugMsgTime.stop("debug Msg", 100);
debugMsgTime.stopConsol("debug Msg", 100);
}
}