update comments 1
This commit is contained in:
Vendored
+2
@@ -128,6 +128,7 @@
|
|||||||
"carr",
|
"carr",
|
||||||
"CIPO",
|
"CIPO",
|
||||||
"COPI",
|
"COPI",
|
||||||
|
"Dutycycle",
|
||||||
"gast",
|
"gast",
|
||||||
"GNSS",
|
"GNSS",
|
||||||
"GPGGA",
|
"GPGGA",
|
||||||
@@ -148,6 +149,7 @@
|
|||||||
"Soln",
|
"Soln",
|
||||||
"TPMOBIL",
|
"TPMOBIL",
|
||||||
"UBLOX",
|
"UBLOX",
|
||||||
|
"wheelspeed",
|
||||||
"ZLPJ"
|
"ZLPJ"
|
||||||
],
|
],
|
||||||
"cmake.configureOnOpen": false
|
"cmake.configureOnOpen": false
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ Do later:
|
|||||||
Do now:
|
Do now:
|
||||||
Code:
|
Code:
|
||||||
Doxygen Kommentare aktualisieren
|
Doxygen Kommentare aktualisieren
|
||||||
magic numbers etc
|
|
||||||
Fernbedienung!
|
Fernbedienung!
|
||||||
|
|
||||||
Latex:
|
Latex:
|
||||||
|
|||||||
+25
-10
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file config.h
|
* @file config.h
|
||||||
* @author Alexander Klein (alex@kleiax.de)
|
* @author Alexander Klein (alex@kleiax.de)
|
||||||
* @brief Some defines to configere the project.
|
* @brief Some defines to configure the project.
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2022-02-15
|
* @date 2022-02-15
|
||||||
*
|
*
|
||||||
@@ -11,7 +11,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace PinNumbers {
|
/**
|
||||||
|
* @brief The numbers of pins to be used
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
namespace PinNumbers
|
||||||
|
{
|
||||||
constexpr uint8_t spiCopi = 16;
|
constexpr uint8_t spiCopi = 16;
|
||||||
constexpr uint8_t spiCipo = 4;
|
constexpr uint8_t spiCipo = 4;
|
||||||
constexpr uint8_t spiSck = 5;
|
constexpr uint8_t spiSck = 5;
|
||||||
@@ -20,24 +25,31 @@ namespace PinNumbers {
|
|||||||
constexpr uint8_t scl = 19;
|
constexpr uint8_t scl = 19;
|
||||||
constexpr uint8_t battery = 35;
|
constexpr uint8_t battery = 35;
|
||||||
|
|
||||||
namespace LeftMotor {
|
namespace LeftMotor
|
||||||
|
{
|
||||||
constexpr uint8_t dir1 = 27;
|
constexpr uint8_t dir1 = 27;
|
||||||
constexpr uint8_t dir2 = 12;
|
constexpr uint8_t dir2 = 12;
|
||||||
constexpr uint8_t pwm = 13;
|
constexpr uint8_t pwm = 13;
|
||||||
constexpr uint8_t encoder = 32;
|
constexpr uint8_t encoder = 32;
|
||||||
constexpr uint8_t pmwChannel = 0;
|
constexpr uint8_t pmwChannel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace RightMotor {
|
namespace RightMotor
|
||||||
|
{
|
||||||
constexpr uint8_t dir1 = 14;
|
constexpr uint8_t dir1 = 14;
|
||||||
constexpr uint8_t dir2 = 23;
|
constexpr uint8_t dir2 = 23;
|
||||||
constexpr uint8_t pwm = 22;
|
constexpr uint8_t pwm = 22;
|
||||||
constexpr uint8_t encoder = 33;
|
constexpr uint8_t encoder = 33;
|
||||||
constexpr uint8_t pmwChannel = 1;
|
constexpr uint8_t pmwChannel = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Settings {
|
/**
|
||||||
|
* @brief Default values for different components
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
namespace Settings
|
||||||
|
{
|
||||||
constexpr uint32_t baudRate = 115200;
|
constexpr uint32_t baudRate = 115200;
|
||||||
constexpr uint32_t i2cSpeed = 400000;
|
constexpr uint32_t i2cSpeed = 400000;
|
||||||
|
|
||||||
@@ -45,14 +57,17 @@ namespace Settings {
|
|||||||
constexpr float wheelDistance = 0.255;
|
constexpr float wheelDistance = 0.255;
|
||||||
constexpr uint16_t encoderSteps = 384;
|
constexpr uint16_t encoderSteps = 384;
|
||||||
|
|
||||||
namespace Pid {
|
namespace Pid
|
||||||
namespace Left {
|
{
|
||||||
|
namespace Left
|
||||||
|
{
|
||||||
constexpr uint8_t P = 5;
|
constexpr uint8_t P = 5;
|
||||||
constexpr uint8_t I = 0;
|
constexpr uint8_t I = 0;
|
||||||
constexpr uint8_t D = 0;
|
constexpr uint8_t D = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Right {
|
namespace Right
|
||||||
|
{
|
||||||
constexpr uint8_t P = 5;
|
constexpr uint8_t P = 5;
|
||||||
constexpr uint8_t I = 0;
|
constexpr uint8_t I = 0;
|
||||||
constexpr uint8_t D = 0;
|
constexpr uint8_t D = 0;
|
||||||
|
|||||||
+50
-38
@@ -22,6 +22,11 @@
|
|||||||
#include "debugTimes.h"
|
#include "debugTimes.h"
|
||||||
#include "component.h"
|
#include "component.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A struct to easy set the speed
|
||||||
|
*
|
||||||
|
*/
|
||||||
struct DrivingSpeeds {
|
struct DrivingSpeeds {
|
||||||
double x;
|
double x;
|
||||||
double rot;
|
double rot;
|
||||||
@@ -41,6 +46,11 @@ class MoveControl : public Component {
|
|||||||
* @brief used to set driving status
|
* @brief used to set driving status
|
||||||
*
|
*
|
||||||
* When set to stop all motors are set to halt
|
* When set to stop all motors are set to halt
|
||||||
|
* When set to Raw the PIDs are not used. The target
|
||||||
|
* values must be given withe @see setRawPowerLeft and
|
||||||
|
* @see setRawPowerRight.
|
||||||
|
*
|
||||||
|
* Drive is the normal working mode.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum Status {Stop,
|
enum Status {Stop,
|
||||||
@@ -52,7 +62,7 @@ class MoveControl : public Component {
|
|||||||
* @brief Construct a new Move Control object
|
* @brief Construct a new Move Control object
|
||||||
*
|
*
|
||||||
* Initialize the motors, encoders and PIDs with given
|
* Initialize the motors, encoders and PIDs with given
|
||||||
* values in moveControlConfig.h
|
* values in config.h
|
||||||
*/
|
*/
|
||||||
MoveControl();
|
MoveControl();
|
||||||
|
|
||||||
@@ -66,6 +76,9 @@ class MoveControl : public Component {
|
|||||||
/**
|
/**
|
||||||
* @brief Set the Status
|
* @brief Set the Status
|
||||||
*
|
*
|
||||||
|
* Control if this component should work normally or with
|
||||||
|
* raw values for the motors.
|
||||||
|
*
|
||||||
* @see Status
|
* @see Status
|
||||||
* @param status
|
* @param status
|
||||||
*/
|
*/
|
||||||
@@ -87,29 +100,39 @@ class MoveControl : public Component {
|
|||||||
void setSpeed(double speed);
|
void setSpeed(double speed);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the rotationspeed
|
* @brief Set the rotationSpeed
|
||||||
*
|
*
|
||||||
* If the given rotationspeed is close to zero, then the
|
* If the given rotationSpeed is close to zero, then the
|
||||||
* target rotationspeed is set to zero.
|
* target rotationSpeed is set to zero.
|
||||||
* @param speed rad/s
|
* @param speed rad/s
|
||||||
*/
|
*/
|
||||||
void setRotationSpeed(double speed);
|
void setRotationSpeed(double speed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the speeds
|
||||||
|
*
|
||||||
|
* This function is a combination of @see setSpeed and
|
||||||
|
* @see setRotationSpeed. The struct @see DrivingSpeeds
|
||||||
|
* is used for this.
|
||||||
|
*
|
||||||
|
* @param drivingSpeeds
|
||||||
|
*/
|
||||||
void setSpeeds(DrivingSpeeds drivingSpeeds);
|
void setSpeeds(DrivingSpeeds drivingSpeeds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set Raw Power Left
|
* @brief Set raw power left
|
||||||
*
|
*
|
||||||
* This value has only an effect if Status is raw.
|
* This value has only an effect if the status is raw.
|
||||||
|
* @see setDrivingStatus
|
||||||
*
|
*
|
||||||
* @param power between -100 and 100
|
* @param power between -100 and 100
|
||||||
*/
|
*/
|
||||||
void setRawPowerLeft(int16_t power);
|
void setRawPowerLeft(int16_t power);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the Raw Power Right
|
* @brief Set the raw power right
|
||||||
*
|
*
|
||||||
* This value has only an effect if Status is raw.
|
* This value has only an effect if status is raw.
|
||||||
*
|
*
|
||||||
* @param power between -100 and 100
|
* @param power between -100 and 100
|
||||||
*/
|
*/
|
||||||
@@ -119,9 +142,9 @@ class MoveControl : public Component {
|
|||||||
* @brief Set the pid tunings
|
* @brief Set the pid tunings
|
||||||
*
|
*
|
||||||
* @param side 0 -> left, 1 -> right
|
* @param side 0 -> left, 1 -> right
|
||||||
* @param p
|
* @param pPart
|
||||||
* @param i
|
* @param iPart
|
||||||
* @param d
|
* @param dPart
|
||||||
*/
|
*/
|
||||||
void setPidTunings(uint8_t side, double pPart, double iPart, double dPart);
|
void setPidTunings(uint8_t side, double pPart, double iPart, double dPart);
|
||||||
|
|
||||||
@@ -133,22 +156,11 @@ class MoveControl : public Component {
|
|||||||
*/
|
*/
|
||||||
PID* getPID(uint8_t side) const;
|
PID* getPID(uint8_t side) const;
|
||||||
|
|
||||||
/**
|
Speedometer* getSpeedometerLeft() const { return this->leftSpeedometer; }
|
||||||
* @brief Get the Speedometer Left object
|
Speedometer* getSpeedometerRight() const { return this->rightSpeedometer; }
|
||||||
*
|
|
||||||
* @return Speedometer*
|
|
||||||
*/
|
|
||||||
Speedometer* getSpeedometerLeft() const { return this->left_speedometer; }
|
|
||||||
|
|
||||||
/**
|
uint16_t getDutycycleLeft() const { return this->leftMotor->getDutycycle(); }
|
||||||
* @brief Get the Speedometer Right object
|
uint16_t getDutycycleRight() const { return this->rightMotor->getDutycycle(); }
|
||||||
*
|
|
||||||
* @return Speedometer*
|
|
||||||
*/
|
|
||||||
Speedometer* getSpeedometerRight() const { return this->right_speedometer; }
|
|
||||||
|
|
||||||
uint16_t getDutycycleLeft() const { return this->left_motor->getDutycycle(); }
|
|
||||||
uint16_t getDutycycleRight() const { return this->right_motor->getDutycycle(); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void run() override;
|
void run() override;
|
||||||
@@ -157,22 +169,22 @@ class MoveControl : public Component {
|
|||||||
void regulateMotors();
|
void regulateMotors();
|
||||||
void updateCurrentWheelSpeed();
|
void updateCurrentWheelSpeed();
|
||||||
|
|
||||||
MotorControl *left_motor;
|
MotorControl *leftMotor;
|
||||||
MotorControl *right_motor;
|
MotorControl *rightMotor;
|
||||||
Speedometer *left_speedometer;
|
Speedometer *leftSpeedometer;
|
||||||
Speedometer *right_speedometer;
|
Speedometer *rightSpeedometer;
|
||||||
PID *left_pid;
|
PID *leftPid;
|
||||||
PID *right_pid;
|
PID *rightPid;
|
||||||
|
|
||||||
Status driving_status = Status::Stop;
|
Status driving_status = Status::Stop;
|
||||||
DrivingSpeeds drivingSpeeds = {0, 0};
|
DrivingSpeeds drivingSpeeds = {0, 0};
|
||||||
|
|
||||||
double wheelspeed_left_target = 0;
|
double wheelspeedLeftTarget = 0;
|
||||||
double wheelspeed_right_target = 0;
|
double wheelspeedRightTarget = 0;
|
||||||
double wheelspeed_left = 0;
|
double wheelspeedLeft = 0;
|
||||||
double wheelspeed_right = 0;
|
double wheelspeedRight = 0;
|
||||||
double left_pid_out = 0;
|
double leftPidOut = 0;
|
||||||
double right_pid_out = 0;
|
double rightPidOut = 0;
|
||||||
|
|
||||||
uint8_t overTimeCounter = 0;
|
uint8_t overTimeCounter = 0;
|
||||||
uint8_t overTimeMax = 100;
|
uint8_t overTimeMax = 100;
|
||||||
|
|||||||
+54
-54
@@ -12,53 +12,53 @@
|
|||||||
|
|
||||||
MoveControl::MoveControl()
|
MoveControl::MoveControl()
|
||||||
: Component(MoveControl::loopDelay),
|
: Component(MoveControl::loopDelay),
|
||||||
left_motor{new MotorControl()},
|
leftMotor{new MotorControl()},
|
||||||
right_motor{new MotorControl()},
|
rightMotor{new MotorControl()},
|
||||||
left_speedometer{new Speedometer(PinNumbers::LeftMotor::encoder, Settings::wheelDiameter, Settings::encoderSteps)},
|
leftSpeedometer{new Speedometer(PinNumbers::LeftMotor::encoder, Settings::wheelDiameter, Settings::encoderSteps)},
|
||||||
right_speedometer{new Speedometer(PinNumbers::RightMotor::encoder, Settings::wheelDiameter, Settings::encoderSteps)},
|
rightSpeedometer{new Speedometer(PinNumbers::RightMotor::encoder, Settings::wheelDiameter, Settings::encoderSteps)},
|
||||||
left_pid{new PID(&this->wheelspeed_left,
|
leftPid{new PID(&this->wheelspeedLeft,
|
||||||
&this->left_pid_out,
|
&this->leftPidOut,
|
||||||
&this->wheelspeed_left_target,
|
&this->wheelspeedLeftTarget,
|
||||||
Settings::Pid::Left::P,
|
Settings::Pid::Left::P,
|
||||||
Settings::Pid::Left::I,
|
Settings::Pid::Left::I,
|
||||||
Settings::Pid::Left::D,
|
Settings::Pid::Left::D,
|
||||||
DIRECT)},
|
DIRECT)},
|
||||||
right_pid{new PID(&this->wheelspeed_right,
|
rightPid{new PID(&this->wheelspeedRight,
|
||||||
&this->right_pid_out,
|
&this->rightPidOut,
|
||||||
&this->wheelspeed_right_target,
|
&this->wheelspeedRightTarget,
|
||||||
Settings::Pid::Right::P,
|
Settings::Pid::Right::P,
|
||||||
Settings::Pid::Right::I,
|
Settings::Pid::Right::I,
|
||||||
Settings::Pid::Right::D,
|
Settings::Pid::Right::D,
|
||||||
DIRECT)}
|
DIRECT)}
|
||||||
{
|
{
|
||||||
this->left_pid->SetOutputLimits(Settings::Pid::outMin, Settings::Pid::outMax);
|
this->leftPid->SetOutputLimits(Settings::Pid::outMin, Settings::Pid::outMax);
|
||||||
this->left_pid->SetSampleTime(Settings::Pid::sampleTime);
|
this->leftPid->SetSampleTime(Settings::Pid::sampleTime);
|
||||||
this->left_pid->SetMode(AUTOMATIC);
|
this->leftPid->SetMode(AUTOMATIC);
|
||||||
|
|
||||||
this->right_pid->SetOutputLimits(Settings::Pid::outMin, Settings::Pid::outMax);
|
this->rightPid->SetOutputLimits(Settings::Pid::outMin, Settings::Pid::outMax);
|
||||||
this->right_pid->SetSampleTime(Settings::Pid::sampleTime);
|
this->rightPid->SetSampleTime(Settings::Pid::sampleTime);
|
||||||
this->right_pid->SetMode(AUTOMATIC);
|
this->rightPid->SetMode(AUTOMATIC);
|
||||||
|
|
||||||
this->left_motor->init(PinNumbers::LeftMotor::pwm, PinNumbers::LeftMotor::pmwChannel, PinNumbers::LeftMotor::dir1, PinNumbers::LeftMotor::dir2);
|
this->leftMotor->init(PinNumbers::LeftMotor::pwm, PinNumbers::LeftMotor::pmwChannel, PinNumbers::LeftMotor::dir1, PinNumbers::LeftMotor::dir2);
|
||||||
this->right_motor->init(PinNumbers::RightMotor::pwm, PinNumbers::RightMotor::pmwChannel, PinNumbers::RightMotor::dir1, PinNumbers::RightMotor::dir2);
|
this->rightMotor->init(PinNumbers::RightMotor::pwm, PinNumbers::RightMotor::pmwChannel, PinNumbers::RightMotor::dir1, PinNumbers::RightMotor::dir2);
|
||||||
|
|
||||||
this->addChildComponent(this->left_motor);
|
this->addChildComponent(this->leftMotor);
|
||||||
this->addChildComponent(this->right_motor);
|
this->addChildComponent(this->rightMotor);
|
||||||
this->addChildComponent(this->left_speedometer);
|
this->addChildComponent(this->leftSpeedometer);
|
||||||
this->addChildComponent(this->right_speedometer);
|
this->addChildComponent(this->rightSpeedometer);
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveControl::~MoveControl()
|
MoveControl::~MoveControl()
|
||||||
{
|
{
|
||||||
this->left_motor->emergencyStop();
|
this->leftMotor->emergencyStop();
|
||||||
this->right_motor->emergencyStop();
|
this->rightMotor->emergencyStop();
|
||||||
|
|
||||||
delete this->left_motor;
|
delete this->leftMotor;
|
||||||
delete this->right_motor;
|
delete this->rightMotor;
|
||||||
delete this->left_speedometer;
|
delete this->leftSpeedometer;
|
||||||
delete this->right_speedometer;
|
delete this->rightSpeedometer;
|
||||||
delete this->left_pid;
|
delete this->leftPid;
|
||||||
delete this->right_pid;
|
delete this->rightPid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::run()
|
void MoveControl::run()
|
||||||
@@ -66,8 +66,8 @@ void MoveControl::run()
|
|||||||
this->updateCurrentWheelSpeed();
|
this->updateCurrentWheelSpeed();
|
||||||
this->calcTargetWheelSpeed();
|
this->calcTargetWheelSpeed();
|
||||||
|
|
||||||
this->right_pid->Compute();
|
this->rightPid->Compute();
|
||||||
this->left_pid->Compute();
|
this->leftPid->Compute();
|
||||||
|
|
||||||
this->regulateMotors();
|
this->regulateMotors();
|
||||||
}
|
}
|
||||||
@@ -100,8 +100,8 @@ void MoveControl::setDrivingStatus(Status status)
|
|||||||
|
|
||||||
void MoveControl::emergencyStop()
|
void MoveControl::emergencyStop()
|
||||||
{
|
{
|
||||||
this->left_motor->emergencyStop();
|
this->leftMotor->emergencyStop();
|
||||||
this->right_motor->emergencyStop();
|
this->rightMotor->emergencyStop();
|
||||||
this->setSpeed(0);
|
this->setSpeed(0);
|
||||||
this->setRotationSpeed(0);
|
this->setRotationSpeed(0);
|
||||||
this->setRawPowerLeft(0);
|
this->setRawPowerLeft(0);
|
||||||
@@ -158,11 +158,11 @@ void MoveControl::setPidTunings(uint8_t side, double pPart, double iPart, double
|
|||||||
PID *selectedPID = nullptr;
|
PID *selectedPID = nullptr;
|
||||||
if (side == 0)
|
if (side == 0)
|
||||||
{
|
{
|
||||||
selectedPID = this->left_pid;
|
selectedPID = this->leftPid;
|
||||||
}
|
}
|
||||||
else if (side == 1)
|
else if (side == 1)
|
||||||
{
|
{
|
||||||
selectedPID = this->right_pid;
|
selectedPID = this->rightPid;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedPID->SetTunings(pPart, iPart, dPart);
|
selectedPID->SetTunings(pPart, iPart, dPart);
|
||||||
@@ -172,11 +172,11 @@ PID *MoveControl::getPID(uint8_t side) const
|
|||||||
{
|
{
|
||||||
if (side == 0)
|
if (side == 0)
|
||||||
{
|
{
|
||||||
return this->left_pid;
|
return this->leftPid;
|
||||||
}
|
}
|
||||||
if (side == 1)
|
if (side == 1)
|
||||||
{
|
{
|
||||||
return this->right_pid;
|
return this->rightPid;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -208,8 +208,8 @@ void MoveControl::calcTargetWheelSpeed()
|
|||||||
// (1 / r) * b
|
// (1 / r) * b
|
||||||
constexpr double B1rb = (1.0 / (Settings::wheelDiameter / 2)) * (Settings::wheelDistance / 2);
|
constexpr double B1rb = (1.0 / (Settings::wheelDiameter / 2)) * (Settings::wheelDistance / 2);
|
||||||
|
|
||||||
this->wheelspeed_right_target = (A1r1 * this->drivingSpeeds.x + B1rb * this->drivingSpeeds.rot);
|
this->wheelspeedRightTarget = (A1r1 * this->drivingSpeeds.x + B1rb * this->drivingSpeeds.rot);
|
||||||
this->wheelspeed_left_target = (A1r1 * this->drivingSpeeds.x + (-B1rb) * this->drivingSpeeds.rot);
|
this->wheelspeedLeftTarget = (A1r1 * this->drivingSpeeds.x + (-B1rb) * this->drivingSpeeds.rot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::regulateMotors()
|
void MoveControl::regulateMotors()
|
||||||
@@ -217,24 +217,24 @@ void MoveControl::regulateMotors()
|
|||||||
switch (this->driving_status)
|
switch (this->driving_status)
|
||||||
{
|
{
|
||||||
case Status::Stop:
|
case Status::Stop:
|
||||||
this->left_motor->setTargetPower(0);
|
this->leftMotor->setTargetPower(0);
|
||||||
this->right_motor->setTargetPower(0);
|
this->rightMotor->setTargetPower(0);
|
||||||
this->setSpeedometerDirection(this->left_speedometer, 0);
|
this->setSpeedometerDirection(this->leftSpeedometer, 0);
|
||||||
this->setSpeedometerDirection(this->right_speedometer, 0);
|
this->setSpeedometerDirection(this->rightSpeedometer, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Status::Drive:
|
case Status::Drive:
|
||||||
this->left_motor->setTargetPower(static_cast<int8_t>(this->left_pid_out));
|
this->leftMotor->setTargetPower(static_cast<int8_t>(this->leftPidOut));
|
||||||
this->right_motor->setTargetPower(static_cast<int8_t>(this->right_pid_out));
|
this->rightMotor->setTargetPower(static_cast<int8_t>(this->rightPidOut));
|
||||||
this->setSpeedometerDirection(this->left_speedometer, this->left_motor->getPower());
|
this->setSpeedometerDirection(this->leftSpeedometer, this->leftMotor->getPower());
|
||||||
this->setSpeedometerDirection(this->right_speedometer, this->right_motor->getPower());
|
this->setSpeedometerDirection(this->rightSpeedometer, this->rightMotor->getPower());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Status::Raw:
|
case Status::Raw:
|
||||||
this->left_motor->setTargetPower(this->rawPowerLeft);
|
this->leftMotor->setTargetPower(this->rawPowerLeft);
|
||||||
this->right_motor->setTargetPower(this->rawPowerRight);
|
this->rightMotor->setTargetPower(this->rawPowerRight);
|
||||||
this->setSpeedometerDirection(this->left_speedometer, this->rawPowerLeft);
|
this->setSpeedometerDirection(this->leftSpeedometer, this->rawPowerLeft);
|
||||||
this->setSpeedometerDirection(this->right_speedometer, this->rawPowerRight);
|
this->setSpeedometerDirection(this->rightSpeedometer, this->rawPowerRight);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -245,6 +245,6 @@ void MoveControl::regulateMotors()
|
|||||||
|
|
||||||
void MoveControl::updateCurrentWheelSpeed()
|
void MoveControl::updateCurrentWheelSpeed()
|
||||||
{
|
{
|
||||||
this->wheelspeed_left = this->left_speedometer->getSpeedRad();
|
this->wheelspeedLeft = this->leftSpeedometer->getSpeedRad();
|
||||||
this->wheelspeed_right = this->right_speedometer->getSpeedRad();
|
this->wheelspeedRight = this->rightSpeedometer->getSpeedRad();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user