mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
[wpilibc] MotorSafety::GetDescription(): Return std::string (#3390)
This is only called in an error condition, so it's not necessary to over optimize it.
This commit is contained in:
@@ -4,14 +4,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <wpi/mutex.h>
|
||||
|
||||
#include "frc/Timer.h"
|
||||
|
||||
namespace wpi {
|
||||
class raw_ostream;
|
||||
} // namespace wpi
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
@@ -92,7 +90,7 @@ class MotorSafety {
|
||||
static void CheckMotors();
|
||||
|
||||
virtual void StopMotor() = 0;
|
||||
virtual void GetDescription(wpi::raw_ostream& desc) const = 0;
|
||||
virtual std::string GetDescription() const = 0;
|
||||
|
||||
private:
|
||||
static constexpr double kDefaultSafetyExpiration = 0.1;
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <hal/Types.h>
|
||||
#include <wpi/raw_ostream.h>
|
||||
|
||||
#include "frc/MotorSafety.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
@@ -91,7 +91,7 @@ class Relay : public MotorSafety,
|
||||
// MotorSafety interface
|
||||
void StopMotor() override;
|
||||
|
||||
void GetDescription(wpi::raw_ostream& desc) const override;
|
||||
std::string GetDescription() const override;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/raw_ostream.h>
|
||||
#include <string>
|
||||
|
||||
#include "frc/drive/RobotDriveBase.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
@@ -206,7 +206,7 @@ class DifferentialDrive : public RobotDriveBase,
|
||||
bool squareInputs = true);
|
||||
|
||||
void StopMotor() override;
|
||||
void GetDescription(wpi::raw_ostream& desc) const override;
|
||||
std::string GetDescription() const override;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <wpi/raw_ostream.h>
|
||||
#include <string>
|
||||
|
||||
#include "frc/drive/RobotDriveBase.h"
|
||||
#include "frc/drive/Vector2d.h"
|
||||
@@ -159,7 +158,7 @@ class KilloughDrive : public RobotDriveBase,
|
||||
double gyroAngle = 0.0);
|
||||
|
||||
void StopMotor() override;
|
||||
void GetDescription(wpi::raw_ostream& desc) const override;
|
||||
std::string GetDescription() const override;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <wpi/raw_ostream.h>
|
||||
#include <string>
|
||||
|
||||
#include "frc/drive/RobotDriveBase.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
@@ -149,7 +148,7 @@ class MecanumDrive : public RobotDriveBase,
|
||||
double zRotation, double gyroAngle = 0.0);
|
||||
|
||||
void StopMotor() override;
|
||||
void GetDescription(wpi::raw_ostream& desc) const override;
|
||||
std::string GetDescription() const override;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <wpi/ArrayRef.h>
|
||||
#include <wpi/raw_ostream.h>
|
||||
|
||||
#include "frc/MotorSafety.h"
|
||||
|
||||
@@ -66,7 +66,7 @@ class RobotDriveBase : public MotorSafety {
|
||||
void FeedWatchdog();
|
||||
|
||||
void StopMotor() override = 0;
|
||||
void GetDescription(wpi::raw_ostream& desc) const override = 0;
|
||||
std::string GetDescription() const override = 0;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "frc/DigitalOutput.h"
|
||||
#include "frc/MotorSafety.h"
|
||||
#include "frc/PWM.h"
|
||||
@@ -74,7 +76,7 @@ class NidecBrushless : public MotorController,
|
||||
|
||||
// MotorSafety interface
|
||||
void StopMotor() override;
|
||||
void GetDescription(wpi::raw_ostream& desc) const override;
|
||||
std::string GetDescription() const override;
|
||||
|
||||
/**
|
||||
* Gets the channel number associated with the object.
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "frc/MotorSafety.h"
|
||||
@@ -12,10 +14,6 @@
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace wpi {
|
||||
class raw_ostream;
|
||||
} // namespace wpi
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
@@ -56,7 +54,7 @@ class PWMMotorController : public MotorController,
|
||||
|
||||
// MotorSafety interface
|
||||
void StopMotor() override;
|
||||
void GetDescription(wpi::raw_ostream& desc) const override;
|
||||
std::string GetDescription() const override;
|
||||
|
||||
int GetChannel() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user