blob: 670dd760f6a6c50edc932327653228811e27065a [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,
11)
12
13flatbuffer_cc_library(
14 name = "claw_position_fbs",
15 srcs = [
16 "claw_position.fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080017 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070018 gen_reflections = 1,
19 includes = [
20 "//frc971/control_loops:control_loops_fbs_includes",
21 ],
22)
23
24flatbuffer_cc_library(
25 name = "claw_output_fbs",
26 srcs = [
27 "claw_output.fbs",
28 ],
29 gen_reflections = 1,
30)
31
32flatbuffer_cc_library(
33 name = "claw_status_fbs",
34 srcs = [
35 "claw_status.fbs",
36 ],
37 gen_reflections = 1,
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)",
47 tools = [
48 "//y2014/control_loops/python:claw",
49 ],
50 visibility = ["//visibility:private"],
Austin Schuhedc317c2015-11-08 14:07:42 -080051)
52
Brian Silverman8c374e02015-09-06 23:02:21 -040053cc_library(
Austin Schuh55a13dc2019-01-27 22:39:03 -080054 name = "claw_lib",
55 srcs = [
56 "claw.cc",
57 "claw_motor_plant.cc",
58 ],
59 hdrs = [
60 "claw.h",
61 "claw_motor_plant.h",
62 ],
63 linkopts = [
64 "-lm",
65 ],
66 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070067 ":claw_goal_fbs",
68 ":claw_output_fbs",
69 ":claw_position_fbs",
70 ":claw_status_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080071 "//aos:math",
72 "//aos/controls:control_loop",
73 "//aos/controls:polytope",
Austin Schuh55a13dc2019-01-27 22:39:03 -080074 "//frc971/control_loops:coerce_goal",
75 "//frc971/control_loops:hall_effect_tracker",
76 "//frc971/control_loops:state_feedback_loop",
77 "//y2014:constants",
78 ],
Brian Silverman8c374e02015-09-06 23:02:21 -040079)
80
Brian Silverman100534c2015-09-07 15:51:23 -040081cc_test(
Austin Schuh55a13dc2019-01-27 22:39:03 -080082 name = "claw_lib_test",
83 srcs = [
84 "claw_lib_test.cc",
85 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070086 data = ["//y2014:config.json"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080087 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070088 ":claw_goal_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080089 ":claw_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -070090 ":claw_output_fbs",
91 ":claw_position_fbs",
92 ":claw_status_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080093 "//aos/controls:control_loop_test",
94 "//aos/testing:googletest",
95 "//frc971/control_loops:state_feedback_loop",
96 "//frc971/control_loops:team_number_test_environment",
97 ],
Brian Silverman8c374e02015-09-06 23:02:21 -040098)
99
100cc_binary(
Austin Schuh55a13dc2019-01-27 22:39:03 -0800101 name = "claw",
102 srcs = [
103 "claw_main.cc",
104 ],
105 deps = [
106 ":claw_lib",
107 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700108 "//aos/events:shm_event_loop",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800109 ],
Brian Silverman8c374e02015-09-06 23:02:21 -0400110)