Convert y2014 to y2016, and get the drivetrain running.
I made a y2016 folder based on what was in y2014. Right now, it only has
a drivetrain control loop, and all the constants are not up to date with
the current CAD design. Changes from y2014 can be viewed by comparing to
the BASE commit, since I put this commit on top of a dummy y2014 folder
renamed y2016. Hope this helps.
Change-Id: I3f1d1d1a14a99ac441c51b2a67cbade7cbd708ab
diff --git a/y2016/control_loops/drivetrain/BUILD b/y2016/control_loops/drivetrain/BUILD
index 9d7edb6..1150426 100644
--- a/y2016/control_loops/drivetrain/BUILD
+++ b/y2016/control_loops/drivetrain/BUILD
@@ -5,9 +5,9 @@
genrule(
name = 'genrule_drivetrain',
visibility = ['//visibility:private'],
- cmd = '$(location //y2014/control_loops/python:drivetrain) $(OUTS)',
+ cmd = '$(location //y2016/control_loops/python:drivetrain) $(OUTS)',
tools = [
- '//y2014/control_loops/python:drivetrain',
+ '//y2016/control_loops/python:drivetrain',
],
outs = [
'drivetrain_dog_motor_plant.h',
@@ -20,9 +20,9 @@
genrule(
name = 'genrule_polydrivetrain',
visibility = ['//visibility:private'],
- cmd = '$(location //y2014/control_loops/python:polydrivetrain) $(OUTS)',
+ cmd = '$(location //y2016/control_loops/python:polydrivetrain) $(OUTS)',
tools = [
- '//y2014/control_loops/python:polydrivetrain',
+ '//y2016/control_loops/python:polydrivetrain',
],
outs = [
'polydrivetrain_dog_motor_plant.h',
@@ -59,8 +59,8 @@
],
deps = [
':polydrivetrain_plants',
- '//y2014:constants',
'//frc971/control_loops/drivetrain:drivetrain_config',
+ '//y2016:constants',
],
)
diff --git a/y2016/control_loops/drivetrain/drivetrain_base.cc b/y2016/control_loops/drivetrain/drivetrain_base.cc
index b4ef447..2e5138c 100644
--- a/y2016/control_loops/drivetrain/drivetrain_base.cc
+++ b/y2016/control_loops/drivetrain/drivetrain_base.cc
@@ -1,36 +1,46 @@
-#include "y2014/control_loops/drivetrain/drivetrain_base.h"
+#include "y2016/control_loops/drivetrain/drivetrain_base.h"
#include "frc971/control_loops/drivetrain/drivetrain_config.h"
-#include "y2014/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
-#include "y2014/control_loops/drivetrain/polydrivetrain_dog_motor_plant.h"
-#include "y2014/control_loops/drivetrain/kalman_drivetrain_motor_plant.h"
-#include "y2014/constants.h"
+#include "y2016/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
+#include "y2016/control_loops/drivetrain/polydrivetrain_dog_motor_plant.h"
+#include "y2016/control_loops/drivetrain/kalman_drivetrain_motor_plant.h"
+#include "y2016/constants.h"
using ::frc971::control_loops::drivetrain::DrivetrainConfig;
-namespace y2014 {
+namespace y2016 {
namespace control_loops {
const DrivetrainConfig &GetDrivetrainConfig() {
static DrivetrainConfig kDrivetrainConfig{
::frc971::control_loops::drivetrain::ShifterType::HALL_EFFECT_SHIFTER,
- ::y2014::control_loops::drivetrain::MakeDrivetrainLoop,
- ::y2014::control_loops::drivetrain::MakeVelocityDrivetrainLoop,
- ::y2014::control_loops::drivetrain::MakeKFDrivetrainLoop,
+ ::y2016::control_loops::drivetrain::MakeDrivetrainLoop,
+ ::y2016::control_loops::drivetrain::MakeVelocityDrivetrainLoop,
+ ::y2016::control_loops::drivetrain::MakeKFDrivetrainLoop,
- drivetrain::kDt, drivetrain::kStallTorque, drivetrain::kStallCurrent,
- drivetrain::kFreeSpeedRPM, drivetrain::kFreeCurrent, drivetrain::kJ,
- drivetrain::kMass, drivetrain::kRobotRadius, drivetrain::kWheelRadius,
- drivetrain::kR, drivetrain::kV, drivetrain::kT,
+ drivetrain::kDt,
+ drivetrain::kStallTorque,
+ drivetrain::kStallCurrent,
+ drivetrain::kFreeSpeedRPM,
+ drivetrain::kFreeCurrent,
+ drivetrain::kJ,
+ drivetrain::kMass,
+ drivetrain::kRobotRadius,
+ drivetrain::kWheelRadius,
+ drivetrain::kR,
+ drivetrain::kV,
+ drivetrain::kT,
- constants::GetValues().turn_width, constants::GetValues().high_gear_ratio,
+ constants::GetValues().turn_width,
+ constants::GetValues().high_gear_ratio,
constants::GetValues().low_gear_ratio,
- constants::GetValues().left_drive, constants::GetValues().right_drive};
+ constants::GetValues().left_drive,
+ constants::GetValues().right_drive};
return kDrivetrainConfig;
};
} // namespace control_loops
-} // namespace y2014
+} // namespace y2016
diff --git a/y2016/control_loops/drivetrain/drivetrain_base.h b/y2016/control_loops/drivetrain/drivetrain_base.h
index 3a9d70e..816ed21 100644
--- a/y2016/control_loops/drivetrain/drivetrain_base.h
+++ b/y2016/control_loops/drivetrain/drivetrain_base.h
@@ -1,16 +1,16 @@
-#ifndef Y2014_CONTROL_LOOPS_DRIVETRAIN_DRIVETRAIN_BASE_H_
-#define Y2014_CONTROL_LOOPS_DRIVETRAIN_DRIVETRAIN_BASE_H_
+#ifndef Y2016_CONTROL_LOOPS_DRIVETRAIN_DRIVETRAIN_BASE_H_
+#define Y2016_CONTROL_LOOPS_DRIVETRAIN_DRIVETRAIN_BASE_H_
#include "frc971/control_loops/drivetrain/drivetrain_config.h"
using ::frc971::control_loops::drivetrain::DrivetrainConfig;
-namespace y2014 {
+namespace y2016 {
namespace control_loops {
const DrivetrainConfig &GetDrivetrainConfig();
} // namespace control_loops
-} // namespace y2014
+} // namespace y2016
-#endif // Y2014_CONTROL_LOOPS_DRIVETRAIN_DRIVETRAIN_BASE_H_
+#endif // Y2016_CONTROL_LOOPS_DRIVETRAIN_DRIVETRAIN_BASE_H_
diff --git a/y2016/control_loops/drivetrain/drivetrain_main.cc b/y2016/control_loops/drivetrain/drivetrain_main.cc
index 52dafcc..9c678bf 100644
--- a/y2016/control_loops/drivetrain/drivetrain_main.cc
+++ b/y2016/control_loops/drivetrain/drivetrain_main.cc
@@ -1,14 +1,14 @@
#include "aos/linux_code/init.h"
-#include "y2014/control_loops/drivetrain/drivetrain_base.h"
#include "frc971/control_loops/drivetrain/drivetrain.h"
+#include "y2016/control_loops/drivetrain/drivetrain_base.h"
using ::frc971::control_loops::drivetrain::DrivetrainLoop;
int main() {
::aos::Init();
DrivetrainLoop drivetrain =
- DrivetrainLoop(::y2014::control_loops::GetDrivetrainConfig());
+ DrivetrainLoop(::y2016::control_loops::GetDrivetrainConfig());
drivetrain.Run();
::aos::Cleanup();
return 0;
diff --git a/y2016/control_loops/python/BUILD b/y2016/control_loops/python/BUILD
index 84e73a5..b424625 100644
--- a/y2016/control_loops/python/BUILD
+++ b/y2016/control_loops/python/BUILD
@@ -1,4 +1,4 @@
-package(default_visibility = ['//y2014:__subpackages__'])
+package(default_visibility = ['//y2016:__subpackages__'])
py_binary(
name = 'drivetrain',
@@ -37,28 +37,3 @@
'//frc971/control_loops/python:controls',
],
)
-
-py_binary(
- name = 'claw',
- srcs = [
- 'claw.py',
- ],
- deps = [
- ':polydrivetrain_lib',
- '//external:python-gflags',
- '//external:python-glog',
- '//frc971/control_loops/python:controls',
- ]
-)
-
-py_binary(
- name = 'shooter',
- srcs = [
- 'shooter.py',
- ],
- deps = [
- '//external:python-gflags',
- '//external:python-glog',
- '//frc971/control_loops/python:controls',
- ]
-)
diff --git a/y2016/control_loops/python/drivetrain.py b/y2016/control_loops/python/drivetrain.py
index 2a93285..f67662c 100755
--- a/y2016/control_loops/python/drivetrain.py
+++ b/y2016/control_loops/python/drivetrain.py
@@ -14,6 +14,8 @@
gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
+#TODO(constants): All of the constants need to be updated for 2016.
+
class CIM(control_loop.ControlLoop):
def __init__(self):
super(CIM, self).__init__("CIM")
@@ -309,7 +311,7 @@
if len(argv) != 5:
print "Expected .h file name and .cc file name"
else:
- namespaces = ['y2014', 'control_loops', 'drivetrain']
+ namespaces = ['y2016', 'control_loops', 'drivetrain']
dog_loop_writer = control_loop.ControlLoopWriter(
"Drivetrain", [drivetrain_low_low, drivetrain_low_high,
drivetrain_high_low, drivetrain_high_high],
diff --git a/y2016/control_loops/python/polydrivetrain.py b/y2016/control_loops/python/polydrivetrain.py
index 93f3884..eb0890e 100755
--- a/y2016/control_loops/python/polydrivetrain.py
+++ b/y2016/control_loops/python/polydrivetrain.py
@@ -3,7 +3,7 @@
import numpy
import sys
from frc971.control_loops.python import polytope
-from y2014.control_loops.python import drivetrain
+from y2016.control_loops.python import drivetrain
from frc971.control_loops.python import control_loop
from frc971.control_loops.python import controls
from matplotlib import pylab
@@ -413,7 +413,7 @@
if len(argv) != 5:
glog.fatal('Expected .h file name and .cc file name')
else:
- namespaces = ['y2014', 'control_loops', 'drivetrain']
+ namespaces = ['y2016', 'control_loops', 'drivetrain']
dog_loop_writer = control_loop.ControlLoopWriter(
"VelocityDrivetrain", [vdrivetrain.drivetrain_low_low,
vdrivetrain.drivetrain_low_high,