처음에는 더 이상 학생이 아니며 현재 친구를 사칭하고 있습니다. 나는 로봇 팔의 라이브 비디오 피드와 로봇 팔의 기본 상호 작용을 가진 사용자를 허용하는 버튼을 설정 한 웹 사이트를 만들고 있습니다.웹 페이지를 사용하여 Linux에서 작성된 로봇 팔 제어
웹 사이트 및 라이브 비디오 피드를 설정했습니다. 플래시 미디어 인코더 및 플래시 서버 4.5를 사용하여 4 초 지연이 있습니다. 지연 시간을 줄이기위한 제안이 있습니까?
maplin 로봇 팔에 필요한 파이썬 코드를 작성했는데 이제는 내 파이썬 코드를 웹 페이지 인터페이스와 연결하는 방법이 확실하지 않습니까? 이 전에 내가 편집하고 배울 수있는 코드와 함께 제공 할 누군가 ..
파이썬 코드
import usb.core
import usb.util
import sys
import time
# This program is intended to control a robotic arm via USB from Linux
# The code is written in Python by Neil Polwart (c) 2011
# It is a work in progress and will improved!
# locate the device device
dev = usb.core.find(idVendor=0x1267, idProduct=0x0000)
# assigns the device to the handle "dev"
# can check the device is visible to Linux with command line command lsusb
# which should report a device with the above vendor and id codes.
# was it found?
if dev is None:
raise ValueError('Device not found') # if device not found report an error
# set the active configuration
dev.set_configuration()
# as no arguments, the first configuration will be the active one
# note as commands are sent to device as commands not data streams
# no need to define the endpoint
# defines the command packet to send
datapack=0x80,0,0
# change this packet to make different moves.
# first byte defines most of the movements, second byte shoulder rotation, third byte light
# command structure in more detail:
# http://notbrainsurgery.livejournal.com/38622.html?view=93150#t93150
print "requested move",datapack # reports the requested movement to the user
# send the command
bytesout=dev.ctrl_transfer(0x40, 6, 0x100, 0, datapack, 1000)
# outputs the command to the USB device, using the ctrl_transfer method
# 0x40, 6, 0x100, 0 defines the details of the write - bRequestType, bRequest, wValue, wIndex
# datapack is our command (3 bytes)
# the final value is a timeout (in ms) which is optional
# bytesout = the number of bytes written (i.e. 3 if successful)
print "Written :",bytesout,"bytes" # confirm to user that data was sent OK
# wait for a defined period
time.sleep(1) # waits for 1 second whilst motors move.
# now STOP the motors
datapack=0,0,0
bytesout=dev.ctrl_transfer(0x40, 6, 0x100, 0, datapack, 1000)
if bytesout == 3: print "Motors stopped"
그래서 나는 웹 사이트 인터페이스를 통해 datapack 라인을 편집 할 수있는 방법을 찾을 필요가 있습니다. 어떤 도움을 주셔서 감사합니다! Windows 7 설정을 사용하고 있지만 VM웨어에 액세스 할 수 있습니다.
어쨌든 처리기를 만드는 방법에 대한 자세한 가이드 나 예제를 제공 할 수 있습니까? 필자는 이미 jQuery에 CDN을 연결 했으므로 jQuery로 쉽게 할 수 있습니까? – Student
jQuery를 사용하면 훨씬 쉽습니다. 이미 페이지에 있다면, 사용하지 않을 이유가 없습니다. 나는 내가 지침으로 할 수있는 것을 볼 것이다. – FakeRainBrigand
대단히 감사 드리며, 내일 오후에 마무리해야합니다. 나는 오늘 밤 머물 것이다 : | – Student