Fix incomplete .styleguide (#2113)

Also clean up other .styleguides.

Fixes #2111.
This commit is contained in:
Tyler Veness
2019-11-20 22:44:18 -08:00
committed by Peter Johnson
parent ffa4b907c0
commit 9a8067465c
20 changed files with 141 additions and 104 deletions

View File

@@ -7,15 +7,16 @@
#pragma once
#include "frc2/command/SubsystemBase.h"
#include "frc/trajectory/TrapezoidProfile.h"
#include <frc/trajectory/TrapezoidProfile.h>
#include <units/units.h>
#include "frc2/command/SubsystemBase.h"
namespace frc2 {
/**
* A subsystem that generates and runs trapezoidal motion profiles automatically. The user
* specifies how to use the current state of the motion profile by overriding the `UseState` method.
* A subsystem that generates and runs trapezoidal motion profiles
* automatically. The user specifies how to use the current state of the motion
* profile by overriding the `UseState` method.
*/
template <class Distance>
class TrapezoidProfileSubsystem : public SubsystemBase {
@@ -25,39 +26,42 @@ class TrapezoidProfileSubsystem : public SubsystemBase {
using Velocity_t = units::unit_t<Velocity>;
using State = typename frc::TrapezoidProfile<Distance>::State;
using Constraints = typename frc::TrapezoidProfile<Distance>::Constraints;
public:
/**
* Creates a new TrapezoidProfileSubsystem.
*
* @param constraints The constraints (maximum velocity and acceleration) for the profiles.
* @param initialPosition The initial position of the controller mechanism when the subsystem
* is constructed.
* @param constraints The constraints (maximum velocity and acceleration)
* for the profiles.
* @param initialPosition The initial position of the controller mechanism
* when the subsystem is constructed.
* @param period The period of the main robot loop, in seconds.
*/
TrapezoidProfileSubsystem(Constraints constraints,
Distance_t position,
TrapezoidProfileSubsystem(Constraints constraints, Distance_t position,
units::second_t period = 20_ms)
: m_constraints(constraints),
m_state{position, Velocity_t(0)},
m_period(period) {}
: m_constraints(constraints),
m_state{position, Velocity_t(0)},
m_period(period) {}
void Periodic() override {
auto profile = frc::TrapezoidProfile<Distance>(m_constraints, GetGoal(), m_state);
auto profile =
frc::TrapezoidProfile<Distance>(m_constraints, GetGoal(), m_state);
m_state = profile.Calculate(m_period);
UseState(m_state);
}
/**
* Users should override this to return the goal state for the subsystem's motion profile.
* Users should override this to return the goal state for the subsystem's
* motion profile.
*
* @return The goal state for the subsystem's motion profile.
*/
virtual State GetGoal() = 0;
protected:
/**
* Users should override this to consume the current state of the motion profile.
* Users should override this to consume the current state of the motion
* profile.
*
* @param state The current state of the motion profile.
*/
@@ -68,4 +72,4 @@ class TrapezoidProfileSubsystem : public SubsystemBase {
State m_state;
units::second_t m_period;
};
}
} // namespace frc2