- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试创建一个程序,其中一部分将使用 naoqi Python SDK 从我的 PC 的网络摄像头以帧(或换句话说图像)的形式将实时视频传输到 Pepper 的平板电脑。在机器人方面,将有一个程序使用 ALTabletService 的 showWebview 函数将图像显示为 html 网页。但在这个过程开始后,它只进行了几秒钟,然后屏幕返回到它的主页。我猜机器人抢占了我的程序。但这不会发生在 playVideo 函数中。有什么办法可以克服这个问题吗?
PC端:
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
def gen(camera):
# Set our pipelines state to Playing.
video_pipeline.set_state(Gst.State.PLAYING)
audio_pipeline.set_state(Gst.State.PLAYING)
while True:
frame = camera.get_frame()
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n') #sending frames to the webpage
@app.route('/video_feed')
def video_feed():
try:
return Response(stream_with_context(gen(VideoCamera())), mimetype='multipart/x-mixed-replace; boundary=frame')
except Exception:
return None
if __name__ == '__main__':
# app.run(host='0.0.0.0', port = http, debug=True, threaded=True)
http_server = WSGIServer(('0.0.0.0', http), app) #creating a server with open ip
http_server.serve_forever()
胡椒面:
tabletService = session.service('ALTabletService')
tabletService.loadUrl('http://' + user_ip + ':' + str(user_http_port) + '/')
tabletService.showWebview()
最佳答案
这是因为 Pepper 的自主生活是围绕 activities 构建的,只要事件失去焦点,Pepper 就会重置所有内容 - 语言、姿势、LED,是的,还有平板电脑。
因此理想情况下,您的代码应该在应用程序内部(即标记为“交互式”的行为),并且只要它具有焦点,平板电脑就不会被重置。
(编辑)要创建作为独立 Python 脚本的应用程序,一种简单的方法是使用 robot jumpstarter,这是一个 python 脚本,它将从模板(包含所有样板等)生成应用程序,请参阅 here获取说明。
关于python - 如何阻止 Pepper 机器人抢占它的平板电脑?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50696587/
我的应用程序中有两个 Activity 。第一个 Activity 启动模式是 singleInstance,第二个 Activity 启动模式是 singleTask。我正在使用这些启动模式,因为我
据热心网友投稿,小米小爱触屏音箱Pro 8外观曝光,可以看到触控屏幕尺寸比较大,像是在音箱上“长”了一个平板。 从曝光的信息来看,小米小爱触屏音箱Pro 8具有白色的配色设计,下方有一个长
我有一张 table ,看起来像, VisitorId date deviceType 1 2018-12-11 mobile 2
今天下午,小米官方公布了小爱触屏音箱Pro 8,可以看到触控屏幕尺寸比较大,音箱上“长”了一个平板。据悉,小米小爱触屏音箱Pro 8具有白色的配色设计,下方有一个长条状的扬声器,上方带有一个尺寸比较
有没有办法检测是否使用手持浏览器(iOS/Android 手机/平板电脑)? 我尝试这样做的目的是让手持设备上的浏览器中的元素宽度减半,但这并没有什么不同。 width: 600px; @media
目前,Google Analytics for web 公开了一个设备类别字段,其离散值为mobile、tablet 和desktop。该界面还允许您更深入地了解它的具体设备。我想 Google 有某
我是一名优秀的程序员,十分优秀!