[Processing] Try using GT Force.

Introduction

This time, I heard that I tried connecting GT Force on a PC. It's easy to use using the language Processing, so please give it a try. If the controller for the game becomes free to use, the things that can be done will expand. The content of this time was based on the information on the site of "Various self-made". I don't understand this library clearly either, so the explanation is insufficient. Please note that the content is about the size of the author's memo.

Various self-made sites

The GT Force used is for PS2 and is very old. When I looked it up, there was a description that this handle controller was not compatible with Windows 10, but when I used the one for GT Force Pro, I was able to use it safely with Windows 10. However, the pedal did not respond with the logitech setup software. I thought it was a malfunction, but it worked in a later program.

Execution environment

・ Windows10 64bit ・ Processing 3.5.3 ・ Game Control Plus 1.2.2 ・ GT Force LPRC-10000

Method

① Installation of GT Force software

Install the software for GT Force Pro from the Logitech support site. I recognized it just by inserting the USB into my computer without installing it, but I recommend it because it can be calibrated. When I pressed the button on the back right of the steering wheel when adjusting with software, the steering wheel went out of control and the rotation did not stop (laughs). There is no problem so far after re-stabbing. Logitech Support Site

② Install the library

First, start processing and install "Game Control Plus" from "Sketch"-> "Import Library"-> "Add Library" on the upper tab.

(3) Check the operation using a sample sketch.

Check the sample data of "Game Control Plus" from "File"-> "Sample" on the upper tab. Select "Gcp_Configurator" and start it. Press the button to the left of the connected device name to open the details screen. You can check the operation of each button and lever there. GT Force recognized 6 buttons and 4 sliders. But of the four, the "Combined pedals" slider didn't respond. After confirming the operation, exit this program.

Next, the controller information is obtained by using the sample program in the same manner. This will be important in future programming. Select "Gcp_ShowDevices" from the "Game Control Plus" sample program you selected earlier and start it. In this program, you can check the names and numbers of sliders and buttons on the controller. The movement of the scroll bar of the program was unstable, but the following data was obtained without any problem. Record this information.


 NAME :     Logicool WingMan Formula Force GP USB
  Type :     Wheel
  Port :     Unknown
    Buttons (6)
      Type     Name               Multiplier
      button    Left Paddle         -
      button    Right Paddle        -
      button    Button 3            -
      button    Button 4            -
      button    Button 5            -
      button    Button 6            -
    Sliders (4)
      Type     Name               Multiplier     Tolerance
      slider    Wheel axis          1.0            0.0            absolute
      slider    Combined pedals     1.0            0.0            absolute
      slider    Accelerator         1.0            0.0            absolute
      slider    Brake               1.0            0.0            absolute

Keywords used when programming.

Quoted from Site of "Various self-made".

Include the library.

import net.java.games.input.*;
import org.gamecontrolplus.*;
import org.gamecontrolplus.gui.*;

Declaration of controller to use, etc.

ControlIO control;
ControlDevice device;
ControlSlider[] sliders = new ControlSlider[4];
ControlButton[] button =new ControlButton[6];

This requires changing the number of arrays depending on the device used.

Load the device (declare in setup ())

control = ControlIO.getInstance(this);
device = control.getDevice("Logicool WingMan Formula Force GP USB");//Change depending on the equipment used.

Slider assignment (declared in setup ())

sliders[0] = device.getSlider(0);

Now you can declare. Since I created an array called "sliders []" earlier, I assigned it to it. If there are multiple buttons, change the number.

Get the slider value

sliders[0].getValue()

The value from the slider can now be easily retrieved.

Button assignment (declared in setup ())

button[0] = device.getButton(0);
button[0].plug(this, "func1", ControlIO.ON_PRESS);//Processing when the button is pressed
button[0].plug(this, "func2", ControlIO.ON_RELEASE);//Processing when the button is released

The button was set like this. Each function name can be set and executed when an event occurs. The function is declared as follows.

void func1(){
//The process you want to execute
}
void func2(){
//The process you want to execute
}

It can be easily executed by combining the above keywords.

Manipulating values

The value output from the controller was a positive to negative value, so it was necessary to adjust the value. In that case, it is convenient to use the "map" function. When converting x from the range of a → b to the range of c → d

float x = map(x,a,b,c,d);

It's easy to use like this.

in conclusion

This makes it very easy to use the game controller. Processing can be easily connected to Arduino via serial communication, so I thought that the things I could do would expand.

Recommended Posts

[Processing] Try using GT Force.
Try using libGDX
Try using Maven
Try using powermock-mockito2-2.0.2
Try using GraalVM
Try using jmockit 1.48
Try using SwiftLint
Try using Log4j 2.0
Beginners try using android studio Part 2 (event processing)
Try using Axon Framework
Try using JobScheduler's REST-API
Try using java.lang.Math methods
Try using Talend Part 2
Try using Talend Part 1
Try using F # list
Try using each_with_index method
Try using Spring JDBC
Try using RocksDB in Java
Try using GloVe with Deeplearning4j
Try using view_component with rails
Try scraping using java [Notes]
Try using Cocoa from Ruby
Try using letter_opener_web for inquiries
[Swift] Try using Collection View
Data processing using Apache Flink
Try using Spring Boot Security
[Swift] Asynchronous processing using PromiseKit
[Rails] Try using Faraday middleware
Csv output processing using super-csv
[Programming Encyclopedia] §2 Try using Ruby
People using docker Try using docker-compose
[Java] Try to solve the Fizz Buzz problem using recursive processing
Try implementing asynchronous processing in Azure
Implement declarative retry processing using Spring Retry
Try using Redis with Java (jar)
[Java] Try to implement using generics
Try using the messaging system Pulsar
[Kotlin] Example of processing using Enum
Try using IBM Java method tracing
Deleting files using recursive processing [Java]
Perform parallel processing using Java's CyclicBarrier
Try using Hyperledger Iroha's Java SDK
[Java] Where did you try using java?