Brian Silverman | 2ccf8c5 | 2016-03-15 00:22:26 -0400 | [diff] [blame] | 1 | load('/tools/build_rules/protobuf', 'proto_cc_library') |
| 2 | load('/aos/build/queues', 'queue_library') |
| 3 | |
| 4 | queue_library( |
| 5 | name = 'vision_queue', |
Austin Schuh | c65b0ea | 2016-03-16 22:09:19 -0700 | [diff] [blame] | 6 | visibility = ['//visibility:public'], |
Brian Silverman | 2ccf8c5 | 2016-03-15 00:22:26 -0400 | [diff] [blame] | 7 | srcs = [ |
| 8 | 'vision.q', |
| 9 | ], |
| 10 | ) |
| 11 | |
| 12 | proto_cc_library( |
| 13 | name = 'vision_data', |
| 14 | src = 'vision_data.proto', |
| 15 | ) |
| 16 | |
| 17 | proto_cc_library( |
| 18 | name = 'calibration', |
| 19 | src = 'calibration.proto', |
| 20 | ) |
| 21 | |
| 22 | _calibration_values_embedded_before = ''' |
| 23 | #include "y2016/vision/stereo_geometry.h" |
| 24 | |
| 25 | #include <string> |
| 26 | |
| 27 | #include "third_party/protobuf/src/google/protobuf/text_format.h" |
| 28 | |
| 29 | namespace y2016 { |
| 30 | namespace vision { |
| 31 | namespace { |
| 32 | |
| 33 | const ::std::string kEmbeddedContents =''' |
| 34 | |
| 35 | _calibration_values_embedded_after = '''; |
| 36 | |
| 37 | } // namespace |
| 38 | |
| 39 | CalibrationFile EmbeddedCalibrationFile() { |
| 40 | CalibrationFile r; |
| 41 | ::google::protobuf::TextFormat::ParseFromString(kEmbeddedContents, &r); |
| 42 | return r; |
| 43 | } |
| 44 | |
| 45 | } // namespace vision |
| 46 | } // namespace y2016''' |
| 47 | |
| 48 | genrule( |
| 49 | name = 'embed_calibration_pb', |
| 50 | srcs = [ |
| 51 | 'calibration.pb', |
| 52 | ], |
| 53 | outs = [ |
| 54 | 'stereo_geometry_embedded.cc', |
| 55 | ], |
| 56 | cmd = '\n'.join([ |
| 57 | 'echo \'%s\' > $@' % _calibration_values_embedded_before, |
| 58 | 'cat $(location :calibration.pb) | sed \'s/"/\\\\"/g ; s/^/"/g ; s/$$/\\\\n"/g\' >> $@', |
| 59 | 'echo \'%s\' >> $@' % _calibration_values_embedded_after, |
| 60 | ]), |
| 61 | ) |
| 62 | |
| 63 | cc_library( |
| 64 | name = 'stereo_geometry', |
| 65 | hdrs = [ |
| 66 | 'stereo_geometry.h', |
| 67 | ], |
| 68 | srcs = [ |
| 69 | 'stereo_geometry.cc', |
| 70 | 'stereo_geometry_embedded.cc', |
| 71 | ], |
| 72 | deps = [ |
| 73 | ':calibration', |
| 74 | '//aos/common/logging', |
| 75 | '//aos/vision/math:vector', |
| 76 | ], |
| 77 | ) |
| 78 | |
| 79 | cc_binary( |
| 80 | name = 'target_receiver', |
| 81 | srcs = [ |
| 82 | 'target_receiver.cc', |
| 83 | ], |
Austin Schuh | c65b0ea | 2016-03-16 22:09:19 -0700 | [diff] [blame] | 84 | visibility = ['//visibility:public'], |
Brian Silverman | 2ccf8c5 | 2016-03-15 00:22:26 -0400 | [diff] [blame] | 85 | deps = [ |
| 86 | '//aos/common/logging', |
| 87 | '//aos/common/logging:queue_logging', |
| 88 | '//aos/linux_code:init', |
| 89 | '//aos/common:time', |
| 90 | '//aos/vision/events:udp', |
| 91 | ':vision_queue', |
| 92 | ':vision_data', |
| 93 | ':stereo_geometry', |
| 94 | '//y2016:constants', |
Brian Silverman | bc83118 | 2016-04-16 02:06:09 -0400 | [diff] [blame] | 95 | '//frc971/control_loops/drivetrain:drivetrain_queue', |
| 96 | '//aos/common:mutex', |
Brian Silverman | 2ccf8c5 | 2016-03-15 00:22:26 -0400 | [diff] [blame] | 97 | ], |
| 98 | ) |