blob: bc1007e6550a8771491da17e7eff3cc87faae0b8 [file] [log] [blame]
James Kuszmaulf01da392023-12-14 11:22:14 -08001load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
Brian Silverman8c374e02015-09-06 23:02:21 -04002
Philipp Schradercc016b32021-12-30 08:59:58 -08003package(default_visibility = ["//visibility:public"])
4
James Kuszmaulf01da392023-12-14 11:22:14 -08005static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -07006 name = "claw_goal_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -08007 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -07008 "claw_goal.fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -08009 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080010 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070011)
12
James Kuszmaulf01da392023-12-14 11:22:14 -080013static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -070014 name = "claw_position_fbs",
15 srcs = [
16 "claw_position.fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080017 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080018 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -080019 deps = [
20 "//frc971/control_loops:control_loops_fbs",
21 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070022)
23
James Kuszmaulf01da392023-12-14 11:22:14 -080024static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -070025 name = "claw_output_fbs",
26 srcs = [
27 "claw_output.fbs",
28 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080029 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070030)
31
James Kuszmaulf01da392023-12-14 11:22:14 -080032static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -070033 name = "claw_status_fbs",
34 srcs = [
35 "claw_status.fbs",
36 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080037 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman8c374e02015-09-06 23:02:21 -040038)
39
Austin Schuhedc317c2015-11-08 14:07:42 -080040genrule(
Austin Schuh55a13dc2019-01-27 22:39:03 -080041 name = "genrule_claw",
42 outs = [
43 "claw_motor_plant.h",
44 "claw_motor_plant.cc",
45 ],
46 cmd = "$(location //y2014/control_loops/python:claw) $(OUTS)",
Philipp Schraderdada1072020-11-24 11:34:46 -080047 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080048 tools = [
49 "//y2014/control_loops/python:claw",
50 ],
51 visibility = ["//visibility:private"],
Austin Schuhedc317c2015-11-08 14:07:42 -080052)
53
Brian Silverman8c374e02015-09-06 23:02:21 -040054cc_library(
Austin Schuh55a13dc2019-01-27 22:39:03 -080055 name = "claw_lib",
56 srcs = [
57 "claw.cc",
58 "claw_motor_plant.cc",
59 ],
60 hdrs = [
61 "claw.h",
62 "claw_motor_plant.h",
63 ],
64 linkopts = [
65 "-lm",
66 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080067 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080068 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070069 ":claw_goal_fbs",
70 ":claw_output_fbs",
71 ":claw_position_fbs",
72 ":claw_status_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080073 "//aos:math",
Austin Schuh55a13dc2019-01-27 22:39:03 -080074 "//frc971/control_loops:coerce_goal",
Austin Schuh0a3c9d42021-07-15 22:36:24 -070075 "//frc971/control_loops:control_loop",
Austin Schuh55a13dc2019-01-27 22:39:03 -080076 "//frc971/control_loops:hall_effect_tracker",
Austin Schuh0a3c9d42021-07-15 22:36:24 -070077 "//frc971/control_loops:polytope",
Austin Schuh55a13dc2019-01-27 22:39:03 -080078 "//frc971/control_loops:state_feedback_loop",
79 "//y2014:constants",
80 ],
Brian Silverman8c374e02015-09-06 23:02:21 -040081)
82
Brian Silverman100534c2015-09-07 15:51:23 -040083cc_test(
Austin Schuh55a13dc2019-01-27 22:39:03 -080084 name = "claw_lib_test",
85 srcs = [
86 "claw_lib_test.cc",
87 ],
Austin Schuhc5fa6d92022-02-25 14:36:28 -080088 data = ["//y2014:aos_config"],
Philipp Schraderdada1072020-11-24 11:34:46 -080089 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080090 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070091 ":claw_goal_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080092 ":claw_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -070093 ":claw_output_fbs",
94 ":claw_position_fbs",
95 ":claw_status_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080096 "//aos/testing:googletest",
Austin Schuh0a3c9d42021-07-15 22:36:24 -070097 "//frc971/control_loops:control_loop_test",
Austin Schuh55a13dc2019-01-27 22:39:03 -080098 "//frc971/control_loops:state_feedback_loop",
99 "//frc971/control_loops:team_number_test_environment",
100 ],
Brian Silverman8c374e02015-09-06 23:02:21 -0400101)
102
103cc_binary(
Austin Schuh55a13dc2019-01-27 22:39:03 -0800104 name = "claw",
105 srcs = [
106 "claw_main.cc",
107 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800108 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -0800109 deps = [
110 ":claw_lib",
111 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700112 "//aos/events:shm_event_loop",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800113 ],
Brian Silverman8c374e02015-09-06 23:02:21 -0400114)