pyaidrone 1.1__tar.gz → 1.3__tar.gz
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.
Potentially problematic release.
This version of pyaidrone might be problematic. Click here for more details.
- pyaidrone-1.3/PKG-INFO +23 -0
- pyaidrone-1.3/pyaidrone/__init__.py +1 -0
- {pyaidrone-1.1 → pyaidrone-1.3}/pyaidrone/aiDrone.py +42 -1
- {pyaidrone-1.1 → pyaidrone-1.3}/pyaidrone/parse.py +14 -1
- pyaidrone-1.3/pyaidrone.egg-info/PKG-INFO +23 -0
- pyaidrone-1.3/setup.py +23 -0
- pyaidrone-1.1/PKG-INFO +0 -7
- pyaidrone-1.1/pyaidrone/__init__.py +0 -1
- pyaidrone-1.1/pyaidrone.egg-info/PKG-INFO +0 -7
- pyaidrone-1.1/setup.py +0 -16
- {pyaidrone-1.1 → pyaidrone-1.3}/README.md +0 -0
- {pyaidrone-1.1 → pyaidrone-1.3}/pyaidrone/deflib.py +0 -0
- {pyaidrone-1.1 → pyaidrone-1.3}/pyaidrone/ikeyevent.py +0 -0
- {pyaidrone-1.1 → pyaidrone-1.3}/pyaidrone/packet.py +0 -0
- {pyaidrone-1.1 → pyaidrone-1.3}/pyaidrone.egg-info/SOURCES.txt +0 -0
- {pyaidrone-1.1 → pyaidrone-1.3}/pyaidrone.egg-info/dependency_links.txt +0 -0
- {pyaidrone-1.1 → pyaidrone-1.3}/pyaidrone.egg-info/requires.txt +0 -0
- {pyaidrone-1.1 → pyaidrone-1.3}/pyaidrone.egg-info/top_level.txt +0 -0
- {pyaidrone-1.1 → pyaidrone-1.3}/setup.cfg +0 -0
pyaidrone-1.3/PKG-INFO
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pyaidrone
|
|
3
|
+
Version: 1.3
|
|
4
|
+
Summary: Library for AIDrone Products
|
|
5
|
+
Home-page: http://www.ir-brain.com
|
|
6
|
+
Author: IR-Brain
|
|
7
|
+
Author-email: ceo@ir-brain.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
## install pyaidrone
|
|
15
|
+
|
|
16
|
+
> python setup.py install
|
|
17
|
+
> or
|
|
18
|
+
> python install pyaidrone
|
|
19
|
+
|
|
20
|
+
### install Packages
|
|
21
|
+
|
|
22
|
+
> pip install pyserial
|
|
23
|
+
> pip install pynput
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.2'
|
|
@@ -32,7 +32,25 @@ class AIDrone(Parse, Packet):
|
|
|
32
32
|
self.receiveCallback(packet)
|
|
33
33
|
self.serial.write(self.makepkt.getPacket())
|
|
34
34
|
|
|
35
|
+
def requestSensorData(self):
|
|
36
|
+
self.makepkt.makePacket(8, bytes([0x10]))
|
|
37
|
+
self.serial.write(self.makepkt.getPacket())
|
|
38
|
+
|
|
39
|
+
def get_gyro(self):
|
|
40
|
+
return self.sensors["gyro"]
|
|
41
|
+
|
|
42
|
+
def get_acceleration(self):
|
|
43
|
+
return self.sensors["acceleration"]
|
|
35
44
|
|
|
45
|
+
def get_altitude(self):
|
|
46
|
+
return self.sensors["altitude"]
|
|
47
|
+
|
|
48
|
+
def get_position(self):
|
|
49
|
+
return self.sensors["position"]
|
|
50
|
+
|
|
51
|
+
def get_tof(self):
|
|
52
|
+
return self.sensors["tof"]
|
|
53
|
+
|
|
36
54
|
def Open(self, portName = "None"):
|
|
37
55
|
if eq(portName, "None"):
|
|
38
56
|
nodes = comports()
|
|
@@ -132,11 +150,12 @@ class AIDrone(Parse, Packet):
|
|
|
132
150
|
|
|
133
151
|
|
|
134
152
|
def rotation(self, rot=90):
|
|
135
|
-
self.rot += rot
|
|
153
|
+
self.rot += rot
|
|
136
154
|
data = self.rot.to_bytes(2, byteorder="little", signed=True)
|
|
137
155
|
self.makepkt.makePacket(10, data)
|
|
138
156
|
|
|
139
157
|
|
|
158
|
+
|
|
140
159
|
def motor(self, what, speed):
|
|
141
160
|
speed = DefLib.constrain(speed, 100, 0)
|
|
142
161
|
data = speed.to_bytes(2, byteorder="little", signed=True)
|
|
@@ -147,5 +166,27 @@ class AIDrone(Parse, Packet):
|
|
|
147
166
|
def emergency(self):
|
|
148
167
|
self.setOption(0x00)
|
|
149
168
|
self.serial.write(self.makepkt.getPacket())
|
|
169
|
+
|
|
170
|
+
def motor(self, motor_id, speed):
|
|
171
|
+
"""
|
|
172
|
+
모터 속도를 0~100 범위에서 설정합니다.
|
|
173
|
+
|
|
174
|
+
:param motor_id: 제어할 모터의 인덱스 (0~3은 개별 모터, 4는 모든 모터)
|
|
175
|
+
:param speed: 모터 속도 (0 ~ 100)
|
|
176
|
+
"""
|
|
177
|
+
speed = max(0, min(speed, 100)) # 속도를 0~100 범위로 제한
|
|
178
|
+
scaled_speed = speed * 10 # 내부적으로 0~1000 범위로 변환
|
|
179
|
+
data = scaled_speed.to_bytes(2, byteorder="little", signed=False)
|
|
180
|
+
|
|
181
|
+
# 모든 모터를 동시에 제어
|
|
182
|
+
if motor_id == 4:
|
|
183
|
+
self.makepkt.makePacket(12, data) # 모든 모터의 속도를 설정 (THR 제어)
|
|
184
|
+
else:
|
|
185
|
+
# 개별 모터 제어
|
|
186
|
+
self.makepkt.makePacket(6 + (motor_id * 2), data)
|
|
187
|
+
|
|
188
|
+
# 패킷을 시리얼 포트를 통해 전송
|
|
189
|
+
self.serial.write(self.makepkt.getPacket())
|
|
190
|
+
|
|
150
191
|
|
|
151
192
|
|
|
@@ -3,11 +3,12 @@ from pyaidrone.deflib import *
|
|
|
3
3
|
class Parse:
|
|
4
4
|
def __init__(self, model=AIDRONE):
|
|
5
5
|
self.model = model
|
|
6
|
-
self.packet = bytearray(
|
|
6
|
+
self.packet = bytearray(100)
|
|
7
7
|
self.offset = 0
|
|
8
8
|
self.type = 0
|
|
9
9
|
self.packetLen = 20
|
|
10
10
|
self.headMatchCnt = 0
|
|
11
|
+
self.sensors = {"gyro":(0,0), "acceleration":(0,0), "altitude": (0,0), "position": (0, 0), "tof": 0}
|
|
11
12
|
if self.model == AIDRONE:
|
|
12
13
|
self.head = (0x26, 0xA8, 0x14, 0xA0)
|
|
13
14
|
|
|
@@ -40,6 +41,18 @@ class Parse:
|
|
|
40
41
|
self.offset = 0
|
|
41
42
|
chksum = DefLib.checksum(self.packet)
|
|
42
43
|
if chksum == self.packet[5]:
|
|
44
|
+
self.parseSensorData(slef.packet)
|
|
43
45
|
return self.packet
|
|
44
46
|
return "None"
|
|
45
47
|
|
|
48
|
+
def parseSensorData(self, packet):
|
|
49
|
+
if packet[3] == 0xA2:
|
|
50
|
+
self.sensors["gyro"] = (int.from_bytes(packet[9:11], "little", signed=True),
|
|
51
|
+
int.from_bytes(packet[11:13], "little", signed=True))
|
|
52
|
+
self.sensors["acceleration"] = (int.from_bytes(packet[13:15], "little", signed=True),
|
|
53
|
+
int.from_bytes(packet[15:17], "little", signed=True))
|
|
54
|
+
self.sensors["altitude"] = int.from_bytes(packet[17:19], "little", signed=True)
|
|
55
|
+
self.sensors["position"] = (int.from_bytes(packet[19:21], "little", signed=True),
|
|
56
|
+
int.from_bytes(packet[21:23], "little", signed=True))
|
|
57
|
+
self.sensors["tof"] = int.from_bytes(packet[23:25], "little", signed=True)
|
|
58
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pyaidrone
|
|
3
|
+
Version: 1.3
|
|
4
|
+
Summary: Library for AIDrone Products
|
|
5
|
+
Home-page: http://www.ir-brain.com
|
|
6
|
+
Author: IR-Brain
|
|
7
|
+
Author-email: ceo@ir-brain.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
## install pyaidrone
|
|
15
|
+
|
|
16
|
+
> python setup.py install
|
|
17
|
+
> or
|
|
18
|
+
> python install pyaidrone
|
|
19
|
+
|
|
20
|
+
### install Packages
|
|
21
|
+
|
|
22
|
+
> pip install pyserial
|
|
23
|
+
> pip install pynput
|
pyaidrone-1.3/setup.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="pyaidrone",
|
|
5
|
+
version="1.3",
|
|
6
|
+
description="Library for AIDrone Products",
|
|
7
|
+
long_description=open("README.md").read(), # README.md 내용을 long_description으로 사용
|
|
8
|
+
long_description_content_type="text/markdown", # README 파일이 markdown 형식임을 지정
|
|
9
|
+
author="IR-Brain",
|
|
10
|
+
author_email="ceo@ir-brain.com",
|
|
11
|
+
url="http://www.ir-brain.com",
|
|
12
|
+
packages=find_packages(), # find_packages()를 사용해 서브패키지까지 자동 탐색
|
|
13
|
+
install_requires=[
|
|
14
|
+
'pyserial>=3.4',
|
|
15
|
+
'pynput>=1.7.3',
|
|
16
|
+
],
|
|
17
|
+
classifiers=[ # 추가 메타데이터
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"License :: OSI Approved :: MIT License", # 실제 라이선스를 설정해야 함
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
],
|
|
22
|
+
python_requires='>=3.6', # 최소 Python 버전 요구 사항 설정
|
|
23
|
+
)
|
pyaidrone-1.1/PKG-INFO
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '1.0'
|
pyaidrone-1.1/setup.py
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
from setuptools import setup, find_packages
|
|
2
|
-
|
|
3
|
-
setup(
|
|
4
|
-
name = "pyaidrone",
|
|
5
|
-
version = "1.1",
|
|
6
|
-
description = "Library for AIDrone Products",
|
|
7
|
-
author = "IR-Brain",
|
|
8
|
-
author_email = "ceo@ir-brain.com",
|
|
9
|
-
url = "http://www.ir-brain.com",
|
|
10
|
-
packages = ['pyaidrone',
|
|
11
|
-
],
|
|
12
|
-
install_requires = [
|
|
13
|
-
'pyserial>=3.4',
|
|
14
|
-
'pynput>=1.7.3',
|
|
15
|
-
],
|
|
16
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|