File tree Expand file tree Collapse file tree 7 files changed +115
-35
lines changed Expand file tree Collapse file tree 7 files changed +115
-35
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,32 @@ This repository contains a python application which translates data
4
4
streamed from the Optitrack Motive software (aka NatNet) into LCM
5
5
messages.
6
6
7
- To build:
7
+ ## To build and run locally :
8
8
9
- ``` bazel build //... ```
9
+ ```
10
+ bazel run //src:optitrack_client
11
+ ```
10
12
11
- To run :
13
+ ## To build a wheel :
12
14
13
- ``` bazel run //src:optitrack_client ```
15
+ ```
16
+ bazel build //wheel
17
+ ```
18
+
19
+ Then (within a virtual environment), install the wheel file:
20
+
21
+ ```
22
+ pip install bazel-bin/wheel/optitrack_driver-*-py3-none-any.whl
23
+ ```
24
+
25
+ Then (within the virtual environment), run the program as either:
26
+
27
+ ```
28
+ python -m optitrack.client
29
+ ```
30
+
31
+ or
32
+
33
+ ```
34
+ bin/optitrack_client
35
+ ```
Original file line number Diff line number Diff line change @@ -71,8 +71,9 @@ python_repository(name = "python")
71
71
72
72
http_archive (
73
73
name = "rules_python" ,
74
- url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz" ,
75
- sha256 = "aa96a691d3a8177f3215b14b0edc9641787abaaa30363a080165d06ab65e1161" ,
74
+ url = "https://github.com/bazelbuild/rules_python/releases/download/0.24.0/rules_python-0.24.0.tar.gz" ,
75
+ strip_prefix = "rules_python-0.24.0" ,
76
+ sha256 = "0a8003b044294d7840ac7d9d73eef05d6ceb682d7516781a4ec62eeb34702578" ,
76
77
)
77
78
78
79
load ("@rules_python//python:repositories.bzl" , "py_repositories" )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -20,13 +20,41 @@ LCM_SRCS = [
20
20
"optitrack_skeleton_t.lcm" ,
21
21
]
22
22
23
+ # Also provide the srcs in a package-specific subdir.
24
+ [
25
+ genrule (
26
+ name = "_cp_" + x ,
27
+ srcs = [x ],
28
+ outs = ["optitrack/" + x ],
29
+ cmd = "cp $< $@" ,
30
+ visibility = ["//visibility:private" ],
31
+ )
32
+ for x in LCM_SRCS
33
+ ]
34
+
35
+ filegroup (
36
+ name = "lcm_srcs_with_subdir" ,
37
+ srcs = [
38
+ ":optitrack/" + x
39
+ for x in LCM_SRCS
40
+ ],
41
+ )
42
+
23
43
lcm_cc_library (
24
44
name = "optitrack_lcmtypes" ,
25
45
lcm_package = "optitrack" ,
26
46
lcm_srcs = LCM_SRCS ,
27
47
linkstatic = 1 ,
28
48
)
29
49
50
+ filegroup (
51
+ name = "cxx_srcs" ,
52
+ srcs = [
53
+ ":optitrack/" + x .replace (".lcm" , ".hpp" )
54
+ for x in LCM_SRCS
55
+ ],
56
+ )
57
+
30
58
lcm_py_library (
31
59
name = "py_optitrack_lcmtypes" ,
32
60
lcm_package = "optitrack" ,
@@ -38,3 +66,11 @@ lcm_java_library(
38
66
lcm_package = "optitrack" ,
39
67
lcm_srcs = LCM_SRCS ,
40
68
)
69
+
70
+ filegroup (
71
+ name = "java_srcs" ,
72
+ srcs = [
73
+ ":optitrack/" + x .replace (".lcm" , ".java" )
74
+ for x in LCM_SRCS
75
+ ],
76
+ )
Original file line number Diff line number Diff line change @@ -132,6 +132,7 @@ cc_binary(
132
132
cc_binary (
133
133
name = "lcm-gen" ,
134
134
srcs = [
135
+ "lcm/lcm_version.h" ,
135
136
"lcmgen/emit_c.c" ,
136
137
"lcmgen/emit_cpp.c" ,
137
138
"lcmgen/emit_csharp.c" ,
@@ -150,7 +151,6 @@ cc_binary(
150
151
copts = LCM_COPTS ,
151
152
includes = ["." ],
152
153
deps = [
153
- ":lcm" ,
154
154
"@glib" ,
155
155
],
156
156
)
Original file line number Diff line number Diff line change
1
+ VERSION = "0.0.20230714"
Original file line number Diff line number Diff line change
1
+ # -*- python -*-
2
+ # This file contains rules for the Bazel build system; see https://bazel.build.
3
+
4
+ load ("//:version.bzl" , "VERSION" )
5
+ load ("@rules_python//python:packaging.bzl" , "py_wheel" )
6
+
7
+ licenses (["notice" ])
8
+
9
+ package (default_visibility = ["//visibility:private" ])
10
+
11
+ genrule (
12
+ name = "_cp_client" ,
13
+ srcs = ["//src:optitrack_client.py" ],
14
+ outs = ["optitrack/client.py" ],
15
+ cmd = "cp $< $@" ,
16
+ )
17
+
18
+ py_library (
19
+ name = "client" ,
20
+ srcs = [":optitrack/client.py" ],
21
+ )
22
+
23
+ py_wheel (
24
+ name = "wheel" ,
25
+ visibility = ["//visibility:public" ],
26
+ distribution = "optitrack_driver" ,
27
+ version = VERSION ,
28
+ summary = "Translates data streamed from the Optitrack Motive software into LCM messages." ,
29
+ requires = [
30
+ "lcm" ,
31
+ ],
32
+ entry_points = {
33
+ "console_scripts" : [
34
+ "optitrack_client = optitrack.client:main" ,
35
+ ],
36
+ },
37
+ deps = [
38
+ ":client" ,
39
+ "//lcmtypes:cxx_srcs" ,
40
+ "//lcmtypes:java_srcs" ,
41
+ "//lcmtypes:lcm_srcs_with_subdir" ,
42
+ "//lcmtypes:py_optitrack_lcmtypes" ,
43
+ ],
44
+ strip_path_prefixes = [
45
+ "lcmtypes/" ,
46
+ "wheel/" ,
47
+ ],
48
+ )
You can’t perform that action at this time.
0 commit comments