Skip to content

2lian/gogo_keyboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gogo Keyboard

Press keyboard 🦍 Get key 🦍 Unga Bunga

Requirements Compatibility
python
sdl2
mit
asyncio
ROS 2
zenoh

Python Asyncio library to simply get keyboard presses and releases. Gogo Keyboard creates a new independent SDL2 window that captures the key events.

pip install gogo_keyboard[dll]
python3 -m gogo_keyboard.example

Motivation:

  • Keyboard presses and releases in Asyncio.
  • Only when clicking on the Gorilla window.
  • Python terminal is free for other tasks.
  • Based on asyncio_for_robotics for seamless compatibility with:
    • ROS 2
    • Zenoh
    • More
python python python

Installation

This library requires sdl2 and sdl2_image. By specifying the [dll] optional dependency, those will be installed by pip.

pip install gogo_keyboard[dll]

Conda pacakge: soon!

Python Example

Example is provided here and can be run with python3 -m gogo_keyboard.example.

Here is a minimal piece of working code:

import asyncio
from gogo_keyboard.keyboard import KeySub

async def async_main():
    key_sub = KeySub()
    async for key in key_sub.listen_reliable(exit_on_close=True):
        print(key)

asyncio.run(async_main())

ROS 2 Example (Humble, Jazzy, Kilted)

A very simple ROS 2 node is provided here, run it with python3 -m gogo_keyboard.ros_node. The messages format is a json formatted String, 🦍 simple 🦍 Unga Bunga.

Zenoh Example

A very simple Zenoh publisher is provided here, run it with python3 -m gogo_keyboard.zenoh_node. The messages format is a json formatted String, 🦍 simple 🦍 Unga Bunga.

About

Press keyboard 🦍 Get key 🦍 Python Asyncio for Robotics

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages