Skip to content

Commit 5cb6d35

Browse files
committed
release: 2.6.0
2 parents 72de35d + 78db6ff commit 5cb6d35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+6354
-5084
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ dist
1818
aceinna.ico
1919
.pytest_cache
2020
loggers/
21-
/backup
21+
/backup
22+
/libs

HISTORY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# History
22

33
---
4+
## 2.6.0 / 2021-10-11
5+
- [INS401] Support communication with ethernet 100base-t1 protocol.
6+
47
## 2.5.0 / 2021-07-02
58
- [DMU] Support firmware upgrade.
69
- [OpenRTK/RTK330LA] Support ST9100 chip upgrade.

README.md

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,24 @@ A message communication tool for OpenIMU, OpenRTK and other devices of Aceinna
99
## Steps
1010

1111
### 1. Start the tool
12-
There are 2 ways to run the tool
12+
There are 3 ways to run the tool
1313

1414
#### Prepare
15-
Install the dependency library. It is better to create a virtual environment before to do it.
15+
1. Install the dependency library. It is better to create a virtual environment before to do it.
1616

17-
python 3.x
1817
```bash
1918
$ pip install -r requirements.txt
2019
```
2120

21+
2. Install pcap api library(`optional`). Because we try to support INS401 a new device from Aceinna. It would use 100BASE-T1 ethernet, and the data transfer is in low-level of network, so we need help of pcap api. Actually, we integrated `scapy` in our project. The pcap api library is the dependency of `scapy`. If you are using a INS401 device, please also install the library based on your platform.
22+
23+
| Platform | Libraray | Reference |
24+
| - | - | - |
25+
| Windows | `npcap` | https://scapy.readthedocs.io/en/latest/installation.html#windows |
26+
| Ubuntu | `tcpdump` | https://scapy.readthedocs.io/en/latest/installation.html#debian-ubuntu-fedora |
27+
| Mac | `libpcap` | https://scapy.readthedocs.io/en/latest/installation.html#mac-os-x |
28+
29+
2230
#### A. From source code
2331

2432
##### Run
@@ -35,19 +43,31 @@ $ pyinstaller build.spec
3543
```
3644

3745
##### Run
38-
```
46+
```bash
3947
$ cd dist
4048
$ ./ans-devices
4149
```
4250

43-
##### Startup Arguments
51+
#### C. From pip
52+
53+
##### Install
54+
```bash
55+
$ pip install openimu
56+
```
57+
58+
##### Run
59+
```
60+
$ openimu
61+
```
62+
63+
#### Startup Arguments
4464
You can specify some arguments while run the tool
4565

4666
Arguments:
4767

4868
| Name | Type | Default | Description |
4969
| - | :-: | :-: | - |
50-
| -i, --interface | String | 'default' | Value should be `uart`, `eth` |
70+
| -i, --interface | String | 'default' | Value should be `uart`, `eth`, `100base-t1` |
5171
| -p, --port | Number | '8000' | Value should be an available port |
5272
| --device-type | String | 'auto' | Value should be one of `IMU`, `RTK`, `DMU` |
5373
| -b, --baudrate | String | None | Value should be a valid baudrate. The valid value should be one of `38400`, `57600`, `115200`, `230400`, `460800` |
@@ -141,24 +161,37 @@ Aceinna Device could be connected with your PC via UART or LAN. The supported in
141161
| OpenIMU | `uart` | |
142162
| OpenRTK | `uart`, `eth` | The startup argument `-i eth` is supported |
143163
| RTK330L | `uart` | |
164+
| INS401 | `100base-t1` | The startup argument `-i 100base-t1` is supported |
144165

145166

146167
## Parse Tool
147-
There is a log parse tool integrated in. It could parse OpenRTK and RTK330LA log from data folder. Assgin `parse` to start it.
148-
149-
Example
150-
```bash
151-
$ ans-devices parse
152-
```
168+
There is a log parse tool integrated in. It could parse `OpenRTK`, `RTK330LA`, `IN S401` raw data log from data folder. Assgin `parse` to start it.
153169

154-
Arguments:
170+
### Arguments:
155171

156172
| Name | Type | Default | Description |
157173
| - | :-: | :-: | - |
158-
| -t | String | 'openrtk' | Switch work mode. Value should be one of `openrtk`,`rtkl` |
174+
| -t | String | 'openrtk' | Switch work mode. Value should be one of `openrtk`,`rtkl`,`ins401` |
159175
| -p | String | '.' | Value should be a valid path. It could be the container folder of log files |
160176
| -i | Number | 5 | INS kml rate(hz) |
161177

178+
### Example
179+
180+
Run from source code
181+
```bash
182+
$ python main.py parse
183+
```
184+
185+
Work as execution file
186+
```bash
187+
$ ans-devices parse
188+
```
189+
190+
Run from pip
191+
```bash
192+
$ openimu parse
193+
```
194+
162195
## Changelogs and Release Notes
163196

164197
Please refer to [HISTORY.md](HISTORY.md "Change History")

USAGE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parameters:
77

88
| Name | Type | Default | Description |
99
| - | :-: | :-: | - |
10-
| -i, --interface | String | 'default' | Value should be `uart`, `eth`. Depends on device type |
10+
| -i, --interface | String | 'default' | Value should be `uart`, `eth`, `100base-t1`. Depends on device type |
1111
| -p, --port | Number | '8000' | Value should be an available port |
1212
| --device-type | String | 'auto' | Value should be `IMU`, `RTK`, `DMU` |
1313
| -b, --baudrate | String | None | Value should be a valid baudrate. The valid value should be one of `38400`, `57600`, `115200`, `230400`, `460800` |

build.spec

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,12 @@ block_cipher = None
77
root_path = os.path.join(os.getcwd(),'src')
88

99
a = Analysis([os.path.join(root_path,'aceinna','executor.py'),
10-
# os.path.join(os.getcwd(), 'src', 'bootstrap/base.py'),
11-
# os.path.join(os.getcwd(), 'src', 'bootstrap/cli.py'),
12-
# os.path.join(os.getcwd(), 'src', 'bootstrap/loader.py'),
13-
# os.path.join(os.getcwd(), 'src', 'bootstrap/web.py'),
14-
# os.path.join(os.getcwd(), 'src','devices', 'base/uart_base.py'),
15-
# os.path.join(os.getcwd(), 'src','devices', 'configs/openimu_predefine.py'),
16-
# os.path.join(os.getcwd(), 'src','devices', 'configs/openrtk_predefine.py'),
17-
# os.path.join(os.getcwd(), 'src','devices', 'openimu/uart_provider.py'),
18-
# os.path.join(os.getcwd(), 'src','devices', 'openrtk/uart_provider.py'),
19-
# os.path.join(os.getcwd(), 'src','devices', 'device_manager.py'),
20-
# os.path.join(os.getcwd(), 'src','framework', 'communicator.py'),
21-
# os.path.join(os.getcwd(), 'src','framework', 'context.py'),
22-
# os.path.join(os.getcwd(), 'src','framework', 'file_storage.py'),
23-
# os.path.join(os.getcwd(), 'src','framework', 'utils/helper.py'),
2410
],
2511
pathex=[root_path],
2612
binaries=[],
2713
datas=[
28-
(os.path.join(root_path,'aceinna','setting'), os.path.join('setting'))
14+
(os.path.join(root_path,'aceinna','setting'), os.path.join('setting')),
15+
(os.path.join(root_path,'aceinna','libs'), os.path.join('libs'))
2916
],
3017
hiddenimports=[],
3118
hookspath=[],

requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ azure-common==1.1.24
22
azure-storage-blob==2.1.0
33
azure-storage-common==2.1.0
44
certifi==2019.11.28
5-
cffi==1.13.2
5+
cffi==1.14.5
66
chardet==3.0.4
77
cryptography==3.3.2
88
idna==2.8
99
isodate==0.6.0
1010
msrest==0.6.10
1111
oauthlib==3.1.0
12-
psutil==5.6.6
12+
psutil==5.8.0
1313
pycparser==2.19
1414
pyserial==3.4
1515
python-can==3.3.4
@@ -19,3 +19,4 @@ requests-oauthlib==1.3.0
1919
six==1.13.0
2020
tornado==6.0.3
2121
urllib3==1.25.7
22+
scapy==2.4.5

setup.py

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,44 @@ def load_json_file_path_under_setting_folder():
2121
json_file_paths = []
2222
setting_root_path = os.path.join(os.getcwd(), 'src', 'aceinna', 'setting')
2323
for root, dirs, files in os.walk(setting_root_path):
24-
json_file = next((item for item in files if item.__contains__('.json')), None)
24+
json_file = next(
25+
(item for item in files if item.__contains__('.json')), None)
2526
if not json_file:
2627
continue
2728

28-
json_file_path = os.path.join(root.replace(setting_root_path,'setting'), json_file)
29+
json_file_path = os.path.join(root.replace(
30+
setting_root_path, 'setting'), json_file)
2931
json_file_paths.append(json_file_path)
3032

3133
return json_file_paths
3234

35+
36+
def load_libraries():
37+
file_paths = []
38+
setting_root_path = os.path.join(os.getcwd(), 'src', 'aceinna', 'libs')
39+
for root, dirs, files in os.walk(setting_root_path):
40+
for item in files:
41+
lib_file = item if item.__contains__(
42+
'.dll') or item.__contains__('.so') else None
43+
if not lib_file:
44+
continue
45+
46+
file_path = os.path.join(root.replace(
47+
setting_root_path, 'libs'), lib_file)
48+
file_paths.append(file_path)
49+
50+
return file_paths
51+
52+
53+
def load_resources():
54+
resources = []
55+
json_files = load_json_file_path_under_setting_folder()
56+
lib_files = load_libraries()
57+
resources.extend(json_files)
58+
resources.extend(lib_files)
59+
return resources
60+
61+
3362
PACKAGE_DESCRIPTION = "Aceinna Navigation System Open Devices Library"
3463

3564
INSTALL_REQUIRES = [
@@ -55,7 +84,7 @@ def load_json_file_path_under_setting_folder():
5584
packages=find_packages("src", exclude=['test', 'tests']),
5685
package_dir={"": "src"},
5786
package_data={
58-
'aceinna': load_json_file_path_under_setting_folder()
87+
'aceinna': load_resources()
5988
},
6089
classifiers=[
6190
"Environment :: Console",

src/aceinna/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Package Version
2-
VERSION = '2.5.0'
2+
VERSION = '2.6.0'
33
PACKAGE_NAME = 'openimu'

src/aceinna/bootstrap/log_parser.py

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,61 @@
11
import os
2-
from ..tools.openrtk_parse import do_parse as do_parse_openrtk_logs
3-
from ..tools.rtkl_parse import do_parse as do_parse_rtkl_logs
2+
import sys
3+
from ctypes import *
44
from ..models import LogParserArgs
55
from ..framework.constants import APP_TYPE
66
from ..framework.context import APP_CONTEXT
7+
from ..framework.utils import resource
8+
9+
10+
def prepare_lib_folder():
11+
executor_path = resource.get_executor_path()
12+
lib_folder_name = 'libs'
13+
14+
# copy contents of setting file under executor path
15+
lib_folder_path = os.path.join(
16+
executor_path, lib_folder_name)
17+
18+
if not os.path.isdir(lib_folder_path):
19+
os.makedirs(lib_folder_path)
20+
21+
platform = sys.platform
22+
23+
if platform.startswith('win'):
24+
lib_file = 'UserDecoderLib.dll'
25+
if platform.startswith('linux'):
26+
lib_file = 'UserDecoderLib_linux.so'
27+
if platform.startswith('darwin'):
28+
lib_file = 'UserDecoderLib_mac.so'
29+
30+
lib_path = os.path.join(lib_folder_path, lib_file)
31+
32+
if not os.path.isfile(lib_path):
33+
lib_content = resource.get_content_from_bundle(
34+
lib_folder_name, lib_file)
35+
if lib_content is None:
36+
raise ValueError('Lib file content is empty')
37+
38+
with open(lib_path, "wb") as code:
39+
code.write(lib_content)
40+
41+
return lib_path
42+
43+
44+
def do_parse(log_type, folder_path):
45+
lib_path = prepare_lib_folder()
46+
47+
lib = CDLL(lib_path)
48+
for root, _, file_name in os.walk(folder_path):
49+
for fname in file_name:
50+
if fname.startswith('user') and fname.endswith('.bin'):
51+
file_path = os.path.join(folder_path, fname)
52+
if log_type == 'openrtk':
53+
lib.decode_openrtk_user(bytes(file_path, encoding='utf8'))
54+
if log_type == 'rtkl':
55+
lib.decode_openrtk_inceptio(bytes(file_path, encoding='utf8'))
56+
if log_type == 'ins401':
57+
lib.decode_ins401(bytes(file_path, encoding='utf8'))
58+
759

860
class LogParser:
961
_options = None
@@ -19,23 +71,12 @@ def listen(self):
1971
'''
2072
self._validate_params()
2173

22-
setting_file = 'log-parser.json'
23-
24-
if self._options.log_type == 'openrtk':
25-
do_parse_openrtk_logs(self._options.path,
26-
self._options.kml_rate,
27-
setting_file)
28-
elif self._options.log_type == 'rtkl':
29-
do_parse_rtkl_logs(self._options.path,
30-
self._options.kml_rate,
31-
setting_file)
32-
else:
33-
raise ValueError('No matched log parser')
74+
do_parse(self._options.log_type, self._options.path)
3475

3576
os._exit(1)
3677

3778
def _validate_params(self):
38-
for attr_name in ['log_type', 'path', 'kml_rate']:
79+
for attr_name in ['log_type', 'path']:
3980
attr_value = getattr(self._options, attr_name)
4081
if not attr_value:
4182
raise ValueError(

src/aceinna/core/driver.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,15 @@ def _handle_device_exception(self, error, message):
9999
self._communicator.find_device(self._device_discover_handler)
100100

101101
def _handle_device_upgrade_restart(self):
102-
self._communicator.set_find_options({
103-
'com_port': self._communicator.serial_port.port,
102+
find_options = {
104103
'device_type': self._device_provider.type
105-
})
104+
}
105+
if hasattr(self._communicator, 'serial_port'):
106+
find_options['com_port'] = self._communicator.serial_port.port
107+
108+
if hasattr(self._communicator, 'set_find_options'):
109+
self._communicator.set_find_options(find_options)
110+
106111
self._communicator.find_device(
107112
self._device_upgrade_restart_handler,
108113
retries=2,

0 commit comments

Comments
 (0)