mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
Fixed cpplint.py warnings (#215)
* Fixed cpplint.py [build/include_order] and [build/include_what_you_use] warnings * Fixed cpplint.py [readability/casting] warnings * Updated .styleguide format * Fixed cpplint.py [build/header_guard] warnings
This commit is contained in:
committed by
Peter Johnson
parent
59ec54887d
commit
05626cfafe
@@ -7,7 +7,9 @@
|
||||
|
||||
#include "RobotDrive.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "GenericHID.h"
|
||||
#include "HAL/HAL.h"
|
||||
#include "Joystick.h"
|
||||
@@ -15,9 +17,6 @@
|
||||
#include "Utility.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
#undef max
|
||||
#include <algorithm>
|
||||
|
||||
const int32_t RobotDrive::kMaxNumberOfMotors;
|
||||
|
||||
static auto make_shared_nodelete(SpeedController* ptr) {
|
||||
@@ -223,13 +222,13 @@ void RobotDrive::Drive(float outputMagnitude, float curve) {
|
||||
}
|
||||
|
||||
if (curve < 0) {
|
||||
float value = log(-curve);
|
||||
float value = std::log(-curve);
|
||||
float ratio = (value - m_sensitivity) / (value + m_sensitivity);
|
||||
if (ratio == 0) ratio = .0000000001;
|
||||
leftOutput = outputMagnitude / ratio;
|
||||
rightOutput = outputMagnitude;
|
||||
} else if (curve > 0) {
|
||||
float value = log(curve);
|
||||
float value = std::log(curve);
|
||||
float ratio = (value - m_sensitivity) / (value + m_sensitivity);
|
||||
if (ratio == 0) ratio = .0000000001;
|
||||
leftOutput = outputMagnitude;
|
||||
@@ -557,11 +556,11 @@ void RobotDrive::MecanumDrive_Polar(float magnitude, float direction,
|
||||
}
|
||||
|
||||
// Normalized for full power along the Cartesian axes.
|
||||
magnitude = Limit(magnitude) * sqrt(2.0);
|
||||
magnitude = Limit(magnitude) * std::sqrt(2.0);
|
||||
// The rollers are at 45 degree angles.
|
||||
double dirInRad = (direction + 45.0) * 3.14159 / 180.0;
|
||||
double cosD = cos(dirInRad);
|
||||
double sinD = sin(dirInRad);
|
||||
double cosD = std::cos(dirInRad);
|
||||
double sinD = std::sin(dirInRad);
|
||||
|
||||
double wheelSpeeds[kMaxNumberOfMotors];
|
||||
wheelSpeeds[kFrontLeftMotor] = sinD * magnitude + rotation;
|
||||
@@ -637,10 +636,10 @@ float RobotDrive::Limit(float num) {
|
||||
* Normalize all wheel speeds if the magnitude of any wheel is greater than 1.0.
|
||||
*/
|
||||
void RobotDrive::Normalize(double* wheelSpeeds) {
|
||||
double maxMagnitude = fabs(wheelSpeeds[0]);
|
||||
double maxMagnitude = std::fabs(wheelSpeeds[0]);
|
||||
int32_t i;
|
||||
for (i = 1; i < kMaxNumberOfMotors; i++) {
|
||||
double temp = fabs(wheelSpeeds[i]);
|
||||
double temp = std::fabs(wheelSpeeds[i]);
|
||||
if (maxMagnitude < temp) maxMagnitude = temp;
|
||||
}
|
||||
if (maxMagnitude > 1.0) {
|
||||
@@ -654,8 +653,8 @@ void RobotDrive::Normalize(double* wheelSpeeds) {
|
||||
* Rotate a vector in Cartesian space.
|
||||
*/
|
||||
void RobotDrive::RotateVector(double& x, double& y, double angle) {
|
||||
double cosA = cos(angle * (3.14159 / 180.0));
|
||||
double sinA = sin(angle * (3.14159 / 180.0));
|
||||
double cosA = std::cos(angle * (3.14159 / 180.0));
|
||||
double sinA = std::sin(angle * (3.14159 / 180.0));
|
||||
double xOut = x * cosA - y * sinA;
|
||||
double yOut = x * sinA + y * cosA;
|
||||
x = xOut;
|
||||
|
||||
Reference in New Issue
Block a user