mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Fix implicitly deleted move constructors (#1954)
These were incorrect and exhibited as warnings on more recent versions of clang (notably on Mac). - Use pointers instead of references internally in GenericHID and *Drive - Leave PIDBase, PIDController, and Resource non-moveable - Remove the atomic from m_disabled in NidecBrushless - Make Timer and Trigger copyable as well as moveable - Implement custom move constructor/assignment for SendableChooserBase Also comment out some unused variables that caused clang warnings.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -179,7 +179,7 @@ class GenericHID : public ErrorBase {
|
||||
void SetRumble(RumbleType type, double value);
|
||||
|
||||
private:
|
||||
DriverStation& m_ds;
|
||||
DriverStation* m_ds;
|
||||
int m_port;
|
||||
int m_outputs = 0;
|
||||
uint16_t m_leftRumble = 0;
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include "frc/DigitalOutput.h"
|
||||
#include "frc/ErrorBase.h"
|
||||
#include "frc/MotorSafety.h"
|
||||
@@ -102,7 +100,7 @@ class NidecBrushless : public SpeedController,
|
||||
|
||||
private:
|
||||
bool m_isInverted = false;
|
||||
std::atomic_bool m_disabled{false};
|
||||
bool m_disabled = false;
|
||||
DigitalOutput m_dio;
|
||||
PWM m_pwm;
|
||||
double m_speed = 0.0;
|
||||
|
||||
@@ -66,9 +66,6 @@ class PIDBase : public PIDInterface,
|
||||
|
||||
virtual ~PIDBase() = default;
|
||||
|
||||
PIDBase(PIDBase&&) = default;
|
||||
PIDBase& operator=(PIDBase&&) = default;
|
||||
|
||||
/**
|
||||
* Return the current PID result.
|
||||
*
|
||||
|
||||
@@ -102,9 +102,6 @@ class PIDController : public PIDBase, public Controller {
|
||||
|
||||
~PIDController() override;
|
||||
|
||||
PIDController(PIDController&&) = default;
|
||||
PIDController& operator=(PIDController&&) = default;
|
||||
|
||||
/**
|
||||
* Begin running the PIDController.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -33,9 +33,6 @@ class Resource : public ErrorBase {
|
||||
public:
|
||||
virtual ~Resource() = default;
|
||||
|
||||
Resource(Resource&&) = default;
|
||||
Resource& operator=(Resource&&) = default;
|
||||
|
||||
/**
|
||||
* Factory method to create a Resource allocation-tracker *if* needed.
|
||||
*
|
||||
|
||||
@@ -57,6 +57,8 @@ class Timer {
|
||||
|
||||
virtual ~Timer() = default;
|
||||
|
||||
Timer(const Timer& rhs);
|
||||
Timer& operator=(const Timer& rhs);
|
||||
Timer(Timer&& rhs);
|
||||
Timer& operator=(Timer&& rhs);
|
||||
|
||||
|
||||
@@ -34,8 +34,10 @@ class Trigger : public Sendable, public SendableHelper<Trigger> {
|
||||
Trigger() = default;
|
||||
~Trigger() override = default;
|
||||
|
||||
Trigger(Trigger&&) = default;
|
||||
Trigger& operator=(Trigger&&) = default;
|
||||
Trigger(const Trigger& rhs);
|
||||
Trigger& operator=(const Trigger& rhs);
|
||||
Trigger(Trigger&& rhs);
|
||||
Trigger& operator=(Trigger&& rhs);
|
||||
|
||||
bool Grab();
|
||||
virtual bool Get() = 0;
|
||||
|
||||
@@ -212,8 +212,8 @@ class DifferentialDrive : public RobotDriveBase,
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
SpeedController& m_leftMotor;
|
||||
SpeedController& m_rightMotor;
|
||||
SpeedController* m_leftMotor;
|
||||
SpeedController* m_rightMotor;
|
||||
|
||||
double m_quickStopThreshold = kDefaultQuickStopThreshold;
|
||||
double m_quickStopAlpha = kDefaultQuickStopAlpha;
|
||||
|
||||
@@ -132,9 +132,9 @@ class KilloughDrive : public RobotDriveBase,
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
SpeedController& m_leftMotor;
|
||||
SpeedController& m_rightMotor;
|
||||
SpeedController& m_backMotor;
|
||||
SpeedController* m_leftMotor;
|
||||
SpeedController* m_rightMotor;
|
||||
SpeedController* m_backMotor;
|
||||
|
||||
Vector2d m_leftVec;
|
||||
Vector2d m_rightVec;
|
||||
|
||||
@@ -137,10 +137,10 @@ class MecanumDrive : public RobotDriveBase,
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
SpeedController& m_frontLeftMotor;
|
||||
SpeedController& m_rearLeftMotor;
|
||||
SpeedController& m_frontRightMotor;
|
||||
SpeedController& m_rearRightMotor;
|
||||
SpeedController* m_frontLeftMotor;
|
||||
SpeedController* m_rearLeftMotor;
|
||||
SpeedController* m_frontRightMotor;
|
||||
SpeedController* m_rearRightMotor;
|
||||
|
||||
double m_rightSideInvertMultiplier = -1.0;
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ class SendableChooserBase : public Sendable,
|
||||
SendableChooserBase();
|
||||
~SendableChooserBase() override = default;
|
||||
|
||||
SendableChooserBase(SendableChooserBase&&) = default;
|
||||
SendableChooserBase& operator=(SendableChooserBase&&) = default;
|
||||
SendableChooserBase(SendableChooserBase&& oth);
|
||||
SendableChooserBase& operator=(SendableChooserBase&& oth);
|
||||
|
||||
protected:
|
||||
static constexpr const char* kDefault = "default";
|
||||
|
||||
Reference in New Issue
Block a user