mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal, wpilib] Rewrite CAN APIs (#7798)
This commit is contained in:
@@ -51,7 +51,7 @@ class Robot : public frc::TimedRobot {
|
||||
|
||||
private:
|
||||
// Object for dealing with the Power Distribution Panel (PDP).
|
||||
frc::PowerDistribution m_pdp;
|
||||
frc::PowerDistribution m_pdp{0};
|
||||
};
|
||||
|
||||
#ifndef RUNNING_FRC_TESTS
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
using namespace HatchConstants;
|
||||
|
||||
HatchSubsystem::HatchSubsystem()
|
||||
: m_hatchSolenoid{frc::PneumaticsModuleType::CTREPCM,
|
||||
: m_hatchSolenoid{0, frc::PneumaticsModuleType::CTREPCM,
|
||||
kHatchSolenoidPorts[0], kHatchSolenoidPorts[1]} {}
|
||||
|
||||
frc2::CommandPtr HatchSubsystem::GrabHatchCommand() {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
using namespace HatchConstants;
|
||||
|
||||
HatchSubsystem::HatchSubsystem()
|
||||
: m_hatchSolenoid{frc::PneumaticsModuleType::CTREPCM,
|
||||
: m_hatchSolenoid{0, frc::PneumaticsModuleType::CTREPCM,
|
||||
kHatchSolenoidPorts[0], kHatchSolenoidPorts[1]} {}
|
||||
|
||||
void HatchSubsystem::GrabHatch() {
|
||||
|
||||
@@ -30,7 +30,7 @@ class Intake : public frc2::SubsystemBase {
|
||||
frc::PWMSparkMax m_motor{IntakeConstants::kMotorPort};
|
||||
|
||||
// Double solenoid connected to two channels of a PCM with the default CAN ID
|
||||
frc::DoubleSolenoid m_piston{frc::PneumaticsModuleType::CTREPCM,
|
||||
frc::DoubleSolenoid m_piston{0, frc::PneumaticsModuleType::CTREPCM,
|
||||
IntakeConstants::kSolenoidPorts[0],
|
||||
IntakeConstants::kSolenoidPorts[1]};
|
||||
};
|
||||
|
||||
@@ -40,5 +40,5 @@ class Pneumatics : frc2::SubsystemBase {
|
||||
kScale, kOffset};
|
||||
|
||||
// Compressor connected to a PH with a default CAN ID
|
||||
frc::Compressor m_compressor{frc::PneumaticsModuleType::CTREPCM};
|
||||
frc::Compressor m_compressor{0, frc::PneumaticsModuleType::CTREPCM};
|
||||
};
|
||||
|
||||
@@ -44,15 +44,16 @@ class Robot : public frc::TimedRobot {
|
||||
// Solenoid corresponds to a single solenoid.
|
||||
// In this case, it's connected to channel 0 of a PH with the default CAN
|
||||
// ID.
|
||||
frc::Solenoid m_solenoid{frc::PneumaticsModuleType::REVPH, 0};
|
||||
frc::Solenoid m_solenoid{0, frc::PneumaticsModuleType::REVPH, 0};
|
||||
|
||||
// DoubleSolenoid corresponds to a double solenoid.
|
||||
// In this case, it's connected to channels 1 and 2 of a PH with the default
|
||||
// CAN ID.
|
||||
frc::DoubleSolenoid m_doubleSolenoid{frc::PneumaticsModuleType::REVPH, 1, 2};
|
||||
frc::DoubleSolenoid m_doubleSolenoid{0, frc::PneumaticsModuleType::REVPH, 1,
|
||||
2};
|
||||
|
||||
// Compressor connected to a PH with a default CAN ID
|
||||
frc::Compressor m_compressor{frc::PneumaticsModuleType::REVPH};
|
||||
frc::Compressor m_compressor{0, frc::PneumaticsModuleType::REVPH};
|
||||
|
||||
static constexpr int kSolenoidButton = 1;
|
||||
static constexpr int kDoubleSolenoidForward = 2;
|
||||
|
||||
@@ -18,7 +18,7 @@ class Intake {
|
||||
|
||||
private:
|
||||
frc::PWMSparkMax m_motor{IntakeConstants::kMotorPort};
|
||||
frc::DoubleSolenoid m_piston{frc::PneumaticsModuleType::CTREPCM,
|
||||
frc::DoubleSolenoid m_piston{0, frc::PneumaticsModuleType::CTREPCM,
|
||||
IntakeConstants::kPistonFwdChannel,
|
||||
IntakeConstants::kPistonRevChannel};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user