remotivelabs-cli 0.0.9__py3-none-any.whl → 0.0.11__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.
- cli/broker/scripting.py +19 -2
- cli/connect/protopie/protopie.py +1 -4
- {remotivelabs_cli-0.0.9.dist-info → remotivelabs_cli-0.0.11.dist-info}/METADATA +1 -1
- {remotivelabs_cli-0.0.9.dist-info → remotivelabs_cli-0.0.11.dist-info}/RECORD +7 -8
- cli/tools/can/decoders.py +0 -162
- {remotivelabs_cli-0.0.9.dist-info → remotivelabs_cli-0.0.11.dist-info}/LICENSE +0 -0
- {remotivelabs_cli-0.0.9.dist-info → remotivelabs_cli-0.0.11.dist-info}/WHEEL +0 -0
- {remotivelabs_cli-0.0.9.dist-info → remotivelabs_cli-0.0.11.dist-info}/entry_points.txt +0 -0
cli/broker/scripting.py
CHANGED
@@ -33,7 +33,7 @@ def new_script(
|
|
33
33
|
def to_subscribable_signal(sig: str) -> tuple[str, str]:
|
34
34
|
arr = sig.split(":")
|
35
35
|
if len(arr) != 2:
|
36
|
-
ErrorPrinter.print_hint(f"--signal must have format namespace:signal ({sig})")
|
36
|
+
ErrorPrinter.print_hint(f"--input-signal must have format namespace:signal ({sig})")
|
37
37
|
exit(1)
|
38
38
|
return arr[0], arr[1]
|
39
39
|
|
@@ -53,6 +53,9 @@ def new_script(
|
|
53
53
|
|
54
54
|
template = Template(
|
55
55
|
"""
|
56
|
+
--
|
57
|
+
-- Docs available at https://docs.remotivelabs.com/docs/remotive-broker/scripted_signals
|
58
|
+
--
|
56
59
|
|
57
60
|
local local_signals = {$local_signals
|
58
61
|
}
|
@@ -63,10 +66,24 @@ function input_signals()
|
|
63
66
|
end
|
64
67
|
|
65
68
|
-- Provided parameters are used for populating metadata when listing signals.
|
66
|
-
function
|
69
|
+
function output_signal()
|
67
70
|
return "$output_signal"
|
68
71
|
end
|
69
72
|
|
73
|
+
local local_frequency_hz = 0
|
74
|
+
|
75
|
+
-- Required, declare what frequency you like to get "timer" invoked. 0 means no calls to "timer".
|
76
|
+
function timer_frequency_hz()
|
77
|
+
return local_frequency_hz
|
78
|
+
end
|
79
|
+
|
80
|
+
-- Invoked with the frequecy returned by "timer_frequency_hz".
|
81
|
+
-- @param system_timestamp_us: system time stamp.
|
82
|
+
function timer(system_timestamp_us)
|
83
|
+
return return_value_or_bytes("your value")
|
84
|
+
end
|
85
|
+
|
86
|
+
|
70
87
|
-- Invoked when ANY signal declared in "local_signals" arrive
|
71
88
|
-- @param signals_timestamp_us: signal time stamp
|
72
89
|
-- @param system_timestamp_us
|
cli/connect/protopie/protopie.py
CHANGED
@@ -37,10 +37,7 @@ def on_connect():
|
|
37
37
|
is_connected = True
|
38
38
|
|
39
39
|
|
40
|
-
|
41
|
-
def on_message(data):
|
42
|
-
# Not used but possible. Could be used to send commands like start, pause, stop
|
43
|
-
print(f"message from connect: {data}")
|
40
|
+
# TODO - Receive message from ProtoPie connect
|
44
41
|
|
45
42
|
|
46
43
|
def get_signals_and_namespaces(
|
@@ -7,7 +7,7 @@ cli/broker/lib/__about__.py,sha256=xnZ5V6ZcHW9dhWLWdMzVjYJbEnMKpeXm0_S_mbNzypE,1
|
|
7
7
|
cli/broker/lib/broker.py,sha256=65Y2MqwPNk0XGv284gKkIJuMeFMYcMdBFRYizzIm_3w,19713
|
8
8
|
cli/broker/playback.py,sha256=oOfC8Jn4Ib-nc9T6ob_uNXZSeCWfft7MrMQPafH4U2I,4846
|
9
9
|
cli/broker/record.py,sha256=gEvo3myHbIl6UyXzhJE741NiwRrFf7doBg6HXzzp5z0,1382
|
10
|
-
cli/broker/scripting.py,sha256=
|
10
|
+
cli/broker/scripting.py,sha256=sLDtuktWsVk0fJ3RW4kYyh-_YAVJP3VM0xFIQR499Oo,3392
|
11
11
|
cli/broker/signals.py,sha256=vQAxnxNYzrtuSTGua5MUXWbacF9mZ6WnLSq7lRmUVUQ,6792
|
12
12
|
cli/cloud/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
13
13
|
cli/cloud/auth.py,sha256=xi47cQWjs6q7Kje4XUbTqEk_BgG3NJ1gMOYPU-_4tgw,3470
|
@@ -23,7 +23,7 @@ cli/cloud/service_account_tokens.py,sha256=7vjoMd6Xq7orWCUP7TVUVa86JA0OiX8O10NZc
|
|
23
23
|
cli/cloud/service_accounts.py,sha256=GCYdYPnP5uWVsg1bTIS67CmoPWDng5dupJHmlThrJ80,1606
|
24
24
|
cli/connect/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
25
25
|
cli/connect/connect.py,sha256=CAPh8d-pqCTQrPVZiX5j3J9lT-NdzGYp519eJdPmvXY,3805
|
26
|
-
cli/connect/protopie/protopie.py,sha256=
|
26
|
+
cli/connect/protopie/protopie.py,sha256=aMF7rQHX4xLN9ylijJB1SMNlB1IIl14YBLw6oLweWH4,5646
|
27
27
|
cli/errors.py,sha256=sOjYasWbwqu2IcK4MvrG4ddpQ7idLGxiFYOxjhdsahM,1319
|
28
28
|
cli/remotive.py,sha256=KKahzVZACa3MIBqt2lZDiSsDOTmoZIdNeKex8LJR8ZQ,1645
|
29
29
|
cli/requirements.txt,sha256=Tjpv2HSAPemgKC-eJbwDw-gvAdklfJ18LixRcwzvQIU,78
|
@@ -31,10 +31,9 @@ cli/settings.py,sha256=r0txIWXNTH1veGu97J84PiYEDBsAphkXYTN64n_C-qw,792
|
|
31
31
|
cli/tools/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
32
32
|
cli/tools/can/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
33
33
|
cli/tools/can/can.py,sha256=sl95utXl2gjXV8cN0AVzJut95oeWzKn7hgVTQn136V0,2407
|
34
|
-
cli/tools/can/decoders.py,sha256=DTosl5BByUPdK-sPPtWTj4hHwhbpKB9qchdvM9Rzxjc,6203
|
35
34
|
cli/tools/tools.py,sha256=LwQdWMcJ19pCyKUsVfSB2B3R6ui61NxxFWP0Nrnd5Jk,198
|
36
|
-
remotivelabs_cli-0.0.
|
37
|
-
remotivelabs_cli-0.0.
|
38
|
-
remotivelabs_cli-0.0.
|
39
|
-
remotivelabs_cli-0.0.
|
40
|
-
remotivelabs_cli-0.0.
|
35
|
+
remotivelabs_cli-0.0.11.dist-info/LICENSE,sha256=qDPP_yfuv1fF-u7EfexN-cN3M8aFgGVndGhGLovLKz0,608
|
36
|
+
remotivelabs_cli-0.0.11.dist-info/METADATA,sha256=QJTlnudIpCSpyyv41IHMd7xvRJLZq9KrkQ2qLyQtx88,1224
|
37
|
+
remotivelabs_cli-0.0.11.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
38
|
+
remotivelabs_cli-0.0.11.dist-info/entry_points.txt,sha256=lvDhPgagLqW_KTnLPCwKSqfYlEp-1uYVosRiPjsVj10,45
|
39
|
+
remotivelabs_cli-0.0.11.dist-info/RECORD,,
|
cli/tools/can/decoders.py
DELETED
@@ -1,162 +0,0 @@
|
|
1
|
-
import os.path
|
2
|
-
from typing import Union
|
3
|
-
|
4
|
-
import can
|
5
|
-
import cantools
|
6
|
-
from can import Message as CanMessage
|
7
|
-
from cantools.database import Database, Message
|
8
|
-
from cantools.database.errors import DecodeError
|
9
|
-
from cantools.database.namedsignalvalue import NamedSignalValue
|
10
|
-
from cantools.typechecking import DecodeResultType
|
11
|
-
|
12
|
-
|
13
|
-
class CanDecoder:
|
14
|
-
def __init__(self, signal_db_path: str, namespace: str = None):
|
15
|
-
self.signal_db: Union[Database, Database] = cantools.database.load_file(signal_db_path)
|
16
|
-
self.signal_db_path = signal_db_path
|
17
|
-
self.failed_arb_id = list()
|
18
|
-
self.successful_arb_id = list()
|
19
|
-
self.namespace = namespace
|
20
|
-
|
21
|
-
def decode_log_file_legacy(self, filename: str):
|
22
|
-
file1 = open(filename, "r")
|
23
|
-
Lines = file1.readlines()
|
24
|
-
return list(map(self.decode_log_line, Lines))
|
25
|
-
|
26
|
-
def decode_log_file(self, filename):
|
27
|
-
with can.LogReader(filename) as reader:
|
28
|
-
return list(map(self.__do_decode, reader))
|
29
|
-
|
30
|
-
def decode_log_line(self, line: str):
|
31
|
-
try:
|
32
|
-
time_ns_rawframe = line.split(" ")
|
33
|
-
ts = float(time_ns_rawframe[0][1:18])
|
34
|
-
ns = time_ns_rawframe[1]
|
35
|
-
rawframe = time_ns_rawframe[2]
|
36
|
-
arbid_and_data = rawframe.split("#")
|
37
|
-
arb_id = int(arbid_and_data[0], 16)
|
38
|
-
|
39
|
-
frame_infos = list(filter(lambda m: m.frame_id == arb_id, self.signal_db.messages))
|
40
|
-
|
41
|
-
if len(frame_infos) == 0:
|
42
|
-
return None
|
43
|
-
|
44
|
-
# message('PHEV_Battery_Data1_HS3', 0x3d4, False, 8, None)
|
45
|
-
frame_info: Message = frame_infos[0]
|
46
|
-
|
47
|
-
data = bytes.fromhex(arbid_and_data[1])
|
48
|
-
# print(frame)
|
49
|
-
# print(frame.name)
|
50
|
-
except Exception as e:
|
51
|
-
print(e)
|
52
|
-
return None
|
53
|
-
|
54
|
-
try:
|
55
|
-
# {'BattTracSoc_Pc_Dpltd': 4.5}
|
56
|
-
signal: DecodeResultType = self.signal_db.decode_message(arb_id, data)
|
57
|
-
# if frame_info.name == 'TransGearData_HS1':
|
58
|
-
# for s in list(signal):
|
59
|
-
# print(f"signal {s} - {signal[s].value} - {type(signal[s])}")
|
60
|
-
|
61
|
-
def signal_value(some_signal_value):
|
62
|
-
# NamedSignalValue contains name: int pair where "name" is the
|
63
|
-
# explanation or str version of the int from my understanding
|
64
|
-
# Sample from dbc file
|
65
|
-
#
|
66
|
-
# SignalName
|
67
|
-
# 0 AutonomousBrkPedalMove
|
68
|
-
# 1 NoAutonomousBrkPdlMovement
|
69
|
-
# 2 DriverApplyingBrakePedal
|
70
|
-
# 3 Unknown
|
71
|
-
if isinstance(some_signal_value, NamedSignalValue):
|
72
|
-
return some_signal_value.value
|
73
|
-
else:
|
74
|
-
return some_signal_value
|
75
|
-
|
76
|
-
all_signals = map(lambda m: {"type": type(signal[m]).__name__, "name": m, "value": signal_value(signal[m])}, list(signal))
|
77
|
-
numeric_signals_kv = list(filter(lambda m: type(m["value"]) is float or type(m["value"]) is int, all_signals))
|
78
|
-
|
79
|
-
self.successful_arb_id.append(arb_id)
|
80
|
-
return {
|
81
|
-
"name": frame_info.name,
|
82
|
-
"timestamp": ts,
|
83
|
-
"signal_db": os.path.basename(self.signal_db_path),
|
84
|
-
"namespace": ns,
|
85
|
-
"signals": list(numeric_signals_kv),
|
86
|
-
}
|
87
|
-
|
88
|
-
except KeyError as e:
|
89
|
-
print(e)
|
90
|
-
# print(f"Failed to parse msg for {arb_id} {str(e)}")
|
91
|
-
self.failed_arb_id.append(arb_id)
|
92
|
-
return
|
93
|
-
|
94
|
-
except Exception as e:
|
95
|
-
print(e)
|
96
|
-
self.failed_arb_id.append(arb_id)
|
97
|
-
return
|
98
|
-
# print(f"EX: Failed to parse msg for {arb_id} + {str(ex)}")
|
99
|
-
# print(str(e))
|
100
|
-
|
101
|
-
def decode_asc_file(self, filename, **kwargs):
|
102
|
-
logfile = os.path.join(os.path.dirname(__file__), "data", filename)
|
103
|
-
print(logfile)
|
104
|
-
|
105
|
-
with can.ASCReader(filename, "hex", False, **kwargs) as reader:
|
106
|
-
return list(map(self.__do_decode, reader))
|
107
|
-
|
108
|
-
def asc2blf(self, asc_file, blf_file, **kwargs):
|
109
|
-
with open(asc_file, "r") as f_in:
|
110
|
-
log_in = can.io.ASCReader(f_in, "hex", False)
|
111
|
-
|
112
|
-
with open(blf_file, "wb") as f_out:
|
113
|
-
log_out = can.io.BLFWriter(f_out)
|
114
|
-
for msg in log_in:
|
115
|
-
log_out.on_message_received(msg)
|
116
|
-
log_out.stop()
|
117
|
-
|
118
|
-
def log2asc(self, log_file, asc_file, **kwargs):
|
119
|
-
with can.LogReader(log_file) as log_in:
|
120
|
-
with open(asc_file, "w") as f_out:
|
121
|
-
log_out = can.io.ASCWriter(f_out)
|
122
|
-
for msg in log_in:
|
123
|
-
log_out.on_message_received(msg)
|
124
|
-
log_out.stop()
|
125
|
-
|
126
|
-
def decode_blf_file(self, filename, **kwargs):
|
127
|
-
logfile = os.path.join(os.path.dirname(__file__), "data", filename)
|
128
|
-
print(logfile)
|
129
|
-
with can.BLFReader(filename, **kwargs) as reader:
|
130
|
-
return list(map(self.__do_decode, reader))
|
131
|
-
|
132
|
-
def __do_decode(self, mesg: CanMessage):
|
133
|
-
try:
|
134
|
-
signal: DecodeResultType = self.signal_db.decode_message(mesg.arbitration_id, mesg.data)
|
135
|
-
message = self.signal_db.get_message_by_frame_id(mesg.arbitration_id)
|
136
|
-
numeric_signals_kv = list(
|
137
|
-
filter(
|
138
|
-
lambda m: type(m["value"]) is float or type(m["value"]) is int,
|
139
|
-
map(lambda m: {"name": m, "value": signal[m]}, list(signal)),
|
140
|
-
)
|
141
|
-
)
|
142
|
-
self.successful_arb_id.append(mesg.arbitration_id)
|
143
|
-
return {
|
144
|
-
"name": message.name,
|
145
|
-
"timestamp": mesg.timestamp,
|
146
|
-
"signal_db": os.path.basename(self.signal_db_path),
|
147
|
-
"namespace": self.namespace,
|
148
|
-
"signals": list(numeric_signals_kv),
|
149
|
-
}
|
150
|
-
except KeyError:
|
151
|
-
# print(e)
|
152
|
-
self.failed_arb_id.append(mesg.arbitration_id)
|
153
|
-
return None
|
154
|
-
|
155
|
-
except DecodeError:
|
156
|
-
# print(e)
|
157
|
-
self.failed_arb_id.append(mesg.arbitration_id)
|
158
|
-
return None
|
159
|
-
except Exception:
|
160
|
-
# print(e)
|
161
|
-
self.failed_arb_id.append(mesg.arbitration_id)
|
162
|
-
return None
|
File without changes
|
File without changes
|
File without changes
|