Contoler to Computer Communication

Is it possible to send data from the controller to a computer while the controller is plugged in? I was wondering about this because I want to know if it is possible to record inputs from the controller, that could be saved and used later on to help develop our programming skills.

You could probably log inputs onto an SD card in the brain. Some example code for this could be found here.
Logging to a different computer is probably not an option. Recording inputs to the brain, however, is very possible.
I’m not too experienced with this, but it is noted to be possible.

1 Like

Std::cout << whatever you want printed ;

That should do it.

VEX V5 controller is, besides all other functions, a regular USB HID device:

Bus 003 Device 006: ID 2888:0503  
Device Descriptor:
[...]
  idVendor           0x2888 
  idProduct          0x0503 
  iManufacturer           1 VEX Robotics, Inc
  iProduct                2 VEX Robotics V5 Controller
[...]
    Interface Descriptor:
      bInterfaceClass         3 Human Interface Device
      iInterface              4 V5 GAME PAD
[...]

On Linux, it reports as any other HID device, with proper descriptors and everything:

$ evtest /dev/input/event24 
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x2888 product 0x503 version 0x111
Input device name: "VEX Robotics, Inc VEX Robotics V5 Controller"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 288 (BTN_TRIGGER)
    Event code 289 (BTN_THUMB)
    Event code 290 (BTN_THUMB2)
    Event code 291 (BTN_TOP)
    Event code 292 (BTN_TOP2)
    Event code 293 (BTN_PINKIE)
    Event code 294 (BTN_BASE)
    Event code 295 (BTN_BASE2)
    Event code 296 (BTN_BASE3)
    Event code 297 (BTN_BASE4)
    Event code 298 (BTN_BASE5)
    Event code 299 (BTN_BASE6)
    Event code 300 (?)
    Event code 301 (?)
    Event code 302 (?)
    Event code 303 (BTN_DEAD)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value    127
      Min        0
      Max      254
      Flat      15
    Event code 1 (ABS_Y)
      Value    127
      Min        0
      Max      254
      Flat      15
    Event code 2 (ABS_Z)
      Value    127
      Min        0
      Max      254
      Flat      15
    Event code 5 (ABS_RZ)
      Value    127
      Min        0
      Max      254
      Flat      15
    Event code 16 (ABS_HAT0X)
      Value      0
      Min       -1
      Max        1
    Event code 17 (ABS_HAT0Y)
      Value      0
      Min       -1
      Max        1
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1646622909.609768, type 3 (EV_ABS), code 5 (ABS_RZ), value 132
Event: time 1646622909.609768, -------------- SYN_REPORT ------------
Event: time 1646622909.617750, type 3 (EV_ABS), code 5 (ABS_RZ), value 147
Event: time 1646622909.617750, -------------- SYN_REPORT ------------
Event: time 1646622909.625644, type 3 (EV_ABS), code 5 (ABS_RZ), value 166
Event: time 1646622909.625644, -------------- SYN_REPORT ------------
Event: time 1646622909.633729, type 3 (EV_ABS), code 5 (ABS_RZ), value 185
Event: time 1646622909.633729, -------------- SYN_REPORT ------------
Event: time 1646622909.641647, type 3 (EV_ABS), code 5 (ABS_RZ), value 204
Event: time 1646622909.641647, -------------- SYN_REPORT ------------
Event: time 1646622909.649615, type 3 (EV_ABS), code 5 (ABS_RZ), value 217
Event: time 1646622909.649615, -------------- SYN_REPORT ------------
Event: time 1646622909.657676, type 3 (EV_ABS), code 5 (ABS_RZ), value 227
Event: time 1646622909.657676, -------------- SYN_REPORT ------------
Event: time 1646622909.665632, type 3 (EV_ABS), code 5 (ABS_RZ), value 229
Event: time 1646622909.665632, -------------- SYN_REPORT ------------
Event: time 1646622909.681668, type 3 (EV_ABS), code 5 (ABS_RZ), value 228
Event: time 1646622909.681668, -------------- SYN_REPORT ------------
Event: time 1646622909.689647, type 3 (EV_ABS), code 5 (ABS_RZ), value 225
Event: time 1646622909.689647, -------------- SYN_REPORT ------------
Event: time 1646622909.697622, type 3 (EV_ABS), code 5 (ABS_RZ), value 208
Event: time 1646622909.697622, -------------- SYN_REPORT ------------
Event: time 1646622909.705671, type 3 (EV_ABS), code 5 (ABS_RZ), value 152
Event: time 1646622909.705671, -------------- SYN_REPORT ------------
Event: time 1646622909.713656, type 3 (EV_ABS), code 5 (ABS_RZ), value 102
Event: time 1646622909.713656, -------------- SYN_REPORT ------------
Event: time 1646622909.721656, type 3 (EV_ABS), code 5 (ABS_RZ), value 127
Event: time 1646622909.721656, -------------- SYN_REPORT ------------
Event: time 1646622913.354311, type 3 (EV_ABS), code 1 (ABS_Y), value 137
Event: time 1646622913.354311, -------------- SYN_REPORT ------------
Event: time 1646622913.362223, type 3 (EV_ABS), code 1 (ABS_Y), value 160
Event: time 1646622913.362223, -------------- SYN_REPORT ------------
Event: time 1646622913.370224, type 3 (EV_ABS), code 0 (ABS_X), value 120
Event: time 1646622913.370224, type 3 (EV_ABS), code 1 (ABS_Y), value 184
Event: time 1646622913.370224, -------------- SYN_REPORT ------------
Event: time 1646622913.378220, type 3 (EV_ABS), code 0 (ABS_X), value 115
Event: time 1646622913.378220, type 3 (EV_ABS), code 1 (ABS_Y), value 211
Event: time 1646622913.378220, -------------- SYN_REPORT ------------
Event: time 1646622913.386217, type 3 (EV_ABS), code 0 (ABS_X), value 110
Event: time 1646622913.386217, type 3 (EV_ABS), code 1 (ABS_Y), value 238
Event: time 1646622913.386217, -------------- SYN_REPORT ------------
Event: time 1646622913.394223, type 3 (EV_ABS), code 0 (ABS_X), value 106
Event: time 1646622913.394223, type 3 (EV_ABS), code 1 (ABS_Y), value 254
Event: time 1646622913.394223, -------------- SYN_REPORT ------------
Event: time 1646622913.402213, type 3 (EV_ABS), code 0 (ABS_X), value 104
Event: time 1646622913.402213, -------------- SYN_REPORT ------------
Event: time 1646622913.426214, type 3 (EV_ABS), code 1 (ABS_Y), value 227
Event: time 1646622913.426214, -------------- SYN_REPORT ------------
Event: time 1646622913.434197, type 3 (EV_ABS), code 0 (ABS_X), value 120
Event: time 1646622913.434197, type 3 (EV_ABS), code 1 (ABS_Y), value 127
Event: time 1646622913.434197, -------------- SYN_REPORT ------------
Event: time 1646622913.442251, type 3 (EV_ABS), code 0 (ABS_X), value 127
Event: time 1646622913.442251, -------------- SYN_REPORT ------------

You can even use something like QJoyPad to use it for mouse emulation or button mapping, but logging the output of evtest should get you all the data.

I have no idea how to do anything like that on Windows, though.

4 Likes

Here’s a video for you. The lead in is slow, as I want to cover the theory behind how & why to capture data in a certain way rather than just saying ‘here’s the code, have fun’.

The video uses iq for instruction, but the theory & implementation applies to v5 also. You can get an auton routine that’s 95% perfect on the 1st run.

1 Like

The controller can be used as a USB gamepad. When plugged into USB, a site like this one can read the inputs. https://gamepad-tester.com/

1 Like