Laser Keyboard Kit II Comes: Smaller and Better

Our open-source laser projection keyboard kit now has its second generation!

The new generation only has 1/2 the height of its predecessor. It is so cute to allow you to put this little guy into your pocket.

compare

We also redesigned its optical system. You will feel the key input experience more reliable and precise. Enjoy it 🙂

working

 

3D print technology are used everywhere. In this new kit, 3d printed shell make the assemble process become simple and easy. Just a few steps, your laser keyboard II will work.

thekit
Where to buy?

Currently, DFRobot is our designated agent to sell Laser Keyboard Kit II:

Click the following link for details:

http://www.dfrobot.com/index.php?route=product/product&product_id=1122#.U05dpvmSySo

Related Documents:

Signal Processing Software:

The Source Code:

License Issue:

All the source code is licensed under LGPL by default.

Git Repos:

https://github.com/robopeak/laserkbd

NOTICE: no warranty for the sourcecode and the related software.

How to build from the source code?

Please refer to this article.

RPLidar Laser Scanner On Sale

We once announced our low cost Laser Scanner, RPLIDAR in the last year. After about half year, we have achieved better product quality through optimizing design as well as the production process. Currently the first batch of mass production RPLIDAR is ready for sale.

P1070717

Now, we are proud to announce, RPLIDAR will be released in the end of this April! And you can order it via support@robopeak.com.

RPLIDAR is a low cost LIDAR sensor suitable for indoor robotic SLAM application. It provides 360 degree scan field, 5.5hz rotating frequency with guaranteed 6 meter ranger distance.  By means of the high speed image processing engine designed by RoboPeak, the whole cost are reduced greatly, RPLIDAR is the ideal sensor in cost sensitive areas like robots consumer and hardware hobbyist.

rplidarmass-production version of RPLIDAR

Performance and Specification

The RPLIDAR core engine performs high speed distance measurement with more than 2000 samples per second. For a scan requires 360 samples per rotation, the 5.5hz scanning frequency can be achieved. Users can customized the scanning frequency from 2hz to 10hz freely by control the speed of the scanning motor. RPLIDAR will self-adapt the current scanning speed.

rplidar_specEach RPLIDAR to be produced must pass several strict tests and perform calibration to ensure more than 6-meters’ ranger distance with the laser output power still complies with CLASS I standard.

For more details, please refer to the datasheet.

SLAM Application

Good SLAM result can be achieved via RPLIDAR. The following video is based on RPLIDAR and our RPMini robot platform:

mergedWe will release the related ROS node to help users integrate RPLIDAR into ROS system. For product level application, we are developing our high performance SLAM solution which is optimized for RPLIDAR. Our SLAM solution can work greatly within embedded systems.

Development Kit

To help user to quickly evaluate our RPLIDAR, the first mass production volume is provided as development kits. A development kit includes an RPLIDAR with build-in motor driver and a usb adaptor to allow the RPLIDAR to be connected to PC. Besides, the open source SDK and demo applications are provided.

kitimageItems included in a Development Kit

rplidarsdk_en

the related SDK and Documents

Order Information

Please contact our support email for details: support@robopeak.com

 

 

RPLIDAR激光雷达正式发售

去年我们对外发布了RPLIDAR的原型机,这是一款测量半径6米以上、360度全向视角、扫描频率5.5hz的2D激光雷达,同时它也是一款机器人SLAM的理想传感器。与动辄上万的同类传感器相比,RPLIDAR采用了自主研发的光学图像引擎,极大地消减了成本,使之更适合于成本敏感的领域,诸如消费级产品和广大机器人爱好者。

rplidar

RPLIDAR产量版本的外观图

经过半年多的努力,我们对设计工艺进行了诸多优化,目前RPLIDAR已经顺利完成了首批量产。我们宣布RPLIDAR将于今年四月底正式对外发售!

目前我们已开始接受预订订单,请联系support@robopeak.com了解详情。

P1070717

性能指标与规格

RPLIDAR的激光测距引擎可以实现每秒2000次的测距操作,在保证每周360个角度采样解析度的条件下,可实现5.5hz的扫描频率。用户也可以自行调制扫描电机转速,实现2hz-10hz不等的扫描频率,RPLIDAR仍然自适应当前的实际转速正确输出每一个角度位置所对应的距离值。

rplidar_spec

我们在出厂时对每台RPLIDAR都进行了各项严格校正和检测,保证6米以上的测距距离,并且确保激光发射功率符合Class I要求。

具体的性能指标请参考 RPLIDAR说明文档

机器人同步定位与自主建图 (SLAM)

基于RPLIDAR进行SLAM可以实现非常优秀的SLAM效果,如下是我们的RPmini机器人采用RPLIDAR进行实时室内SLAM建图的视频。

merged

与此同时,我们也即将发布对应的ROS Node,方便用户将RPLIDAR快速整合进入ROS当中。此外,对于产品级别应用,我们也专门开发了针对RPLIDAR优化的SLAM以及自主运动的解决方案,它无需PC参与,可以在嵌入式设备中高效进行SLAM:

开发者套装

为了方便用户能够快速的评估RPLIDAR的性能并且整合到自己的系统当中,我们的首批量产机型是以开发套装的形式发售的。开发套件集成了扫描电机的驱动器,可以通过USB连接PC的适配器,以及开源的SDK和实例程序。

kitimage

 

RPLIDAR开发者套装

rplidarsdk_cn随开发套装配套的SDK与文档

订购信息

请联系support@robopeak.com询问订购的具体事宜

 

RoboPeak Mini USB 显示屏升级版震撼来袭

English Version

RoboPeak迷你USB 显示屏上市以来,受到了大家的热烈欢迎。很多爱好者给我们提了很多宝贵的意见和建议。现在,USB显示屏的升级版即将上市,它将给您带来更多更好的体验。

最新固件支持:

此次RoboPeak迷你USB显示屏采用了最新的1.04固件,加入了数据压缩算法可以使得整体的画面显示更加流畅。

支持更多的开发板:

在本次更新中,我们加入了对ArduionYun, WR703以及Iteaduino Plus A10开发板的支持。相关的预编译固件可在固件下载页面获得。

Iteaduino-Disp

  • ArduinoYun 

ArduinoYun-Disp

  • WR703

P1070200

常见问题解答:

针对此前用户的常见问题,我们整理了常见问题解答列表。如果大家还有进一步的疑问,欢迎与support@robopeak.com取得联系。

用户态驱动程序及应用开发软件包:

我们即将发布针对RoboPeak迷你USB显示屏的用户态驱动程序及应用开发软件包。届时,您将可以使用此开发包在Windows/Linux/MacOS上直接开发针对USB显示屏的应用程序。敬请期待!

请点此获得最新用户手册

请点此获得购买方式

RoboPeak Mini USB Display upgrade version is coming

中文版

RoboPeak Mini USB Display sales very well since last October. We received a lot  variable comments and suggestions from customer. Now, the upgrade version of USB display is coming.

Latest firmware support:

The upgrade RoboPeak Mini USB display uses latest 1.04 firmware which boost frame rate a lot by supporting data compression.

Supporting more devices:

We supporting more devices in this version: ArduinoYun, WR703 and Iteaduino Plus A10. You can download related pre-built ROM in the firmware download page.

Iteaduino-Disp

  • ArduinoYun

ArduinoYun-Disp

  • WR703

P1070200

Frequently Asked Questions:

We made a FAQ List for frequently asked questions. Please feel free to contact support@robopeak.com if you have any other questions.

User mode driver and application SDK:

We will publish user mode driver and application SDK for RoboPeak Mini USB display in the coming weeks. By then, you can develop display application easily with the SDK in Windows/Linux/MacOS. Stay tuned!

Click here for the latest User Manual

Click here for the purchase information

RoboPeak Mini USB Display Debut

中文版

Notice: purchase methods are listed in the end of this article.

Preface: In the past, among the world of the phonograph, no sound, no matter how beautiful the voice will be that you will not hear. Nowadays, on the hustle and bustle of Open Source stage, no screen, no matter how wonderful the show will be that you can not see. Now, as an important tool of the Open Source Hardware, RoboPeak Mini USB Display (aka RPUSBDisp) debuts for everybody on the grand stage.

RPUSBDIAP

Introduction

As computing terminal expanded gradually from the desktop to the portable handheld device, we have witnessed the rapid development of smart phones. The complex operating system also gradually get rid of the bloated body to be ported into MiniPC from PC including RaspberryPi, Cubieboard, the rounter embeded with OpenWrt, etc. Those become compact and easy to carry embedded platform with majority has Ghz level of the CPU.

P1070216

Like MiniPC, with a compact system but containing considerable computing resources, becomes the computing solutions the various enthusiasts and many open source hardware vendors have been dreaming of for some time. However, some interactions like debugging or displaying for MiniPC still need those bulky HDMI monitor or even TV.

In order to allow the device having same portability and saving power, RoboPeak is proud to release RPUSBDisp, the portable USB monitor with touch screen. It is designed specifically for MiniPC with same size of business card, and just requires a USB cable to make it work without additional power supply.

Features

Extensive Device Support

You could leverage it as a display to present most of embedded development board on the current market (such as RaspberryPi, Cubieboard, etc.). Benefit from USB interface that provides opportunity for those devices that cannot connect with monitor for display in the past like Router. In addition, we support Arduino Yun and Intel Galileo Developer Edition!

Standard Device Interface

With the drivers developed by RoboPeak, RPUSBDisp can be identified as a standard display and touch-screen device by target operating system, that means any existing graphical interface program can be displayed without any modification.

Open Source Brings More Possibilities

As an open source project, we provide its schematics, communication protocols, Linux kernel driver code and so on. That helps you create more creation easily based on RPUSBDisp.

Then, let’s screen a video to show you how to use RPUSBDisp.

Specification

  • Display Resolution: 320×240
  • Color Depth: 16bpp
  • Screen Size: 2.8 inch
  • Communication: USB2.0 Full-Speed
  • USB Interface Specifications: Micro-USB
  • Touch Screen: Resistive Single Point
  • Size: length 74mm, width 60mm

Please download the document Datasheet for more specific product parameters.

Supported Hardware Platforms

RPUSBDisp can support any computing devices having USB Host communication functionality to act as a standard display or touch screen devices. You only need to add the corresponding driver. For the majority of embedded devices installing Linux OS, we offer open source kernel driver.

For your convenience, we offer some precompiled ROM image on common development platform, such as the popular raspberry-pi, cubieboard etc. You just simply need to download those image files and burn them into your development board to enable RPUSBDisp.

Currently we offer the following platforms ROM images downloaded and will be constantly increasing then, please take the section Firmware Download at the tail of this article to get the ROM image downloading address according to your requirement.

1. Raspberry PI
P1070153

2. Cubieboard (I Generation and II Generation)
P1070140

3. pcDuino
P1070182

4. MiniPC TV Sticks based on Allwinner A10/ Rockchip RK3066 Solutions (MK802, UG802, etc.)
P1070194

5. WR703 Mini Router
P1070200

Usage

Please download the document User Manual for specific Usage.

As a newly launched product, the core driver of RPUSBDisp has not yet become part of the firmware produced by MiniPC manufactures by default. So, to make RPUSBDisp to work, you need to install RPUSBDisp drivers.

Quick Start: Using Prebuilt ROM Image

For common MiniPC, you simply download and flash the ROM image which included USB display driver provided by us.

We provide most of MiniPC SD-card ROM image, you can use some mirror writing tools (windows: Win32DiskImager, Linux / Mac: dd)  to flash the image into SD card.

For those built-in Nand Flash devices (e.g. Cubieboard, most MiniPC TV stick), we offer some packaged nand flash ROM images, using corresponding download tools will flash the ROM image to be stationed into your development edition permanently.

For specific operation details, please take the User Manual as reference.

Advanced Usage: Kernel Driver Compilation and Implementation

For those devices we have not yet provided ROM image supported, do not worry, we provide RPUSBDisp Linux kernel driver code. You can follow the bellow documentation or the steps in the README of source code to compile the code into driver to drive RPUSBDisp run on your device.

Experienced User: Customizing Driver

For those customer that our driver cannot meet your requirement, you can also customize more powerful driver according to published USB communication protocol specification from us.

Prebuilt MiniPC ROM Download

The officially supported Mini PC ROM by RoboPeak can be downloaded via the following link: DOWNLOAD ADDRESS

Documentation & Source Code

If no additional explanation, all the source code abides by GPL v2, or the license in the code. Any copyright  of the document and source code listed above is belong to RoboPeak.

If you find any bug or have any suggestions, please leave comments here or contact with us by email (support@robopeak.com) .

Attention: RoboPeak will not undertake any relative legal obligations and liabilities of any possible loss caused by misuse of open source code.

How to buy?

Currently, DFRobot is our designated agent to sell RPUSBDisp, warm welcome to access the following address for purchase.

http://www.dfrobot.com/index.php?route=product/product&product_id=1062

RoboPeak Mini USB显示屏粉墨登场

English Version

提示:购买方式请点此
引言:过去,在留声的世界里,没有声音,再好的戏也听不到;如今,在喧嚣的开源舞台上,没有屏幕,再好的戏也出不来。RoboPeak Mini USB显示屏(下称RPUSBDisp)作为开源硬件的一款重要利器粉墨登场与大家隆重见面。

RPUSBDIAP

简介

随着计算终端逐渐由桌面向掌上转移,我们见证了智能手机的蓬勃发展。而过去复杂的操作系统也逐渐摆脱了庞大的身躯,从桌面PC移植到到了MiniPC中:树梅派、Cubieboard、可以运行OpenWrt的路由器等,这些变得小巧,易于携带的嵌入式平台,同样大多拥有Ghz级别的CPU。

P1070216

像MiniPC这样如此小巧的系统所蕴藏着的不可小视的计算资源成为了各爱好者和众多开源硬件厂商梦寐以求的计算解决方案。然而以往在MiniPC上进行调试或者需要显示图像画面与用户交互时,依旧要借助那笨重的HDMI显示器或者电视机。

为了让设备显示同样的便携与省电,RoboPeak荣幸推出便捷式带有触摸功能的USB显示器。它专门针对MiniPC设计,仅有名片那么大,只需要一根USB数据线即可工作,且无需额外供电。

特点

广泛的设备支持

您可以使用它作为目前各种嵌入式开发板(如树梅派、Cubieboard等)的显示器来使用!得益于USB接口,这使得以往无法连接显示器输出的设备也有机会通过RPUSBDisp显示画面,比如您的路由器就可以。并且我们也支持Arduino Yun,Intel Galileo 开发版!

标准的设备接口

配合RoboPeak开发的配套驱动程序,RPUSBDisp可以被目标操作系统识别为标准的显示器和触摸屏设备,这意味着任何现有的图形界面程序无需做任何的修改即可在RPUSBDisp显示。

开源意味着更多可能

作为开源项目,我们提供了它的原理图、通讯协议、Linux内核驱动代码等。方便您基于RPUSBDisp实现更多的创意。

下面我们先通过一段视频向各位展示RPUSBDisp是如何使用的。

性能提要

  • 显示器分辨率:320×240
  • 色彩深度:16bpp
  • 屏幕尺寸:2.8吋
  • 通讯方式:USB2.0 Full-Speed
  • USB接口规格:Micro-USB
  • 触控屏:单点电阻式
  • 尺寸大小:长74mm,宽60mm

请参考文档数据手册获取更多产品参数信息。

支持的硬件平台

RPUSBDisp可以支持任何具有USB Host通讯功能的计算设备,作为他们的标准显示器和触摸屏设备。您只需增加对应的驱动程序即可。对于目前被绝大多数嵌入式设备使用的Linux平台,我们提供了开源的内核驱动。

为了方便您的使用,我们提供了常见开发平台,如流行的树梅派(raspberry-pi)、cubieboard等的预编译ROM镜像。您只需要简单的将这些镜像文件下载,写入您的开发板内即可使用RPUSBDisp了!

目前我们提供如下平台的ROM镜像下载(将不断增加中),相关下载链接请参考后文的固件下载章节。

1. 树莓派
P1070153

2. cubieboard (I代与II代)
P1070140

3. pcDuino
P1070182

4. 基于Allwinner A10/ Rockchip RK3066方案的MiniPC 电视棒 (MK802,UG802等)
P1070194

5. WR703N迷你路由器
P1070200

使用方式

请参考用户手册文档了解具体的使用方式。

RPUSBDisp作为一款全新的产品面世,其核心的驱动尚未成为MiniPC厂商固件里默认的一份子。为了让RPUSBDisp工作,您需要安装RPUSBDisp配套的驱动程序。

快速上手:使用预装驱动的ROM镜像

对于常见的MiniPC,您只需简单的下载并刷入由我们提供的预装有USB显示屏驱动程序的ROM镜像即可。

我们提供了绝大多数MiniPC平台的SD卡ROM镜像,可以使用镜像写入工具(windows: Win32DiskImager, Linux/Mac: dd)将镜像写入SD卡,即可使用。

对于具有内置Nand Flash的设备(比如Cubieboard、大多数MiniPC电视棒),我们提供了打包好的nand flash ROM镜像,使用配套的下载工具即可将支持RPUSBDisp显示的ROM永久固化在您的开发版内。

具体的操作方式请参考用户手册

进阶使用:编译内核驱动实现支持

对于我们尚未提供ROM镜像的设备,也不用担心,我们提供了RPUSBDisp的Linux内核驱动代码。您可以按照下文文档和源代码中README的步骤自行编译驱动,即可将RPUSBDisp在您的设备上运行。

资深用户:自定义驱动程序

对于不满足我们现有驱动方式的用户,也可以通过我们公布的USB通讯协议规范自定义更加强大的驱动程序。

固件下载

获取RoboPeak官方支持的固件请点击:下载地址

文档与源代码

如不额外说明,这次给出的源代码均遵循GPL v2协议规范,或者以代码中采用的许可为准。文档的版权均归RoboPeak所有。

如果在使用过程中遇到Bug或者有任何改进建议,请给我们留言或联系我们 (support@robopeak.com)。

注意:RoboPeak不对任何因不当使用开源代码而可能造成的损失承担法律责任。

购买方式

目前DFRobot作为我们的指定代理商负责销售RPUSBDisp,欢迎访问下列地址购买。

 

激光键盘软件源代码编译和修改指南

English Version: http://www.robopeak.net/blog/?p=332

I. 简介

RoboPeak 开源虚拟激光投影键盘设计的所有源代码已经发布在Github上。该源代码遵循LGPL许可。只要遵循LGPL许可的规范,您可以随意的使用或者修改本源代码。

本文旨在介绍如何在Windows以及MacOS平台上编译RoboPeak 开源虚拟激光投影键盘的信号处理软件。此外,也介绍了一些技术细节问题,帮助您理解代码并开发新的酷功能。

快速参考:

  • 如何在Windows上编译运行代码
  • 如何在MacOS上编译运行代码
  • 更多细节

II.  从源代码编译的理由

首先,从源代码编译允许您体验到我们为激光键盘开发的最新功能,这些功能并不会立刻在稳定版本中发布。您可以成为最早体验这些功能的人。

其次,如果您需要对我们的软件做出修改或者做改进。能编译源代码就是必经之路了。

此外,如果我们的信号处理软件无法在您的系统运行,那么在我们团队做出修正前,您可先尝试自己编译源代码来解决此问题。

III. 先要准备的

  • Windows

Windows XP 以及更高版本

Visual Studio 2010 (带有VC++包) 或者 Visual C++ 2010 express (更高的版本也可工作,但我们暂不作保证)

Git工具支持 (例如: msysgit)

  • MacOS

OS10.7 或更高版本 (我们使用OS10.8)

XCode 4.5 或者带有gcc支持的更高版本 (我们不使用 llvm-gcc进行编译)

GIT 工具(您可使用 macport or homebrew 来安装它)

除了上述的系统环境需求外,我们默认您具有基本的软件开发基础,例如:了解如何在Windows/MacOS上开发编译C++的程序,知道OpenCV是什么,GIT是什么。此外,您需要知道如何从github clone源代码

IV. 在Windows上编译运行源代码

STEP1: 从Github clone源代码

我们推荐您使用tortoise-git clone源代码到您本地的文件夹中,如下图例子那样;
tutorisegit_clone 或者直接基于如下命令行:

git clone https://github.com/robopeak/laserkbd.git

在Cl0ne完毕后,您应该看到如下的文件结构: cloned_source

STEP2: 在VS2010中编译

进入laser_kbd_neo 文件夹并打开VS项目文档:laser_kbd.sln:

vs2010

您只需要选择Release编译配置并开始编译即可。编译完毕后,您可以在 laser_kbd_neoRelease文件夹中找到编译好的可执行文件:laser_kbd.exe

vs_compiled

STEP3: 将必要的依赖文件复制并打包

上述编译产生的可执行文件需要其他依赖文件才能执行,并且这些依赖文件需要与可执行文件位于同一个目录。因此您需要将这些文件复制过来。我们推荐您创建一个新的目录,例如在代码根目录下建立一个output这样的目录,并将laser_kbd.exe以及下列文件夹、文件复制进来:

  • laser_kbd_neores 文件夹
  • sdkpackrefdll*.dll

最终的软件包应该看起来像这样: vs_released

大功告成!

现在您自己编译的信号处理软件已经可以工作了! win32_done

V. 在MacOS下编译源代码

STEP#1 Clone源代码

使用如下命令将Github的源代码clone至您本地的文件系统:

$ git clone https://github.com/robopeak/laserkbd.git

在clone完毕后您应该看到如下的文件结构

Shikais-MacBook-Pro:laserkbd csk$ ls
README.md laser_kbd_neo sdkpack

STEP#2 在XCode中编译运行

进入目录laser_kbd_neo/xcode, 打开项目文件LaserKeyborad.xcodeproj.

xcode_compile

您可以直接点击运行按钮就可以编译出可以执行的软件包了(Debug版本)

macos_compiled

VI. 实现细节浅析

1. 文件组织

本源代码文件按照如下的结构进行组织

<source root>
      +---- laser_kbd_neo/            <--- 所有的源代码、IDE用到的工程文档
      |          +---- ref/           <--- 第三方库的源代码
      |          +---- res/           <--- 软件所用到的图片、数据等文件
      |          +---- src/           <--- 信号处理软件自身的源代码
      |          |      +---- port/      <--- 平台相关的源代码
      |          +---- xcode/         <--- MacOS/xcode相关的源代码和项目文档
      |          |---- laser_kbd.sln  <--- Visual Studio 2010项目文档
      +---- sdkpack
                 +---- license_and_copyrights/   <--- 第三方库的许可协议和README文档
                 +---- ref/
                        +---- dll/               <--- 第三方库的预编译dll (win32)
                        +---- lib/               <--- 第三方库的预编译lib (win32)
                        +---- inc/               <--- 第三方库的头文件
                        +---- dylib/             <--- 第三方库的预编译dll (MacOS)

 

2. 如何将代码移植到其他平台下?

本信号处理软件在开发初期就考虑了高度可移植性,表现在:

1) 所有的核心处理逻辑都是平台无关的代码

2) 所有平台相关的代码都放在了目录 src/port 里

3) 在平台相关/平台无关代码之间有明确的接口作桥梁

4) 所有依赖到的第三方库也是高度跨平台的,例如: OpenCV

如果您打算将源代码移植到新的平台下,您需要为这个新平台实现一个新的移植层(port layer)。这个移植层至少需要提供如下功能:

  • 按键事件注入

当“键盘”按下后,往OS注入对应的键盘事件

  • 摄像头视频捕捉已经曝光控制

由于OpenCV本身不允许用户代码控制摄像头的曝光参数,因此移植层需要实现这个机制。

所有对平台相关代码的调用接口都定义在了src/port/common文件夹里面。如果您确定要开始移植工作,则应该从这些接口定义开始入手。

此外,您也可以参考目前Windows和MacOS上的移植层。

3. 如何修改键盘布局?kbd_layout

位于src/keyboard_emu/layout_provider.cpp 的代码控制信号处理软件内部的键盘布局信息。 (实际的虚拟键盘投射元件也需要做出修改).

通过修改 _key_mapper[] 描述数组,可以实现对软件中键盘布局的修改。

4. 如何实现在“按键”时播放声音提示?

该功能已经在Windows平台中实现.

由于播放音频的方法是与具体操作系统相关的,因此推荐将这个功能放在移植层里面实现。这里将举例说明如何在Windows上实现这个功能。

我们使用如下的Win32 api实现播放一段制定的wav音频:

BOOL sndPlaySound(
 LPCTSTR lpszSound,
 UINT fuSound
 );

在这个例子里,我们使用的音频文件叫做type.wav. 当用户“按键”后,windows就会播放这个声音:

在移植层中定义了接口OSKeyInjector::injectKeyEvents用于操作用户“按键”以后的事情. 可以从这里入手加入播放声音的功能:

如下是Windows平台中该接口的原始实现代码 (keyinjector_win32.cpp)

    virtual bool injectKeyEvents( const std::vector<KeyEventDesc> & intputlist)
    {
        if (!intputlist.size()) return false;

        INPUT * inputs = new INPUT[intputlist.size()];

        do
        {
            for (int pos=0; pos<intputlist.size(); ++pos)
            {
                inputs[pos].type = INPUT_KEYBOARD;
                inputs[pos].ki.wVk = intputlist[pos].keyval;

                if (intputlist[pos].type == KEY_EVENT_PRESSED) {
                    hasinputs = true;
                    inputs[pos].ki.dwFlags =  0;
                } else {
                    inputs[pos].ki.dwFlags =  KEYEVENTF_KEYUP;
                }

                inputs[pos].ki.time = 0;
            }

            SendInput(intputlist.size(), inputs, sizeof(INPUT));

        }while(0);

        delete [] inputs;

        return true;
    }

我们将它修改如下:

    virtual bool injectKeyEvents( const std::vector<KeyEventDesc> & intputlist)
    {
        if (!intputlist.size()) return false;

+        bool hasinputs = false;

        INPUT * inputs = new INPUT[intputlist.size()];

        do
        {
            for (int pos=0; pos<intputlist.size(); ++pos)
            {
                inputs[pos].type = INPUT_KEYBOARD;
                inputs[pos].ki.wVk = intputlist[pos].keyval;

                if (intputlist[pos].type == KEY_EVENT_PRESSED) {
+                    hasinputs = true;
                    inputs[pos].ki.dwFlags =  0;
                } else {
                    inputs[pos].ki.dwFlags =  KEYEVENTF_KEYUP;
                }

                inputs[pos].ki.time = 0;
            }

            SendInput(intputlist.size(), inputs, sizeof(INPUT));

        }while(0);

        delete [] inputs;

+        if (hasinputs && g_config_bundle.playsound) {
+            // play sound feedback
+            std::string soundfile = FILEPATH_RESOURCE_SOUND_FOLDER;
+            soundfile += "type.wav";
+            ::sndPlaySoundA( soundfile.c_str(), SND_ASYNC);
+        }

        return true;
    }

这样按键声音反馈功能就实现好了。您可以自行编译github的源代码体验一下:)

Tips for Compiling the Laser Keyboard Software Source Code

I. Introduction

Currently, the full source code of RoboPeak open source laser projection keyboard design has been published on Github. The released source code applies the LGPL license. You can freely use the code and modify it as long as you follow the terms described in LGPL. This article describes how to compile the source code of the  signal processing software for RoboPeak Laser Projection Keyboard on Windows and MacOS systems. Besides, some in-depths implementation details are provided to help you understand the source code and make cool modifications.

Quick Ref:

  • Compile the source on Windows
  • Compile the source on MacOS
  • More details

II.  Reasons to compile the source code

Firstly, compiling the source code allows you to experience the latest features which hasn’t been included in the stable release version yet. You can be the very first personal to trail these cool features.

Secondly, if you want to make some modifications/improvements to the current design, compiling the source code is the first step.

Thirdly, if you find our released signal processing software cannot work on your system, compiling the source code by yourself may be a quick solution before RoboPeak team release bug fix to your issues.

III. Prerequisite

  • Windows

Windows XP or higher version

Visual Studio 2010 (with VC++ package installed) or Visual C++ 2010 express (higher version may work as well, but they haven’t been tested yet)

Git Tool support (e.g. msysgit)

  • MacOS

OS10.7 or higher (we use OS10.8)

XCode 4.5 or higher with GCC support (we don’t use llvm-gcc)

GIT tool (you can install it using macport or homebrew)

Besides the above requirements, we also assume you have some basic ideas related to software developement: e.g. how to compile a C++ program on Windows/MacOS, what OpenCV is , what GIT is , etc Also, you need to clone the latest source on github.

IV. Compile the source code on Windows

STEP1: clone the source code from github

We recommend you to use tortoise-git to clone the source code to your local folder. The following is an example: tutorisegit_clone or using the following command:

git clone https://github.com/robopeak/laserkbd.git

You should get the following file structure after the clone operation has been finished: cloned_source

STEP2: Compile the source using VS2010

Enter the laser_kbd_neo folder and open the VS solution file laser_kbd.sln:

vs2010

To build the source code, simply using the Release configuration and start build. You will find the compiled binary file laser_kbd.exe under the folder: laser_kbd_neoRelease:

vs_compiled

STEP3: Copy the essential files to build the working package

The generated executable requires its dependencies to be present in the same folder. You need to copy these dependencies to make the compiled software work. It is recommended to create a clean folder like output under the root of the source code: i.e.   laserkbd_source_rootoutput Copy the above laser_kbd.exe into this folder, and the following files as well:

  • laser_kbd_neores folder
  • sdkpackrefdll*.dll files

The final package should look like the following: vs_released

Done!

The signal processing software build by your own is ready to go now! win32_done

V. Compile the source code on MacOS

STEP#1 Clone the source code

Clone the laser keyboard source code to your local folder using the following command:

$ git clone https://github.com/robopeak/laserkbd.git

You should find the following files/folders in the cloned source folder:

Shikais-MacBook-Pro:laserkbd csk$ ls
README.md laser_kbd_neo sdkpack

STEP#2 Compile the source using XCode

Enter the folder laser_kbd_neo/xcode, open the project file: LaserKeyborad.xcodeproj.

xcode_compile

You can execute the final workable software package simply click the Run button (for debug version)

macos_compiled

VI. Implementation tips

1. file organization

The source code tree is organized based on the following structure:

<source root>
      +---- laser_kbd_neo/            <--- All the source code/IDE project files/3rd party libs src
      |          +---- ref/           <--- source code of the 3rd party libs
      |          +---- res/           <--- image/data required by the software
      |          +---- src/           <--- source code of the signal processing software
      |          |      +---- port/      <--- target platform dependent code
      |          +---- xcode/         <--- MacOS/xcode related code and the project file
      |          |---- laser_kbd.sln  <--- Visual Studio 2010 solution file
      +---- sdkpack
                 +---- license_and_copyrights/   <--- license/readme files of the 3rd party libs
                 +---- ref/
                        +---- dll/               <--- prebuilt dll binaries of the 3rd party libs (win32)
                        +---- lib/               <--- prebuilt static lib binaries of the 3rd party libs (win32)
                        +---- inc/               <--- header source of the 3rd party libs
                        +---- dylib/             <--- prebuilt dll binaries of the 3rd party libs (MacOS)

 

2. How to port the code to other platforms?

The signal processing software is inherently designed with highly portability:

1) all the core logic is implemented as platform independent

2) all the target specific code. is located under the src/port folder

3) there is a clean interface between the platform independent code and the target specific code.

4) all the 3rd libs required by the software are highly portable as well, e.g. OpenCV

If you want to port the code to a new platform, you should implement a new port layer for that platform. The port layer should provide at least the  following functions:

  • Key event injection

Inject key events to the target OS when virtual keys is pressed

  • Camera video capture and exposure control

As openCV doesn’t provide interface to allow user code to control a camera’s exposure value. The port layer should implement it.

The interfaces to  the target specific code are defined in the header files under the src/port/common folder. If you really want to do the port work, you should start from that place.

Also, the existing Windows and MacOS port layers are good reference for you.

3. how to change the keyboard layout?kbd_layout

The code inside the file src/keyboard_emu/layout_provider.cpp controls the keyboard layout used by the software (the actual keyboard layout projector should be changed as well).

You can modify the _key_mapper[] array to change the layout.

4. how to add sound feedback when a “key” has been pressed?

This feature has been implemented on Windows target.

As the way to playing a sound is target specific, it is recommended to implement the code inside the port layer. Here is the example to show you how to do this on Windows platform.

We use the following Win32 API to play a sound from a given wav file:

BOOL sndPlaySound(
 LPCTSTR lpszSound,
 UINT fuSound
 );

In the example, we choose a wav file called type.wav. When user press “keys”, Windows will play the sound.

The interface OSKeyInjector::injectKeyEvents defined in the port  layer will be invoked when user pressed “keys”. It should be a good place for us to added the sound feedback.

Here is a snapshot of the injectKeyEvents implementation on Windows platform (keyinjector_win32.cpp)

    virtual bool injectKeyEvents( const std::vector<KeyEventDesc> & intputlist)
    {
        if (!intputlist.size()) return false;

        INPUT * inputs = new INPUT[intputlist.size()];

        do
        {
            for (int pos=0; pos<intputlist.size(); ++pos)
            {
                inputs[pos].type = INPUT_KEYBOARD;
                inputs[pos].ki.wVk = intputlist[pos].keyval;

                if (intputlist[pos].type == KEY_EVENT_PRESSED) {
                    hasinputs = true;
                    inputs[pos].ki.dwFlags =  0;
                } else {
                    inputs[pos].ki.dwFlags =  KEYEVENTF_KEYUP;
                }

                inputs[pos].ki.time = 0;
            }

            SendInput(intputlist.size(), inputs, sizeof(INPUT));

        }while(0);

        delete [] inputs;

        return true;
    }

We changed the above code to the following:

    virtual bool injectKeyEvents( const std::vector<KeyEventDesc> & intputlist)
    {
        if (!intputlist.size()) return false;

+        bool hasinputs = false;

        INPUT * inputs = new INPUT[intputlist.size()];

        do
        {
            for (int pos=0; pos<intputlist.size(); ++pos)
            {
                inputs[pos].type = INPUT_KEYBOARD;
                inputs[pos].ki.wVk = intputlist[pos].keyval;

                if (intputlist[pos].type == KEY_EVENT_PRESSED) {
+                    hasinputs = true;
                    inputs[pos].ki.dwFlags =  0;
                } else {
                    inputs[pos].ki.dwFlags =  KEYEVENTF_KEYUP;
                }

                inputs[pos].ki.time = 0;
            }

            SendInput(intputlist.size(), inputs, sizeof(INPUT));

        }while(0);

        delete [] inputs;

+        if (hasinputs && g_config_bundle.playsound) {
+            // play sound feedback
+            std::string soundfile = FILEPATH_RESOURCE_SOUND_FOLDER;
+            soundfile += "type.wav";
+            ::sndPlaySoundA( soundfile.c_str(), SND_ASYNC);
+        }

        return true;
    }

Now the sound feedback feature has been implemented. You may checkout the latest source to have a try:)

开源低成本虚拟激光键盘

虚拟键盘第二代已经推出,点击此处了解

简介

使用激光将一个虚拟的键盘投射在桌面上并能正常使用是非常Cool的事情。不过现成的产品相对还比较贵。

这里我们很荣幸向大家介绍由我们团队成员设计的开源低成本的虚拟激光键盘方案! 通过本方案,您也可制作出自己的虚拟激光键盘来:)

我们的开源版本支持多搭10个按键的键盘事件输入,支持组合键和输入法。可以与一个标准键盘外设那样在Windows和MacOS下面工作。


此外,它也可以作为一个多点触摸板来使用,并能感知手指的“压力”:


演示视频

http://v.youku.com/v_show/id_XMzIwMDc1Mjgw.html

工作原理

低成本激光投射虚拟键盘的设计制作-上(原理和硬件)

http://www.csksoft.net/blog/post/lowcost.laserkbd_part1.html

低成本激光投射虚拟键盘的设计制作-下(算法与实现)

http://www.csksoft.net/blog/post/lowcost.laserkbd_part2.html

我们的设计基于了PC机上进行的计算机视觉来处理按键事件。采用了一个由摄像头和激光器组成的测距系统工作。

本设计所需要的硬件非常简单,只需要3个核心部件即可实现:一个摄像头、一个激光器以及投射键盘图案的投射激光。这也是正是低成本的奥秘所在了。

当用户在桌上“按下”一个虚拟的按键后,手指上反射的激光信号会被摄像头捕捉。随后安装在PC/Mac上的信号处理软件就会进行最核心的工作:通过反射的激光光斑定位用户的指尖位置,并求出对应的按键:

如何制造一台?

最简单省力的办法是购买套件自己组装。目前 DFRobot 正帮助我们进行这类DIY套件的生产和销售。该套件中包含了所有所需的元件,并且我们也为它设计了一个详细的教程来指导你进行组装调试。

期待属于您自己的激光键盘制作诞生:)

套件链接:

http://www.dfrobot.com.cn/index.php?route=product/product&product_id=759

配套的使用文档:

配套的信号处理软件:

源代码:

代码许可:

在不做特殊说明前提下,这里给出的代码均使用LGPL授权。

Git Repos:

https://github.com/robopeak/laserkbd

注意:我们对提供的代码质量不做出任何保证,Play at your own risk. 😛

如何编译源代码?

参考这篇教程