pyaidrone 2.7__tar.gz → 2.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyaidrone
3
- Version: 2.7
3
+ Version: 2.9
4
4
  Summary: Library for AIDrone Products
5
5
  Home-page: http://www.ir-brain.com
6
6
  Author: IR-Brain
@@ -346,6 +346,32 @@ class AIDrone:
346
346
  self.posX = self.posY = 0
347
347
  self.setOption(OPT_FLIGHT_VEL)
348
348
 
349
+ def rc_control(self, roll=0, pitch=0, yaw=0, throttle=None):
350
+ """roll·pitch·yaw 를 한 번에 준다 (실시간 수동 조종용).
351
+
352
+ velocity() 를 앞뒤·좌우로 따로 부르면 서로 필드를 0으로 덮어써서
353
+ 한 방향만 먹는다. 대각선 이동이나 방향키 동시 입력에는 이 메서드를 쓴다.
354
+
355
+ roll : 좌우 속도 (오른쪽 +, 왼쪽 -) -VEL_MAX ~ VEL_MAX
356
+ pitch : 전후 속도 (앞 +, 뒤 -)
357
+ yaw : 회전 속도 (오른쪽 +, 왼쪽 -)
358
+ throttle : 고도(cm). None 이면 기존 고도 유지
359
+
360
+ Tello 의 send_rc_control(lr, fb, ud, yaw) 에 대응한다.
361
+ """
362
+ roll = DefLib.constrain(int(roll), VEL_MAX, VEL_MIN)
363
+ pitch = DefLib.constrain(int(pitch), VEL_MAX, VEL_MIN)
364
+ yaw = DefLib.constrain(int(yaw), YAWVEL_MAX, -YAWVEL_MAX)
365
+ self.makepkt.setField(Packet.IDX_ROLL, roll)
366
+ self.makepkt.setField(Packet.IDX_PITCH, pitch)
367
+ self.makepkt.setField(Packet.IDX_YAW, yaw)
368
+ if throttle is not None:
369
+ self.makepkt.setField(Packet.IDX_THR,
370
+ DefLib.constrain(int(throttle), ALT_MAX, ALT_MIN),
371
+ signed=False)
372
+ self.posX = self.posY = 0
373
+ self.setOption(OPT_FLIGHT_VEL)
374
+
349
375
  def move(self, dir=FRONT, dist=100):
350
376
  """이륙 지점 기준 누적 절대 위치로 이동한다 (cm)."""
351
377
  if dir > LEFT or dir < FRONT:
@@ -170,14 +170,14 @@ class Drone:
170
170
  # ==================================================================
171
171
  def send_rc_control(self, lr, fb, ud, yaw):
172
172
  """네 방향 속도를 한 번에 준다. (-100~100)
173
- lr: 좌우, fb: 전후, ud: 상하, yaw: 회전. Tello 와 동일한 순서."""
174
- # 좌우/전후는 velocity 로, 상하/회전은 별도 처리
175
- if abs(fb) >= abs(lr):
176
- self.drone.velocity(FRONT if fb >= 0 else BACK, abs(fb))
177
- else:
178
- self.drone.velocity(RIGHT if lr >= 0 else LEFT, abs(lr))
179
- if yaw:
180
- self.drone.rotation(int(yaw) // 10) # 완만하게
173
+ lr: 좌우, fb: 전후, ud: 상하, yaw: 회전. Tello 와 동일한 순서.
174
+
175
+ 좌우(roll)와 전후(pitch) 동시에 보내므로 대각선 이동도 된다."""
176
+ self.drone.rc_control(roll=lr, pitch=fb, yaw=yaw)
177
+ if ud:
178
+ # 상하는 목표 고도를 조금씩 올리고 내린다
179
+ h = self.get_height()
180
+ self.drone.altitude(max(0, min(150, h + int(ud) // 10)))
181
181
 
182
182
  # ==================================================================
183
183
  # 영상 — Tello streamon / get_frame_read 대응
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyaidrone
3
- Version: 2.7
3
+ Version: 2.9
4
4
  Summary: Library for AIDrone Products
5
5
  Home-page: http://www.ir-brain.com
6
6
  Author: IR-Brain
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pyaidrone",
5
- version="2.7",
5
+ version="2.9",
6
6
  description="Library for AIDrone Products",
7
7
  long_description=open("README.md").read(), # README.md 내용을 long_description으로 사용
8
8
  long_description_content_type="text/markdown", # README 파일이 markdown 형식임을 지정
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
File without changes