bluer-ugv 7.165.1__py3-none-any.whl → 7.176.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bluer_ugv/__init__.py +1 -1
- bluer_ugv/config.env +1 -0
- bluer_ugv/env.py +5 -0
- bluer_ugv/swallow/session/classical/camera/yolo.py +11 -5
- bluer_ugv/swallow/session/classical/keyboard.py +1 -5
- bluer_ugv/swallow/session/classical/setpoint/classes.py +47 -2
- {bluer_ugv-7.165.1.dist-info → bluer_ugv-7.176.1.dist-info}/METADATA +2 -2
- {bluer_ugv-7.165.1.dist-info → bluer_ugv-7.176.1.dist-info}/RECORD +11 -11
- {bluer_ugv-7.165.1.dist-info → bluer_ugv-7.176.1.dist-info}/WHEEL +0 -0
- {bluer_ugv-7.165.1.dist-info → bluer_ugv-7.176.1.dist-info}/licenses/LICENSE +0 -0
- {bluer_ugv-7.165.1.dist-info → bluer_ugv-7.176.1.dist-info}/top_level.txt +0 -0
bluer_ugv/__init__.py
CHANGED
bluer_ugv/config.env
CHANGED
bluer_ugv/env.py
CHANGED
|
@@ -23,6 +23,11 @@ BLUER_UGV_SWALLOW_STEERING_SETPOINT = get_env(
|
|
|
23
23
|
50,
|
|
24
24
|
)
|
|
25
25
|
|
|
26
|
+
BLUER_UGV_SWALLOW_STEERING_YOLO_EXPIRY = get_env(
|
|
27
|
+
"BLUER_UGV_SWALLOW_STEERING_YOLO_EXPIRY",
|
|
28
|
+
0.1,
|
|
29
|
+
)
|
|
30
|
+
|
|
26
31
|
BLUER_UGV_MOUSEPAD_ENABLED = get_env(
|
|
27
32
|
"BLUER_UGV_MOUSEPAD_ENABLED",
|
|
28
33
|
0,
|
|
@@ -48,15 +48,18 @@ class ClassicalYoloCamera(ClassicalCamera):
|
|
|
48
48
|
|
|
49
49
|
assert super().initialize()
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
if not storage.download(
|
|
52
52
|
env.BLUER_UGV_SWALLOW_YOLO_MODEL,
|
|
53
53
|
policy=DownloadPolicy.DOESNT_EXIST,
|
|
54
|
-
)
|
|
54
|
+
):
|
|
55
|
+
logger.error("cannot download the model.")
|
|
56
|
+
|
|
55
57
|
success, self.predictor = YoloPredictor.load(
|
|
56
58
|
object_name=env.BLUER_UGV_SWALLOW_YOLO_MODEL,
|
|
57
59
|
image_size=BLUER_SBC_CAMERA_WIDTH,
|
|
58
60
|
)
|
|
59
|
-
|
|
61
|
+
if not success:
|
|
62
|
+
logger.error("cannot create the predictor.")
|
|
60
63
|
|
|
61
64
|
self.running = True
|
|
62
65
|
self.thread = threading.Thread(target=self.loop, daemon=True)
|
|
@@ -78,9 +81,10 @@ class ClassicalYoloCamera(ClassicalCamera):
|
|
|
78
81
|
|
|
79
82
|
super().cleanup()
|
|
80
83
|
|
|
81
|
-
|
|
84
|
+
if not self.dataset.save(
|
|
82
85
|
verbose=True,
|
|
83
|
-
)
|
|
86
|
+
):
|
|
87
|
+
logger.error("cannot save the dataset.")
|
|
84
88
|
|
|
85
89
|
if self.dataset.empty:
|
|
86
90
|
return
|
|
@@ -156,12 +160,14 @@ class ClassicalYoloCamera(ClassicalCamera):
|
|
|
156
160
|
what="steering",
|
|
157
161
|
value=env.BLUER_UGV_SWALLOW_STEERING_SETPOINT,
|
|
158
162
|
log=True,
|
|
163
|
+
steering_expires_in=env.BLUER_UGV_SWALLOW_STEERING_YOLO_EXPIRY,
|
|
159
164
|
)
|
|
160
165
|
else:
|
|
161
166
|
self.setpoint.put(
|
|
162
167
|
what="steering",
|
|
163
168
|
value=-env.BLUER_UGV_SWALLOW_STEERING_SETPOINT,
|
|
164
169
|
log=True,
|
|
170
|
+
steering_expires_in=env.BLUER_UGV_SWALLOW_STEERING_YOLO_EXPIRY,
|
|
165
171
|
)
|
|
166
172
|
|
|
167
173
|
return True
|
|
@@ -100,11 +100,7 @@ class ClassicalKeyboard:
|
|
|
100
100
|
value=-env.BLUER_UGV_SWALLOW_STEERING_SETPOINT,
|
|
101
101
|
)
|
|
102
102
|
else:
|
|
103
|
-
self.setpoint.
|
|
104
|
-
what="steering",
|
|
105
|
-
value=0,
|
|
106
|
-
log=False,
|
|
107
|
-
)
|
|
103
|
+
self.setpoint.check_steering_expiry()
|
|
108
104
|
|
|
109
105
|
# debug mode
|
|
110
106
|
if keyboard.is_pressed("b"):
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import threading
|
|
2
2
|
from typing import Union, Dict
|
|
3
|
+
import time
|
|
4
|
+
|
|
5
|
+
from bluer_options import string
|
|
3
6
|
|
|
4
7
|
from bluer_ugv.swallow.session.classical.leds import ClassicalLeds
|
|
5
8
|
from bluer_ugv.swallow.session.classical.setpoint.steering import (
|
|
@@ -15,6 +18,9 @@ class ClassicalSetPoint:
|
|
|
15
18
|
):
|
|
16
19
|
self.speed = 0
|
|
17
20
|
self.steering = 0
|
|
21
|
+
|
|
22
|
+
self.steering_expiry = time.time()
|
|
23
|
+
|
|
18
24
|
self.started = False
|
|
19
25
|
|
|
20
26
|
self.leds = leds
|
|
@@ -51,17 +57,49 @@ class ClassicalSetPoint:
|
|
|
51
57
|
logger.error(f"{self.__class__.__name__}.get: {what} not found.")
|
|
52
58
|
return 0
|
|
53
59
|
|
|
60
|
+
def check_steering_expiry(
|
|
61
|
+
self,
|
|
62
|
+
log: bool = True,
|
|
63
|
+
):
|
|
64
|
+
with self._lock:
|
|
65
|
+
if self.steering == 0:
|
|
66
|
+
return
|
|
67
|
+
|
|
68
|
+
if self.steering_expiry > time.time():
|
|
69
|
+
if log:
|
|
70
|
+
logger.info(
|
|
71
|
+
"setpoint will expire in {}.".format(
|
|
72
|
+
string.pretty_duration(
|
|
73
|
+
self.steering_expiry - time.time(),
|
|
74
|
+
largest=True,
|
|
75
|
+
short=True,
|
|
76
|
+
include_ms=True,
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
return
|
|
81
|
+
|
|
82
|
+
if log:
|
|
83
|
+
logger.info("setpoint expired.")
|
|
84
|
+
|
|
85
|
+
self.put(
|
|
86
|
+
what="steering",
|
|
87
|
+
value=0,
|
|
88
|
+
)
|
|
89
|
+
|
|
54
90
|
def put(
|
|
55
91
|
self,
|
|
56
92
|
value: Union[int, bool, Dict[str, Union[int, bool]]],
|
|
57
93
|
what: str = "all",
|
|
58
|
-
log: bool =
|
|
94
|
+
log: bool = True,
|
|
95
|
+
steering_expires_in: float = 0,
|
|
59
96
|
):
|
|
60
97
|
with self._lock:
|
|
61
98
|
if what == "all":
|
|
62
99
|
self.speed = min(100, max(-100, int(value["speed"])))
|
|
63
100
|
self.started = bool(value["started"])
|
|
64
101
|
self.steering = min(100, max(-100, int(value["steering"])))
|
|
102
|
+
self.steering_expiry = time.time() + steering_expires_in
|
|
65
103
|
return
|
|
66
104
|
|
|
67
105
|
if what == "speed":
|
|
@@ -88,11 +126,18 @@ class ClassicalSetPoint:
|
|
|
88
126
|
|
|
89
127
|
if what == "steering":
|
|
90
128
|
self.steering = min(100, max(-100, int(value)))
|
|
129
|
+
self.steering_expiry = time.time() + steering_expires_in
|
|
91
130
|
if log:
|
|
92
131
|
logger.info(
|
|
93
|
-
"{}.put: steering={}".format(
|
|
132
|
+
"{}.put: steering={}, expires in {}".format(
|
|
94
133
|
self.__class__.__name__,
|
|
95
134
|
self.steering,
|
|
135
|
+
string.pretty_duration(
|
|
136
|
+
steering_expires_in,
|
|
137
|
+
largest=True,
|
|
138
|
+
short=True,
|
|
139
|
+
include_ms=True,
|
|
140
|
+
),
|
|
96
141
|
)
|
|
97
142
|
)
|
|
98
143
|
return
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bluer_ugv
|
|
3
|
-
Version: 7.
|
|
3
|
+
Version: 7.176.1
|
|
4
4
|
Summary: 🐬 AI x UGV.
|
|
5
5
|
Home-page: https://github.com/kamangir/bluer-ugv
|
|
6
6
|
Author: Arash Abadpour (Kamangir)
|
|
@@ -64,7 +64,7 @@ pip install bluer_ugv
|
|
|
64
64
|
|
|
65
65
|
[](https://github.com/kamangir/bluer-ugv/actions/workflows/pylint.yml) [](https://github.com/kamangir/bluer-ugv/actions/workflows/pytest.yml) [](https://github.com/kamangir/bluer-ugv/actions/workflows/bashtest.yml) [](https://pypi.org/project/bluer-ugv/) [](https://pypistats.org/packages/bluer-ugv)
|
|
66
66
|
|
|
67
|
-
built by 🌀 [`bluer README`](https://github.com/kamangir/bluer-objects/tree/main/bluer_objects/README), based on 🐬 [`bluer_ugv-7.
|
|
67
|
+
built by 🌀 [`bluer README`](https://github.com/kamangir/bluer-objects/tree/main/bluer_objects/README), based on 🐬 [`bluer_ugv-7.176.1`](https://github.com/kamangir/bluer-ugv).
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
built by 🌀 [`blueness-3.118.1`](https://github.com/kamangir/blueness).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
bluer_ugv/__init__.py,sha256=
|
|
1
|
+
bluer_ugv/__init__.py,sha256=UYHIIcOS1Uq3mpqjQWxqfdx8ZkqOmxUKGvltpQKatp0,288
|
|
2
2
|
bluer_ugv/__main__.py,sha256=77TquqyMca7qHk0XtCixGVyzfW3_9ywnl5oXEPERlls,374
|
|
3
|
-
bluer_ugv/config.env,sha256=
|
|
4
|
-
bluer_ugv/env.py,sha256=
|
|
3
|
+
bluer_ugv/config.env,sha256=psiLmasSe300nOPkLqMurFalZTvNE43zAsBQLEEDp-k,949
|
|
4
|
+
bluer_ugv/env.py,sha256=asv-2OByZzf1c4ta3CHMZQDEcY8cd2WDUOa-_OCNYvU,1757
|
|
5
5
|
bluer_ugv/host.py,sha256=DpdJCvBpUfP9LkZgcH4BcdLGD-WZUvbTsjvMfPtS8uY,292
|
|
6
6
|
bluer_ugv/logger.py,sha256=faY6GL6xfZAzlZ1aJ-MEHuPRJZNx8PYS4jMyY3xuxMw,98
|
|
7
7
|
bluer_ugv/sample.env,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -113,7 +113,7 @@ bluer_ugv/swallow/session/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
|
113
113
|
bluer_ugv/swallow/session/__main__.py,sha256=QFOnflCI6tB_qoG0S4Dpy-L0pW20tFffPPOb96LtypM,636
|
|
114
114
|
bluer_ugv/swallow/session/functions.py,sha256=Jfv7Ab6TEhZMtVv348imNg7JVgPNezFcuovq5r65rAo,666
|
|
115
115
|
bluer_ugv/swallow/session/classical/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
116
|
-
bluer_ugv/swallow/session/classical/keyboard.py,sha256=
|
|
116
|
+
bluer_ugv/swallow/session/classical/keyboard.py,sha256=FdgC2pZWJnLdoAwBppplSaDx4YjlVxiL9Cb9XpsTOuU,4417
|
|
117
117
|
bluer_ugv/swallow/session/classical/leds.py,sha256=ElhE08rm-KLbQ59lJzStLWeNsfoO7tV2fPBMBXCKX_E,2241
|
|
118
118
|
bluer_ugv/swallow/session/classical/mode.py,sha256=6rFe1IIpfijuI7Xd-wcGKhYQ7EdQxG4mYGVliTjS118,117
|
|
119
119
|
bluer_ugv/swallow/session/classical/mousepad.py,sha256=LI7yvmtrZZaGUgPGpxNU7zcPkW8D5ykHlY_O-4H2STs,1871
|
|
@@ -123,7 +123,7 @@ bluer_ugv/swallow/session/classical/camera/__init__.py,sha256=KOehn6qHKj3EMbV5uG
|
|
|
123
123
|
bluer_ugv/swallow/session/classical/camera/generic.py,sha256=ARcuj0Fm76pxu2bmiV2d89ZNNWBPaARn5-oxa_QcT3I,1193
|
|
124
124
|
bluer_ugv/swallow/session/classical/camera/navigation.py,sha256=xSB-ExYjco5Hkpo_dgCLkD1c66il-KMamfsL_E9qXBA,6782
|
|
125
125
|
bluer_ugv/swallow/session/classical/camera/tracking.py,sha256=PLwwH7MK8RudeDNYtzkxnPH9CTJAB6kDE4YI8g6aTzs,3643
|
|
126
|
-
bluer_ugv/swallow/session/classical/camera/yolo.py,sha256=
|
|
126
|
+
bluer_ugv/swallow/session/classical/camera/yolo.py,sha256=DNsJ84m3ULBHu6dBXYuPDpmtSBHjQWXpkdxrgsn7m58,6211
|
|
127
127
|
bluer_ugv/swallow/session/classical/motor/__init__.py,sha256=Ja9pVS6h5wnZiDvJ2IaibLcleQl3inIF_YRJg9VGKlw,323
|
|
128
128
|
bluer_ugv/swallow/session/classical/motor/generic.py,sha256=VzCEqkuil-7ncyv2TxI7NMofIiLhuZGl61Ck3Yog55s,2860
|
|
129
129
|
bluer_ugv/swallow/session/classical/motor/left.py,sha256=eKyEI8CqQiUTTmpNlJrXro90x2_la5KejVLgj_pXkQM,537
|
|
@@ -131,7 +131,7 @@ bluer_ugv/swallow/session/classical/motor/rear.py,sha256=mIBpUxBeiw1me5WY3jbtMya
|
|
|
131
131
|
bluer_ugv/swallow/session/classical/motor/right.py,sha256=3BwCXA6VxxyRBG3rsnRXGviS5gIda14UCqaELGMOJNk,539
|
|
132
132
|
bluer_ugv/swallow/session/classical/motor/steering.py,sha256=-_-6C9cGYFgt_WH3hwTSV8jL5I_qkxc2O45Ck8SlFCo,545
|
|
133
133
|
bluer_ugv/swallow/session/classical/setpoint/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
134
|
-
bluer_ugv/swallow/session/classical/setpoint/classes.py,sha256=
|
|
134
|
+
bluer_ugv/swallow/session/classical/setpoint/classes.py,sha256=a2ACbE4oEdguuOjtrP2bIyuEpl97TK_JCTGir05KZkg,5054
|
|
135
135
|
bluer_ugv/swallow/session/classical/setpoint/steering.py,sha256=yuhW3u9YgZ756h4wyMWJYW9914d8oYRKLga67rTW-Tw,288
|
|
136
136
|
bluer_ugv/swallow/session/classical/ultrasonic_sensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
137
137
|
bluer_ugv/swallow/session/classical/ultrasonic_sensor/__main__.py,sha256=SHCwEk_K9L0BG1X7W1JnnhTnQBGJ--TiN-QuH2Je28E,1732
|
|
@@ -143,8 +143,8 @@ bluer_ugv/swallow/session/classical/ultrasonic_sensor/pack.py,sha256=vMvmay2Gxg8
|
|
|
143
143
|
bluer_ugv/swallow/session/classical/ultrasonic_sensor/review.py,sha256=_iQmec2VSq-ORkTVpXSNJg08hrSz2M1O8LzNZEtoT9U,959
|
|
144
144
|
bluer_ugv/swallow/session/classical/ultrasonic_sensor/sensor.py,sha256=En-J8BRTiR8k9p2CBbW0cOUuw8nctD5DOXDm5uhCNO4,3987
|
|
145
145
|
bluer_ugv/swallow/session/classical/ultrasonic_sensor/testing.py,sha256=RIMHXmLXe1zXLvCNU163ymLI8XM6te9LXuCMnLuulbA,1515
|
|
146
|
-
bluer_ugv-7.
|
|
147
|
-
bluer_ugv-7.
|
|
148
|
-
bluer_ugv-7.
|
|
149
|
-
bluer_ugv-7.
|
|
150
|
-
bluer_ugv-7.
|
|
146
|
+
bluer_ugv-7.176.1.dist-info/licenses/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
|
|
147
|
+
bluer_ugv-7.176.1.dist-info/METADATA,sha256=k1g8sLsODlC3dkN5AtFq7EmfbgxfQ0ePnafD2Zrxtp8,5596
|
|
148
|
+
bluer_ugv-7.176.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
149
|
+
bluer_ugv-7.176.1.dist-info/top_level.txt,sha256=_MlDhFvIPpher9Zs7xyJTHgO2xJJTbfR1dzncz3LQnk,10
|
|
150
|
+
bluer_ugv-7.176.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|