Added y2018 wpilib_interface, and constants
Change-Id: I9499fc4fbb34434372583e8e2a572740b60a4715
diff --git a/y2018/control_loops/python/intake.py b/y2018/control_loops/python/intake.py
index f29d3b5..1a7df6a 100755
--- a/y2018/control_loops/python/intake.py
+++ b/y2018/control_loops/python/intake.py
@@ -344,6 +344,11 @@
intake = Intake('Intake')
loop_writer = control_loop.ControlLoopWriter(
'Intake', [intake], namespaces=namespaces)
+ loop_writer.AddConstant(control_loop.Constant('kGearRatio', '%f', intake.G))
+ loop_writer.AddConstant(
+ control_loop.Constant('kMotorVelocityConstant', '%f', intake.Kv))
+ loop_writer.AddConstant(
+ control_loop.Constant('kFreeSpeed', '%f', intake.free_speed))
loop_writer.Write(argv[1], argv[2])
delayed_intake = DelayedIntake('DelayedIntake')
diff --git a/y2018/control_loops/superstructure/arm/BUILD b/y2018/control_loops/superstructure/arm/BUILD
index 6961dd3..6104568 100644
--- a/y2018/control_loops/superstructure/arm/BUILD
+++ b/y2018/control_loops/superstructure/arm/BUILD
@@ -6,6 +6,7 @@
hdrs = [
"trajectory.h",
],
+ visibility = ["//visibility:public"],
deps = [
":dynamics",
"//frc971/control_loops:dlqr",
@@ -37,6 +38,7 @@
hdrs = [
"dynamics.h",
],
+ visibility = ["//visibility:public"],
deps = [
"//frc971/control_loops:runge_kutta",
"//third_party/eigen",
@@ -86,6 +88,7 @@
hdrs = [
"ekf.h",
],
+ visibility = ["//visibility:public"],
deps = [
":dynamics",
"//frc971/control_loops:jacobian",
diff --git a/y2018/control_loops/superstructure/intake/BUILD b/y2018/control_loops/superstructure/intake/BUILD
new file mode 100644
index 0000000..bb6fec7
--- /dev/null
+++ b/y2018/control_loops/superstructure/intake/BUILD
@@ -0,0 +1,29 @@
+genrule(
+ name = "genrule_intake",
+ outs = [
+ "intake_plant.h",
+ "intake_plant.cc",
+ "intake_delayed_plant.h",
+ "intake_delayed_plant.cc",
+ ],
+ cmd = "$(location //y2018/control_loops/python:intake) $(OUTS)",
+ tools = [
+ "//y2018/control_loops/python:intake",
+ ],
+)
+
+cc_library(
+ name = "intake_plants",
+ srcs = [
+ "intake_delayed_plant.cc",
+ "intake_plant.cc",
+ ],
+ hdrs = [
+ "intake_delayed_plant.h",
+ "intake_plant.h",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//frc971/control_loops:state_feedback_loop",
+ ],
+)
diff --git a/y2018/control_loops/superstructure/superstructure.q b/y2018/control_loops/superstructure/superstructure.q
index 82f66b4..75900fa 100644
--- a/y2018/control_loops/superstructure/superstructure.q
+++ b/y2018/control_loops/superstructure/superstructure.q
@@ -40,30 +40,26 @@
double right_intake_angle;
};
-struct IntakeElasticEncoders {
+struct IntakeElasticSensors {
// Position of the motor end of the series elastic in radians.
- .frc971.IndexPosition motor_encoder;
+ .frc971.PotAndAbsolutePosition motor_position;
// Displacement of the spring in radians.
double spring_angle;
+
+ // False if the beam break sensor isn't triggered, true if the beam breaker is
+ // triggered.
+ bool beam_break;
};
struct IntakePosition {
- // False if the beam breaker isn't triggered, true if the beam breaker is
- // triggered.
- bool left_beam_breaker;
-
- // False if the beam breaker isn't triggered, true if the beam breaker is
- // triggered.
- bool right_beam_breaker;
-
// Values of the series elastic encoders on the left side of the robot from
// the rear perspective in radians.
- IntakeElasticEncoders left;
+ IntakeElasticSensors left;
// Values of the series elastic encoders on the right side of the robot from
// the rear perspective in radians.
- IntakeElasticEncoders right;
+ IntakeElasticSensors right;
};
struct ArmStatus {
@@ -149,7 +145,14 @@
// Clamped (when true) or unclamped (when false) status sent to the
// pneumatic claw on the arm.
- bool claw_output;
+ bool claw_grabbed;
+
+ // If true, release the arm brakes.
+ bool release_arm_brake;
+ // If true, release the hook
+ bool hook_release;
+ // If true, release the forks
+ bool forks_release;
};
queue Goal goal;