### Python HID Command Example Source: https://github.com/ultrawipf/openffboard/wiki/commands/header.txt This Python script demonstrates how to send and receive commands using the HID interface with the pywinusb library. It includes functions for sending commands and parsing received data. ```python import pywinusb.hid as hid import time import struct # Receive and print data def readData(data): if(data[0] == 0xA1): t = data[1] cls = struct.unpack(' ``` -------------------------------- ### OpenFFBoard Udev Rule for Linux Source: https://github.com/ultrawipf/openffboard/wiki/Linux-FFB-setup This udev rule sets the deadzone and fuzz to 0 for all axes when an OpenFFBoard is connected. Ensure the joyutils package is installed before applying. ```bash SUBSYSTEM=="input", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="ffb0", RUN+="/usr/bin/evdev-joystick --s '%E{DEVNAME}' --f 0 --d 0" ``` -------------------------------- ### Enable Optional ODrive Startup Calibrations Source: https://github.com/ultrawipf/openffboard/wiki/Setup Enable automatic motor and encoder offset calibration on startup for the ODrive. ```text odrv0.axis0.config.startup_motor_calibration=True ``` ```text odrv0.axis0.config.startup_encoder_offset_calibration=True ``` -------------------------------- ### Reverse Steering Effects in rFactor 2 Config Source: https://github.com/ultrawipf/openffboard/wiki/Games-setup Modify the steering effects strength in the rFactor 2 controller configuration file to reverse FFB forces if necessary. This is a common fix for Linux/Proton and some Windows installations. ```json "Steering effects strength":8000, ``` ```json "Steering effects strength":-8000, ``` -------------------------------- ### Verify Udev Rule Application Source: https://github.com/ultrawipf/openffboard/wiki/Linux-FFB-setup This command checks if the udev rule has been successfully applied by querying the joystick device. OpenFFBoard should report 0 for 'flatness' and 'fuzz' if the rule is active. ```bash $ evdev-joystick --s /dev/input/by-id/usb-Open_FFBoard_FFBoard_*-event-joystick Absolute axis 0x00 (0) (X Axis) (value: 0, min: -32767, max: 32767, flatness: 0 (=0.00%), fuzz: 0) Absolute axis 0x01 (1) (Y Axis) (value: 0, min: -32767, max: 32767, flatness: 0 (=0.00%), fuzz: 0) Absolute axis 0x02 (2) (Z Axis) (value: 0, min: -32767, max: 32767, flatness: 0 (=0.00%), fuzz: 0) Absolute axis 0x03 (3) (X Rate Axis) (value: 0, min: -32767, max: 32767, flatness: 0 (=0.00%), fuzz: 0) Absolute axis 0x04 (4) (Y Rate Axis) (value: 0, min: -32767, max: 32767, flatness: 0 (=0.00%), fuzz: 0) Absolute axis 0x05 (5) (Z Rate Axis) (value: 0, min: -32767, max: 32767, flatness: 0 (=0.00%), fuzz: 0) Absolute axis 0x06 (6) (Throttle) (value: 0, min: -32767, max: 32767, flatness: 0 (=0.00%), fuzz: 0) Absolute axis 0x07 (7) (Rudder) (value: 0, min: -32767, max: 32767, flatness: 0 (=0.00%), fuzz: 0) ``` -------------------------------- ### OpenFFBoard actionmaps for EA WRC Source: https://github.com/ultrawipf/openffboard/wiki/Games-setup This XML configuration file, named openffboard.xml, should be placed in the EA SPORTS WRC input actionmaps directory to enable steering input. ```xml ``` -------------------------------- ### Add OpenFFBoard to Dirt Rally 2.0 device_defines.xml Source: https://github.com/ultrawipf/openffboard/wiki/Games-setup This XML snippet should be added to the device_defines.xml file in Dirt Rally 2.0 to enable the OpenFFBoard device. ```xml ``` -------------------------------- ### Enable FFBoard Debug Mode and Select TMC Debug Bridge Source: https://github.com/ultrawipf/openffboard/wiki/TMCL-IDE-debugging Enable FFBoard debug mode and select the TMC debug bridge mainclass. This can be done via commands or by disconnecting the GUI and selecting the mainclass in the UI. ```tmcl sys.debug=1; sys.main=11; ``` -------------------------------- ### OpenFFBoard actionmaps for Dirt Rally 2.0 Source: https://github.com/ultrawipf/openffboard/wiki/Games-setup This XML configuration file, named openffboard.xml, should be placed in the actionmaps folder for Dirt Rally 2.0 to map steering axes. ```xml ``` -------------------------------- ### Configure ODrive for CAN Communication Source: https://github.com/ultrawipf/openffboard/wiki/ODrive-guide Set the CAN node ID and baud rate for ODrive to communicate with the OpenFFBoard USB interface. These settings must match the OpenFFBoard configurator. ```python dev0.axis0.config.can.node_id = 0 dev0.can.config.baud_rate = 500000 ``` -------------------------------- ### Configure ODrive CAN Speed Source: https://github.com/ultrawipf/openffboard/wiki/Setup Set the CAN bus speed for ODrive communication. Ensure this matches the FFBoard's CAN speed. ```text odrv0.can.config.baud_rate=500000 ``` -------------------------------- ### Set ODrive to Torque Control Mode Source: https://github.com/ultrawipf/openffboard/wiki/ODrive-guide Ensure the ODrive is set to torque control mode for proper operation with OpenFFBoard. This is necessary because OpenFFBoard no longer automatically sets this mode. ```python odrv0.axis0.controller.config.control_mode = CONTROL_MODE_TORQUE_CONTROL ``` -------------------------------- ### Configure ODrive Brake Resistor Source: https://github.com/ultrawipf/openffboard/wiki/Setup Set the resistance and enable the brake resistor for ODrive. The default resistance is 2 ohms. ```text odrv0.config.brake_resistor0.resistance=2 ``` ```text odrv0.config.brake_resistor0.enable=True ``` -------------------------------- ### Trigger Udev Rules Source: https://github.com/ultrawipf/openffboard/wiki/Linux-FFB-setup Command to trigger udev to apply rules to currently connected devices. Alternatively, unplugging and replugging the device will also apply the rules. ```bash sudo udevadm trigger ``` -------------------------------- ### Configure Hoverboard Motor Parameters Source: https://github.com/ultrawipf/openffboard/wiki/ODrive-guide Set motor configuration parameters for hoverboard motors. Use datasheet values for different motor types. ```python dev0.axis0.motor.config.pole_pairs = 15 dev0.axis0.motor.config.resistance_calib_max_voltage = 4 dev0.axis0.motor.config.current_control_bandwidth = 100 dev0.axis0.motor.config.torque_constant = 1 ``` -------------------------------- ### Configure ODrive for ABN Encoder (S1) Source: https://github.com/ultrawipf/openffboard/wiki/Setup Set the encoder mode to ABN for the ODrive S1. This involves configuring both the load and commutation encoders. ```text odrv0.axis0.config.load_encoder=EncoderId.INC_ENCODER0 ``` ```text odrv0.axis0.config.commutation_encoder=EncoderId.INC_ENCODER0 ```