Control the Eachine E32HW Quad-copter from a computer with a joystick.
Start the program with:
python3 control.py
The first available joystick is used. You can configure the button mapping in the program.
Connect to the WLAN of the quad-copter.
Add the --help
argument for further information.
The quad-copter is controlled by sending UDP packets to 192.168.99.1
on port 9001. A packet is send every 50 ms.
The IP camera is available on rtsp://192.168.99.1/11
. Viewing the IP
camera will cause the WLAN to stop working after a while.
0x5B
0x52
0x74
0x3E
0x1A
0x00
0x01
A counter.
previous_packet = [0] * 26
packet[7] = (previous_packet[7] + 1) & 0xFF
0xE0
0x00
Sum of the byte-wise differences between this and the previous
packet modulo 0xFF
.
previous_packet = [0] * 26
# calculate at the end
packet[10] = 0
diff = 0
for a, b in zip(previous_packet, packet):
diff += a - b
packet[10] = diff % 0xFF
0x00
0xFF
0x02
Throttle from 0x00
to 0x7F
(inclusive). Neutral at 0x40
.
Rudder from 0x00
to 0x7F
(inclusive). Neutral at 0x40
.
Elevator from 0x00
to 0x7F
(inclusive). Neutral at 0x40
.
Aileron from 0x00
to 0x7F
(inclusive). Neutral at 0x40
.
Throttle trimmer from 0x00
to 0x3F
(inclusive). Neutral at 0x20
.
Aileron trimmer from 0x00
to 0x3F
(inclusive). Neutral at 0x20
.
Elevator trimmer from 0x00
to 0x3F
(inclusive). Neutral at 0x20
.
Rudder trimmer from 0x00
to 0x3F
(inclusive). Neutral at 0x20
.
Flag byte:
Always inactive. Called hight
in the app.
Active while headless mode is turned on.
Active while high speed mode is turned on.
Active for 500 ms for "3D Flip".
Active for 1000 ms to start and stop engine.
Active for 1000 ms for automatic landing.
Active for 1000 ms for automatic take-off.
Flag byte:
Active to return home (?). Can only be active while in headless mode in app.
Active for emergency stop.
Always inactive. Called middle speed
in the app.
Active for upwards evasion (?).
Always inactive. Called control type
and app control
in the app.
Low bit of product type. Product type is 1
in the app.
High bit of product type.
Flag byte:
Active to turn lights on.
7 bit sum of the last 12 bytes.
packet[25] = sum(packet[13:25]) & 0x7F