From f24c8b1b8dd5e0d2da7a87a514a0e8db4a6b1941 Mon Sep 17 00:00:00 2001 From: Peter_Mitrano Date: Mon, 25 Jan 2016 12:03:48 -0500 Subject: [PATCH] Fixed robot drive for C++ Simulation initial values for m_invertedMotors is now 1 previously it was done in some of the constructors, but not all of them. Change-Id: I2c1ce8d8a67f82d02c4c51f1c4d1aaad143f3112 --- wpilibc/simulation/include/RobotDrive.h | 2 +- wpilibc/simulation/src/RobotDrive.cpp | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/wpilibc/simulation/include/RobotDrive.h b/wpilibc/simulation/include/RobotDrive.h index ac69359fc9..8e9f8caed9 100644 --- a/wpilibc/simulation/include/RobotDrive.h +++ b/wpilibc/simulation/include/RobotDrive.h @@ -94,7 +94,7 @@ protected: static const int32_t kMaxNumberOfMotors = 4; - int32_t m_invertedMotors[kMaxNumberOfMotors]; + int32_t m_invertedMotors[kMaxNumberOfMotors] = {1,1,1,1}; float m_sensitivity = 0.5; double m_maxOutput = 1.0; bool m_deleteSpeedControllers; diff --git a/wpilibc/simulation/src/RobotDrive.cpp b/wpilibc/simulation/src/RobotDrive.cpp index 483cc4a453..b6216d00eb 100644 --- a/wpilibc/simulation/src/RobotDrive.cpp +++ b/wpilibc/simulation/src/RobotDrive.cpp @@ -52,11 +52,6 @@ RobotDrive::RobotDrive(uint32_t leftMotorChannel, uint32_t rightMotorChannel) InitRobotDrive(); m_rearLeftMotor = std::make_shared(leftMotorChannel); m_rearRightMotor = std::make_shared(rightMotorChannel); - - for (int32_t i=0; i < kMaxNumberOfMotors; i++) - { - m_invertedMotors[i] = 1; - } SetLeftRightMotorOutputs(0.0, 0.0); m_deleteSpeedControllers = true; } @@ -79,10 +74,6 @@ RobotDrive::RobotDrive(uint32_t frontLeftMotor, uint32_t rearLeftMotor, m_rearRightMotor = std::make_shared(rearRightMotor); m_frontLeftMotor = std::make_shared(frontLeftMotor); m_frontRightMotor = std::make_shared(frontRightMotor); - for (int32_t i=0; i < kMaxNumberOfMotors; i++) - { - m_invertedMotors[i] = 1; - } SetLeftRightMotorOutputs(0.0, 0.0); m_deleteSpeedControllers = true; }