Code Monkey home page Code Monkey logo

logitech-g27's Introduction

Logitech G27 Racing Wheel for Node

Bring your Logitech G27 Racing Wheel into the wonderful world of Node.

  • Subscribe to wheel, pedal, and shifter events.
  • Activate simple force feedback effects.
  • Set wheel auto-centering and range.
  • Customize shift indicator LEDs.

Requirements

Node version 8 or greater.

Install

This library uses node-hid behind the scenes. Depending on your OS and Node version, you may have an effortless install. If not, you may want to consult node-hid's compiling from source guide for assistance.

npm install logitech-g27

Windows users who are having trouble connecting to a wheel may need to run the Logitech G Hub software one time to setup drivers.

Ubuntu users will most likely want to remove the sudo requirement of interfacing with the wheel. This can be easily accomplished by creating a file at /etc/udev/rules.d/99-hidraw-permissions.rules with the following code. After saving the file, reboot and then you can move on to more fun tasks.

KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"

Example

Let's have some fun and make our wheel LEDs light up when we press the gas pedal.

const g = require('logitech-g27')

g.connect(function(err) {
    g.on('pedals-gas', function(val) {
        g.leds(val)
    })
})

Vroom vroom sounds optional but encouraged. ^_^

API

License

CC0 1.0 Universal

This work has been marked as dedicated to the public domain.

logitech-g27's People

Contributors

forestmist avatar nightmode avatar randomite avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

logitech-g27's Issues

[Question] Spring force

Hi, came to ask if this api can interace with spring and damper load, can it?

also as a bonus wanted to ask if it can interface with button mapping, can it remap the buttons?
I really want to get rid of Wingman completely because of core isolation on windows 11.

image
wanted to implement those into a node app, but first I need to know if its possible to do these things with the api

Anyway to trigger wheel calibration or modify wheel center ?

When you first plug in the wheel it runs a calibration.

Is there a command to trigger the calibration process or adjust the center point left/right manually without unplugging /replugging the wheel.

I will check out the data exchanged via usb analyzer, but am wondering if you already came across some information while developing this.

Issues with LEDs/force commands and strange startup lock

First of all, thanks Daniel for all this good work.
I am trying to use this library on a G27, but I am experiencing big issues, especially for the control commands.

All the commands reading work fine: I can read pedal percentage and buttons pressures, and print log events as confirmation.
Every command involving sending commands TO the G27 seems to be problematic instead: I cannot use LEDs (btw, there are some typos in the Wiki, somewhere there is led() instead of leds()). I cannot use forceConstant and many other "write" commands.
I tried to add some debug log into the catch for the leds() function, but the execution never seems to go there.

Also, there is a strange behavior at the connect() event: when I connect the G27 to the USB it calibrates and goes to middle position. After I launch my node script and simply do a connect(), the steering wheel will turn right by 90 degrees and will force that position, always. As previously said forceConstant or other functions do not have any effect.

If you need it I will be able to do whatever test, maybe it could be some different hardware revision? I have tested also older versions, before 1.0 with no success.

Thank you in advance.

Latest node-hid dependency

Looks like node-hide version 2.1.1 is available and we are currently using version 1.3.0 of node-hid.

Add real unit tests for dataMap function

Hi Daniel,

first of all thanks a lot for providing this fantastic and comprehensive library for the Logitech G27 steering wheel! I'm especially impressed by its forceFeedback support. You might have noticed my fork, that tries to port your library to the G25 wheel.

One minor nitpick: Have you thought about adding "real" unit tests for the dataMap function, that compare the read buffers against the expected wheel status? This would make the job for contributors much easier, because they cannot run into regressions any more. You might take a look at my mocha tests for the G25.

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.