jumpjack
11-03-2023, 19:47
Vorrei comprare un gimbal/stabilizzatore per cellulare, ma è essenziale che sia gestibile tramite una mia app.
Secondo chatGPT è possibile controllare i gimbal feiyutech, che sembrerebbero usare il protocollo Feiuytech G, usando questo codice python:
import socket
import struct
import time
# Indirizzo IP e porta del dispositivo che controlla la testa motorizzata
HOST = '192.168.1.100'
PORT = 7878
# Codice di comando per il controllo della testa motorizzata
CMD_START = b' xa0 x01 x00 x00 x00 x00 xa1'
CMD_STOP = b' xa0 x00 x00 x00 x00 x00 xa0'
# Funzione per inviare il codice di comando al dispositivo
def send_cmd(cmd):
# Creazione del socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.settimeout(1)
# Invio del comando
sock.sendto(cmd, (HOST, PORT))
# Chiusura del socket
sock.close()
# Funzione per inclinare la testa motorizzata in su
def tilt_up():
cmd = b' xa0 x06 x00 x00 x00 x01 xa7'
send_cmd(cmd)
time.(0.1)
send_cmd(CMD_STOP)
# Funzione per inclinare la testa motorizzata in giù
def tilt_down():
cmd = b' xa0 x06 x00 x00 x00 xff xa3'
send_cmd(cmd)
time.(0.1)
send_cmd(CMD_STOP)
# Funzione per ruotare la testa motorizzata a destra
def pan_right():
cmd = b' xa0 x05 x00 x00 x00 x01 xa6'
send_cmd(cmd)
time.(0.1)
send_cmd(CMD_STOP)
# Funzione per ruotare la testa motorizzata a sinistra
def pan_left():
cmd = b' xa0 x05 x00 x00 x00 xff xa2'
send_cmd(cmd)
time.(0.1)
send_cmd(CMD_STOP)
# Esempio di utilizzo delle funzioni
tilt_up()
pan_right()
tilt_down()
pan_left()
O persino usando una pagina web, perchè i moderni browser hanno accesso al bluetooth:
const BTDevice = await navigator.bluetooth.requestDevice({
filters: [
{ services: ['feiyu'] },
{ namePrefix: 'FeiyuTech' }
]
} ) ;
const server = await BTDevice.gatt.connect();
const service = await server.getPrimaryService('feiyu');
constacteristic = await service.getCharacteristic('feiyu_command');
// Posizionamento assoluto in angolo
const panAngle = 90; // Angolo di pan desiderato
const tiltAngle = -30; // Angolo di tilt desiderato
const panAngleByte1 = (panAngle >> 8) & 0xff;
const panAngleByte2 = panAngle & 0xff;
const tiltAngleByte1 = (tiltAngle >> 8) & 0xff;
const tiltAngleByte2 = tiltAngle & 0xff;
const command = new Uint8Array([0xA0, 0x08, panAngleByte1, panAngleByte2, tiltAngleByte1, tiltAngleByte2, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4]);
awaitacteristic.writeValue(command);
qualcuno ha un gimbal feiyutech e ha voglia di verificare?
Secondo chatGPT è possibile controllare i gimbal feiyutech, che sembrerebbero usare il protocollo Feiuytech G, usando questo codice python:
import socket
import struct
import time
# Indirizzo IP e porta del dispositivo che controlla la testa motorizzata
HOST = '192.168.1.100'
PORT = 7878
# Codice di comando per il controllo della testa motorizzata
CMD_START = b' xa0 x01 x00 x00 x00 x00 xa1'
CMD_STOP = b' xa0 x00 x00 x00 x00 x00 xa0'
# Funzione per inviare il codice di comando al dispositivo
def send_cmd(cmd):
# Creazione del socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.settimeout(1)
# Invio del comando
sock.sendto(cmd, (HOST, PORT))
# Chiusura del socket
sock.close()
# Funzione per inclinare la testa motorizzata in su
def tilt_up():
cmd = b' xa0 x06 x00 x00 x00 x01 xa7'
send_cmd(cmd)
time.(0.1)
send_cmd(CMD_STOP)
# Funzione per inclinare la testa motorizzata in giù
def tilt_down():
cmd = b' xa0 x06 x00 x00 x00 xff xa3'
send_cmd(cmd)
time.(0.1)
send_cmd(CMD_STOP)
# Funzione per ruotare la testa motorizzata a destra
def pan_right():
cmd = b' xa0 x05 x00 x00 x00 x01 xa6'
send_cmd(cmd)
time.(0.1)
send_cmd(CMD_STOP)
# Funzione per ruotare la testa motorizzata a sinistra
def pan_left():
cmd = b' xa0 x05 x00 x00 x00 xff xa2'
send_cmd(cmd)
time.(0.1)
send_cmd(CMD_STOP)
# Esempio di utilizzo delle funzioni
tilt_up()
pan_right()
tilt_down()
pan_left()
O persino usando una pagina web, perchè i moderni browser hanno accesso al bluetooth:
const BTDevice = await navigator.bluetooth.requestDevice({
filters: [
{ services: ['feiyu'] },
{ namePrefix: 'FeiyuTech' }
]
} ) ;
const server = await BTDevice.gatt.connect();
const service = await server.getPrimaryService('feiyu');
constacteristic = await service.getCharacteristic('feiyu_command');
// Posizionamento assoluto in angolo
const panAngle = 90; // Angolo di pan desiderato
const tiltAngle = -30; // Angolo di tilt desiderato
const panAngleByte1 = (panAngle >> 8) & 0xff;
const panAngleByte2 = panAngle & 0xff;
const tiltAngleByte1 = (tiltAngle >> 8) & 0xff;
const tiltAngleByte2 = tiltAngle & 0xff;
const command = new Uint8Array([0xA0, 0x08, panAngleByte1, panAngleByte2, tiltAngleByte1, tiltAngleByte2, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4]);
awaitacteristic.writeValue(command);
qualcuno ha un gimbal feiyutech e ha voglia di verificare?