Code Monkey home page Code Monkey logo

ros2-keyboard's Introduction

ros2-keyboard

This node uses the SDL library to grab keypresses. To do so, it opens a window where input is received. This window needs to becurrently focused, otherwise this node will not receive any key presses.

Install

  1. Create a new workspace.
  2. $ cd /path/to/your_ws/src
  3. Clone this repository
  • (ssh) $ git clone [email protected]:cmower/ros2-keyboard.git
  • (https) $ git clone https://github.com/cmower/ros2-keyboard.git
  1. Install SDL 1.2 with the command sudo apt install libsdl1.2-dev.
  2. $ cd /path/to/your_ws
  3. $ colcon build

Nodes

keyboard

Publishes keyboard events when the window is focused.

  • Published topics: keydown and keyup (keyboard_msgs/Key)
  • Parameters
    • allow_repeat (bool): Enables or disables the keyboard repeat rate. Default is false.
    • repeat_delay (int): How long the key must be pressed before it begins repeating. Default is SDL_DEFAULT_REPEAT_DELAY.
    • repeat_interval (int): Key replay speed. Default is SDL_DEFAULT_REPEAT_INTERVAL.

keyboard_to_joy.py

Converts keyboard events to a joy message.

  • Published topic: joy (sensor_msgs/Joy)
  • Subscribed topics: keydown and keyup (keyboard_msgs/Key)
  • Parameters
    • config_file_name (str): File name for the configuration file. See here for an example.
    • sampling_frequency (int): Rate (Hz) at which joy messages are published. Default is 50.

Example:

In one terminal, start the keyboard node.

$ ros2 run keyboard keyboard

In a second terminal, start the keyboard_to_joy.py node.

$ ros2 run keyboard keyboard_to_joy.py --ros-args -p config_file_name:=/path/to/keyboard/config/example_config.yaml

Remember to replace /path/to with the path to where you cloned the keyboard repository.

ros2-keyboard's People

Contributors

cmower avatar adohaha avatar mstoelzle avatar v01d avatar varunagrawal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.