Add pivot joint codegen
Signed-off-by: Nathan Leong <100028864@mvla.net>
Change-Id: I8b035349e44430218623c4d0dc883c2b06a605c2
diff --git a/y2023_bot3/control_loops/superstructure/pivot_joint/BUILD b/y2023_bot3/control_loops/superstructure/pivot_joint/BUILD
new file mode 100644
index 0000000..ae413ab
--- /dev/null
+++ b/y2023_bot3/control_loops/superstructure/pivot_joint/BUILD
@@ -0,0 +1,34 @@
+package(default_visibility = ["//y2023_bot3:__subpackages__"])
+
+genrule(
+ name = "genrule_pivot_joint",
+ outs = [
+ "pivot_joint_plant.h",
+ "pivot_joint_plant.cc",
+ "integral_pivot_joint_plant.h",
+ "integral_pivot_joint_plant.cc",
+ ],
+ cmd = "$(location //y2023_bot3/control_loops/python:pivot_joint) $(OUTS)",
+ target_compatible_with = ["@platforms//os:linux"],
+ tools = [
+ "//y2023_bot3/control_loops/python:pivot_joint",
+ ],
+)
+
+cc_library(
+ name = "pivot_joint_plants",
+ srcs = [
+ "integral_pivot_joint_plant.cc",
+ "pivot_joint_plant.cc",
+ ],
+ hdrs = [
+ "integral_pivot_joint_plant.h",
+ "pivot_joint_plant.h",
+ ],
+ target_compatible_with = ["@platforms//os:linux"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//frc971/control_loops:hybrid_state_feedback_loop",
+ "//frc971/control_loops:state_feedback_loop",
+ ],
+)
diff --git a/y2023_bot3/control_loops/superstructure/superstructure.cc b/y2023_bot3/control_loops/superstructure/superstructure.cc
index 4bc6a5d..3e88a6c 100644
--- a/y2023_bot3/control_loops/superstructure/superstructure.cc
+++ b/y2023_bot3/control_loops/superstructure/superstructure.cc
@@ -15,7 +15,6 @@
using ::aos::monotonic_clock;
-using frc971::control_loops::AbsoluteEncoderProfiledJointStatus;
using frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus;
using frc971::control_loops::RelativeEncoderProfiledJointStatus;
@@ -53,6 +52,7 @@
}
Status::Builder status_builder = status->MakeBuilder<Status>();
+
status_builder.add_zeroed(true);
status_builder.add_end_effector_state(end_effector_.state());
diff --git a/y2023_bot3/control_loops/superstructure/superstructure.h b/y2023_bot3/control_loops/superstructure/superstructure.h
index 808ff3b..212ced8 100644
--- a/y2023_bot3/control_loops/superstructure/superstructure.h
+++ b/y2023_bot3/control_loops/superstructure/superstructure.h
@@ -22,6 +22,11 @@
class Superstructure
: public ::frc971::controls::ControlLoop<Goal, Position, Status, Output> {
public:
+ using PotAndAbsoluteEncoderSubsystem =
+ ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem<
+ ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator,
+ ::frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus>;
+
explicit Superstructure(::aos::EventLoop *event_loop,
std::shared_ptr<const constants::Values> values,
const ::std::string &name = "/superstructure");