blob: a79dc7819eda280c65ce4f748dca98720cdcf8b8 [file] [log] [blame]
Austin Schuh55a13dc2019-01-27 22:39:03 -08001package(default_visibility = ["//visibility:public"])
Brian Silverman8c374e02015-09-06 23:02:21 -04002
Alex Perrycb7da4b2019-08-28 19:35:56 -07003load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
Brian Silverman8c374e02015-09-06 23:02:21 -04004
Alex Perrycb7da4b2019-08-28 19:35:56 -07005flatbuffer_cc_library(
6 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 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070010 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -080011 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070012)
13
14flatbuffer_cc_library(
15 name = "claw_position_fbs",
16 srcs = [
17 "claw_position.fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080018 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070019 gen_reflections = 1,
20 includes = [
21 "//frc971/control_loops:control_loops_fbs_includes",
22 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080023 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070024)
25
26flatbuffer_cc_library(
27 name = "claw_output_fbs",
28 srcs = [
29 "claw_output.fbs",
30 ],
31 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -080032 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070033)
34
35flatbuffer_cc_library(
36 name = "claw_status_fbs",
37 srcs = [
38 "claw_status.fbs",
39 ],
40 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -080041 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman8c374e02015-09-06 23:02:21 -040042)
43
Austin Schuhedc317c2015-11-08 14:07:42 -080044genrule(
Austin Schuh55a13dc2019-01-27 22:39:03 -080045 name = "genrule_claw",
46 outs = [
47 "claw_motor_plant.h",
48 "claw_motor_plant.cc",
49 ],
50 cmd = "$(location //y2014/control_loops/python:claw) $(OUTS)",
Philipp Schraderdada1072020-11-24 11:34:46 -080051 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080052 tools = [
53 "//y2014/control_loops/python:claw",
54 ],
55 visibility = ["//visibility:private"],
Austin Schuhedc317c2015-11-08 14:07:42 -080056)
57
Brian Silverman8c374e02015-09-06 23:02:21 -040058cc_library(
Austin Schuh55a13dc2019-01-27 22:39:03 -080059 name = "claw_lib",
60 srcs = [
61 "claw.cc",
62 "claw_motor_plant.cc",
63 ],
64 hdrs = [
65 "claw.h",
66 "claw_motor_plant.h",
67 ],
68 linkopts = [
69 "-lm",
70 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080071 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080072 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070073 ":claw_goal_fbs",
74 ":claw_output_fbs",
75 ":claw_position_fbs",
76 ":claw_status_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080077 "//aos:math",
James Kuszmaul61750662021-06-21 21:32:33 -070078 "//frc971/control_loops:control_loop",
79 "//frc971/control_loops:polytope",
Austin Schuh55a13dc2019-01-27 22:39:03 -080080 "//frc971/control_loops:coerce_goal",
81 "//frc971/control_loops:hall_effect_tracker",
82 "//frc971/control_loops:state_feedback_loop",
83 "//y2014:constants",
84 ],
Brian Silverman8c374e02015-09-06 23:02:21 -040085)
86
Brian Silverman100534c2015-09-07 15:51:23 -040087cc_test(
Austin Schuh55a13dc2019-01-27 22:39:03 -080088 name = "claw_lib_test",
89 srcs = [
90 "claw_lib_test.cc",
91 ],
Austin Schuh14d7d3d2020-09-10 18:14:36 -070092 data = ["//y2014:config"],
Philipp Schraderdada1072020-11-24 11:34:46 -080093 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080094 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070095 ":claw_goal_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080096 ":claw_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -070097 ":claw_output_fbs",
98 ":claw_position_fbs",
99 ":claw_status_fbs",
James Kuszmaul61750662021-06-21 21:32:33 -0700100 "//frc971/control_loops:control_loop_test",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800101 "//aos/testing:googletest",
102 "//frc971/control_loops:state_feedback_loop",
103 "//frc971/control_loops:team_number_test_environment",
104 ],
Brian Silverman8c374e02015-09-06 23:02:21 -0400105)
106
107cc_binary(
Austin Schuh55a13dc2019-01-27 22:39:03 -0800108 name = "claw",
109 srcs = [
110 "claw_main.cc",
111 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800112 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -0800113 deps = [
114 ":claw_lib",
115 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700116 "//aos/events:shm_event_loop",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800117 ],
Brian Silverman8c374e02015-09-06 23:02:21 -0400118)