mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Merge branch 'main' into 2022
This commit is contained in:
@@ -23,6 +23,13 @@ class AnalogInput;
|
||||
*/
|
||||
class AnalogEncoder : public Sendable, public SendableHelper<AnalogEncoder> {
|
||||
public:
|
||||
/**
|
||||
* Construct a new AnalogEncoder attached to a specific AnalogIn channel.
|
||||
*
|
||||
* @param channel the analog input channel to attach to
|
||||
*/
|
||||
explicit AnalogEncoder(int channel);
|
||||
|
||||
/**
|
||||
* Construct a new AnalogEncoder attached to a specific AnalogInput.
|
||||
*
|
||||
|
||||
@@ -105,5 +105,7 @@ class HolonomicDriveController {
|
||||
frc2::PIDController m_xController;
|
||||
frc2::PIDController m_yController;
|
||||
ProfiledPIDController<units::radian> m_thetaController;
|
||||
|
||||
bool m_firstRun = true;
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hal/SimDevice.h>
|
||||
|
||||
#include "frc/interfaces/Gyro.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Use a rate gyro to return the robots heading relative to a starting position.
|
||||
*
|
||||
* This class is for the Romi onboard gyro, and will only work in
|
||||
* simulation/Romi mode. Only one instance of a RomiGyro is supported.
|
||||
*/
|
||||
class RomiGyro : public Gyro, public Sendable, public SendableHelper<RomiGyro> {
|
||||
public:
|
||||
RomiGyro();
|
||||
|
||||
/**
|
||||
* Return the actual angle in degrees that the robot is currently facing.
|
||||
*
|
||||
* The angle is based on integration of the returned rate form the gyro.
|
||||
* The angle is continuous, that is, it will continue from 360->361 degrees.
|
||||
* This allows algorithms that wouldn't want to see a discontinuity in the
|
||||
* gyro output as it sweeps from 360 to 0 on the second time around.
|
||||
*
|
||||
* @return the current heading of the robot in degrees.
|
||||
*/
|
||||
double GetAngle() const override;
|
||||
|
||||
/**
|
||||
* Return the rate of rotation of the gyro
|
||||
*
|
||||
* The rate is based on the most recent reading of the gyro.
|
||||
*
|
||||
* @return the current rate in degrees per second
|
||||
*/
|
||||
double GetRate() const override;
|
||||
|
||||
/**
|
||||
* Initialize the gyro.
|
||||
*
|
||||
* NOTE: This function is a no-op. The Romi gyro should be calibrated via
|
||||
* the web UI.
|
||||
*/
|
||||
void Calibrate() final {}
|
||||
|
||||
/**
|
||||
* Gets the rate of turn in degrees-per-second around the X-axis
|
||||
*/
|
||||
double GetRateX() const;
|
||||
|
||||
/**
|
||||
* Gets the rate of turn in degrees-per-second around the Y-axis
|
||||
*/
|
||||
double GetRateY() const;
|
||||
|
||||
/**
|
||||
* Gets the rate of turn in degrees-per-second around the Z-axis
|
||||
*/
|
||||
double GetRateZ() const;
|
||||
|
||||
/**
|
||||
* Gets the currently reported angle around the X-axis
|
||||
*/
|
||||
double GetAngleX() const;
|
||||
|
||||
/**
|
||||
* Gets the currently reported angle around the X-axis
|
||||
*/
|
||||
double GetAngleY() const;
|
||||
|
||||
/**
|
||||
* Gets the currently reported angle around the X-axis
|
||||
*/
|
||||
double GetAngleZ() const;
|
||||
|
||||
/**
|
||||
* Resets the gyro
|
||||
*/
|
||||
void Reset() override;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
hal::SimDevice m_simDevice;
|
||||
hal::SimDouble m_simRateX;
|
||||
hal::SimDouble m_simRateY;
|
||||
hal::SimDouble m_simRateZ;
|
||||
hal::SimDouble m_simAngleX;
|
||||
hal::SimDouble m_simAngleY;
|
||||
hal::SimDouble m_simAngleZ;
|
||||
|
||||
double m_angleXOffset = 0;
|
||||
double m_angleYOffset = 0;
|
||||
double m_angleZOffset = 0;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
@@ -18,7 +18,7 @@ namespace frc::sim {
|
||||
class FlywheelSim : public LinearSystemSim<1, 1, 1> {
|
||||
public:
|
||||
/**
|
||||
* Creates a simulated flywhel mechanism.
|
||||
* Creates a simulated flywheel mechanism.
|
||||
*
|
||||
* @param plant The linear system representing the flywheel.
|
||||
* @param gearbox The type of and number of motors in the flywheel
|
||||
@@ -32,7 +32,7 @@ class FlywheelSim : public LinearSystemSim<1, 1, 1> {
|
||||
const std::array<double, 1>& measurementStdDevs = {0.0});
|
||||
|
||||
/**
|
||||
* Creates a simulated flywhel mechanism.
|
||||
* Creates a simulated flywheel mechanism.
|
||||
*
|
||||
* @param gearbox The type of and number of motors in the flywheel
|
||||
* gearbox.
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
namespace frc {
|
||||
|
||||
class Field2d;
|
||||
class Trajectory;
|
||||
|
||||
/**
|
||||
* Game field object on a Field2d.
|
||||
@@ -76,6 +77,13 @@ class FieldObject2d {
|
||||
*/
|
||||
void SetPoses(std::initializer_list<Pose2d> poses);
|
||||
|
||||
/**
|
||||
* Sets poses from a trajectory.
|
||||
*
|
||||
* @param trajectory The trajectory from which poses should be added.
|
||||
*/
|
||||
void SetTrajectory(const Trajectory& trajectory);
|
||||
|
||||
/**
|
||||
* Get multiple poses.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user