Tightened up the loop to prevent it from going in the other direction.
diff --git a/frc971/control_loops/python/wrist.py b/frc971/control_loops/python/wrist.py
index 441999f..498a485 100755
--- a/frc971/control_loops/python/wrist.py
+++ b/frc971/control_loops/python/wrist.py
@@ -17,7 +17,9 @@
# Free Current in Amps
self.free_current = 1.5
# Moment of inertia of the wrist in kg m^2
- self.J = 0.51
+ # TODO(aschuh): Measure this in reality. It doesn't seem high enough.
+ # James measured 0.51, but that can't be right given what I am seeing.
+ self.J = 1.51
# Resistance of the motor
self.R = 12.0 / self.stall_current + 0.024 + .003
# Motor velocity constant
@@ -43,7 +45,9 @@
self.ContinuousToDiscrete(self.A_continuous, self.B_continuous,
self.dt, self.C)
- self.PlaceControllerPoles([.89, .85])
+ self.PlaceControllerPoles([.84, .84])
+
+ print self.K
self.rpl = .05
self.ipl = 0.008
@@ -79,10 +83,13 @@
# Write the generated constants out to a file.
if len(argv) != 3:
- print "Expected .cc file name and .h file name"
+ print "Expected .h file name and .cc file name"
else:
- wrist.DumpHeaderFile(argv[1])
- wrist.DumpCppFile(argv[2], argv[1])
+ if argv[1][-3:] == '.cc':
+ print '.cc file is second'
+ else:
+ wrist.DumpHeaderFile(argv[1])
+ wrist.DumpCppFile(argv[2], argv[1])
if __name__ == '__main__':
sys.exit(main(sys.argv))
diff --git a/frc971/control_loops/wrist_motor_plant.cc b/frc971/control_loops/wrist_motor_plant.cc
index 17168a1..56e141f 100644
--- a/frc971/control_loops/wrist_motor_plant.cc
+++ b/frc971/control_loops/wrist_motor_plant.cc
@@ -8,9 +8,9 @@
StateFeedbackPlant<2, 1, 1> MakeWristPlant() {
Eigen::Matrix<double, 2, 2> A;
- A << 1.0, 0.00688850240086, 0.0, 0.450098411557;
+ A << 1.0, 0.00876530955899, 0.0, 0.763669024671;
Eigen::Matrix<double, 2, 1> B;
- B << 0.00106724827203, 0.188617057012;
+ B << 0.000423500644841, 0.0810618735867;
Eigen::Matrix<double, 1, 2> C;
C << 1, 0;
Eigen::Matrix<double, 1, 1> D;
@@ -24,9 +24,9 @@
StateFeedbackLoop<2, 1, 1> MakeWristLoop() {
Eigen::Matrix<double, 2, 1> L;
- L << 1.35009841156, 23.2478308944;
+ L << 1.66366902467, 58.1140316091;
Eigen::Matrix<double, 1, 2> K;
- K << 8.74788328338, -1.58648298569;
+ K << 31.5808145893, 0.867171288023;
return StateFeedbackLoop<2, 1, 1>(L, K, MakeWristPlant());
}
diff --git a/frc971/control_loops/wrist_motor_plant.h b/frc971/control_loops/wrist_motor_plant.h
index 9595b5f..c692770 100644
--- a/frc971/control_loops/wrist_motor_plant.h
+++ b/frc971/control_loops/wrist_motor_plant.h
@@ -12,4 +12,5 @@
} // namespace frc971
} // namespace control_loops
+
#endif // FRC971_CONTROL_LOOPS_WRIST_MOTOR_PLANT_H_