惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
Cloudbric
Cloudbric
The Register - Security
The Register - Security
小众软件
小众软件
PCI Perspectives
PCI Perspectives
G
Google Developers Blog
AI
AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
TaoSecurity Blog
TaoSecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
F
Full Disclosure
N
Netflix TechBlog - Medium
博客园_首页
Last Week in AI
Last Week in AI
A
Arctic Wolf
B
Blog RSS Feed
J
Java Code Geeks
C
Cybersecurity and Infrastructure Security Agency CISA
I
InfoQ
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
NISL@THU
NISL@THU
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Jina AI
Jina AI
有赞技术团队
有赞技术团队
S
Schneier on Security
L
Lohrmann on Cybersecurity
P
Privacy & Cybersecurity Law Blog
T
Threat Research - Cisco Blogs
P
Palo Alto Networks Blog
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
Security Latest
Security Latest
Vercel News
Vercel News
博客园 - 司徒正美
Webroot Blog
Webroot Blog
Hacker News: Ask HN
Hacker News: Ask HN
A
About on SuperTechFans

夜行人

回家路上 第一期的直播演示项目 震动检测器 正能量 在线参观CodeLab Neverland 发布 CodeLab Adapter 3.3.1 DynamicTable 之 纸糊方向盘 CodeLab DynamicTable: 一个可实施的技术方案 CodeLab Insight 发布 Alpha 版 情人节 Home Assistant 周报 && IoT 周报 (02) Joplin: 关注隐私的 Evernote 开源替代软件 浏览器的未来与 Web 传感器 Home Assistant 周报 && IoT 周报 (01) 百宝箱(01) 论自由 介绍 WebThings Home Assistant 周报 && iot 周报 (00) 百宝箱(00) 毛姆读书心得 传世之作 周末徒步 CodeLab Adapter ❤️ Jupyter/Python 航班 躲雨 夏令营途中 [译]思想--作为一种技术 The future of coding 美国之行 三门问题的程序模拟 从Python转向Pharo https://blog.just4fun.site/post/iot/iot-open-source-projects/ Python异步编程笔记 https://blog.just4fun.site/post/iot/iot-open-source-hardware-community/ 万物积木化开发者社区 CodeLab ❤️ Blender Scratch3技术分析之云变量 API(第7篇) [译]对管道(Pipes)的偏爱 [译]提出正确的问题比得到正确答案更重要 蓝牙设备与Scratch3.0 创建你的第一个Scratch3.0 Extension Scratch3技术分析之项目内部数据(第6篇) Scratch3技术分析之社区 API(第5篇) Scratch3技术分析之User API(第4篇) Scratch3技术分析之项目主页API(第3篇) Scratch3技术分析之静态资源API(第2篇) Scratch3.0、micro:bit与Windows7 https://blog.just4fun.site/post/iot/zerynth-vs-micropython/ 核聚变、方所与半宅空间 可视化编程为何是个糟糕的主意 codelab.club周末聚会 关于codelab.club '下一件大事'是一个房间 Hungry Robot - Eat everything 编程作为一种思考方式 今日简史 史蒂夫·乔布斯传 罗素自选文集 https://blog.just4fun.site/post/edx/tianjin-scratch-ai/ https://blog.just4fun.site/post/edx/richie-cms-openedx/ 徒步武功山 WebUSB与micro:bit 积木化编程与3D场景 夜宿武功山顶 https://blog.just4fun.site/post/edx/video-migration-note/ scratch3-adapter重构笔记 https://blog.just4fun.site/post/edx/edx-community-members/ 两种硬件编程风格的比较 使用micro:bit自制PPT翻页笔 柏拉图对话集 scratch3.0 + micro:bit 七月电影放映计划 非营利组织的管理 Screenly--用树莓派让任何屏幕变为可编程的数字标牌 以最佳实践开始你的Django项目 micro:bit与事件驱动 为Scratch3.0设计的插件系统(上篇) OCR应用一例 近两年读过的一些好书 blockly开发之使用python驱动浏览器中的turtle(2) 牛顿新传 文学理论入门 逻辑的引擎 人生的意义 blockly开发之生成并运行js代码(1) blockly开发之hello world(0) micro:bit使用笔记 神器之Termux https://blog.just4fun.site/post/iot/micropython-notes/ Cozmo what is this Scratch的前世今生 下段旅程 我行在远方 爆裂 途中杂记 https://blog.just4fun.site/post/edx/open-edx-startup/ cozmo系列之入门 - 有性格且可编程的机器人 PaperWeekly开发笔记 创业二三事 blockly与结对编程
scratch3-adapter接入优必选Alpha系列机器人
种瓜 · 2018-09-20 · via 夜行人

文章目录

近期在scratch3-adapter中加入了优必选Alpha系列机器人的驱动,于是我们可以在scratch3.0中为优必选Alpha系列机器人编程

我们近期的另一项工作是在scratch3.0中加入课程模式(类似code.org), 之后使用scratch3-adapter + scratch3.0就可以在web中教学机器人、AI和物联网,不损失web带来的好处(瘦客户端、跨平台、记录学习情况),又能与身边的硬件互动。

当然我更期待官方的microworld,等官方推出microworld,我到时候会将硬件整合进microworld。

考虑到优必选目前只对合作伙伴公开蓝牙通信协议,所以我们暂不公开这部分的驱动代码。待将来优必选公开蓝牙协议的细节后,这部分的源码也将开放给大家。

目前我们已经给出了移除协议细节之后的源码:extension_ubtrobot.py

在此记录一些思路和开发笔记。

机器人的驱动

为了在scratch3.0中使用积木为优必选Alpha系列机器人编程,我们需要先在scratch3-adapter构建插件,与机器人通信。

我们先来看一下scratch3-adapter的架构图

优必选Alpha系列机器人对外暴露蓝牙接口。从上边的架构图看出,scratch3-adapter允许开发者自定义任何的通信方式,无论是蓝牙(BT/BLE)、usb还是wifi。

优必选Alpha系列机器人内置的是蓝牙串口服务,在Mac和windows(win10/win7)上,当电脑与机器人建立蓝牙连接之后,在本地都会虚拟出蓝牙串口。之后在自定义插件中使用pyserial与之交互即可。

但值得注意的是,树莓派(Linux)上的操作方式并不一样,在linux下,建议先安装blueman来管理蓝牙。连接机器人时,选择serial port模式,之后会虚拟出/dev/rfcomm*

由于不同操作系统的蓝牙略有差异,建议使用platform.system()来区分不同平台(Darwin/Windows/Linux)

多个控制端

近期我们在做一个实验室解决方案,一个实验桌有多位学生,共同控制一个机器人,这是n-1架构。同时希望学生端可以同时使用ipad和电脑同时控制机器人。

我们的解决方案是让scratch3-adapter跑在树莓派中,对外提供服务,之后scratch3.0与树莓派交互。而学生在浏览器中与运行在树莓派里的scratch3-adapter交互,如此一来,就实现了n个学生共同控制一台机器人。


2019.1.21更新


目前优必选已经将alpha1系列机器人的蓝牙协议开放了, 如我们之前承诺的,我们的extension的源码也开源出来了: extension_ubtrobot.py

Alpha 1同时支持ble和bt,所以现在可以做到一个client同时控制多台机器人。就是说可以实现同时跳舞的功能。