summaryrefslogtreecommitdiff
path: root/src/org/usfirst/frc/team4272/robotlib/PIDOutputSplitter.java
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-02-21 01:57:06 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2017-02-21 01:57:06 -0500
commit9670a734f62f23c982c43697c074563eb2baf9c0 (patch)
treec364980a0cf833356950ab8fdf61403ef11dde98 /src/org/usfirst/frc/team4272/robotlib/PIDOutputSplitter.java
parent273d09797d76206af2fbbc793cad85fb92665a3a (diff)
Write javadocs for robotlib.
Diffstat (limited to 'src/org/usfirst/frc/team4272/robotlib/PIDOutputSplitter.java')
-rw-r--r--src/org/usfirst/frc/team4272/robotlib/PIDOutputSplitter.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/org/usfirst/frc/team4272/robotlib/PIDOutputSplitter.java b/src/org/usfirst/frc/team4272/robotlib/PIDOutputSplitter.java
index b9d19da..1c63b22 100644
--- a/src/org/usfirst/frc/team4272/robotlib/PIDOutputSplitter.java
+++ b/src/org/usfirst/frc/team4272/robotlib/PIDOutputSplitter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2011-2012, 2015 Luke Shumaker
+ * Copyright (c) 2011-2012, 2015, 2017 Luke Shumaker
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,12 +31,28 @@ package org.usfirst.frc.team4272.robotlib;
import edu.wpi.first.wpilibj.PIDOutput;
/**
- * TODO: Write JavaDocs
+ * PIDOutputSplitter sets a single setpoint on many underlying {@link PIDOutput}s.
+ *
+ * Because it is undesirable that an exception from one underlying
+ * PIDOutput prevent the others from receiving the value; rather than
+ * letting an exception be thrown normally, it is handle by the
+ * {@link error(Exception)} method--see the documentation there for
+ * advanced error handling.
*/
public class PIDOutputSplitter implements PIDOutput {
private final PIDOutput[] outputs;
private final double[] scalars;
+ /**
+ * Construct with a scalar for each underlying output. If the
+ * length of the arrays do not match, a
+ * {@link RuntimeException} is thrown.
+ *
+ * @param outputs The underlying PIDOutputs that are written
+ * to.
+ * @param scalars How much to scale the setpoint written to
+ * each output by.
+ */
public PIDOutputSplitter(PIDOutput[] outputs, double[] scalars) {
this.outputs = outputs;
this.scalars = scalars;
@@ -45,6 +61,12 @@ public class PIDOutputSplitter implements PIDOutput {
}
}
+ /**
+ * Construct a PIDOutputSplitter that applies no scaling.
+ *
+ * @param outputs The underlying PIDOutputs that are written
+ * to.
+ */
public PIDOutputSplitter(PIDOutput... outputs) {
double[] s = new double[outputs.length];
for (int i=0; i<s.length; i++) {