Forum Rule: Always post complete source code & details to reproduce any issue!
Page 8 of 8 FirstFirst ... 6 7 8
Results 176 to 182 of 182

Thread: Many axis joystick

  1. #176
    Junior Member
    Join Date
    Feb 2013
    Posts
    7
    Hi, I'm trying to create a custom class so to use a custom device (pretty similar to JOYSTICK_INTERFACE, but with different bit resolution, for few axes, and few more buttons).
    The first step I did was modifying the JOYSTICK_INTERFACE (in usb_desc.c), and usb_joystick.c and usb_joystick.h, and everything is working as expected (axis and buttons are recognized).

    So I created my custom usb_cougar.c, and usb_cougar.h, which mirrors usb_joystick.c and usb_joystick.h, and modified :
    * usb_desc.c
    * usb_desc.h
    * boards.txt
    * usb_inst.cpp
    * WProgram.h

    The Arduino app shows the new entry "Cougar", under Tools--> USB Type ... But when I compile and upload, it something gets broken (fails to connect to the usb device and returns the error below).

    No Teensy boards were found on any USB ports of your computer.
    Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.
    So: question time:
    * Am I missing some file that needs to be modified?
    * Is it possible to have an USB_TYPE which is only a plain JOYSTICK and not a sort of hub/group of (Serial)+Keyboard+Mouse+Joystick?
    * Is it possible to change the names of the axis which are shown in Windows, (e.g. to something more appealing than Rx Ry Rz)?


    BTW thanks for the very interesting info in this post!

  2. #177
    OK So I have been reading over this thread again since it has been a while since changing my descriptors to use the Extreme Joystick but I have only been using the 128 buttons and nothing else at the moment..

    However I have a couple of questions as I wasn't to move into using the axis and possibly sliders (not sure if those will work on the primary programs I use) but in any case my question has to do with the relation of the hardware to the Profiles.

    I am currently using the Teensy LC for my system but I was trying to figure out how the Hardware input to the Joystick actually relates as from what I understand the ADC's only put out a value of 1024 (-512 / +512) but the joystick will of course output 16bit.. So my understanding is essentially even though the the joystick is reporting 16bit because the ADC is only at 10 bits the DC is the bottle neck..

    Im trying to figure out by what method I might get a true 16 bit signal or if it is even possible..

    Thank you

  3. #178
    Junior Member
    Join Date
    Feb 2013
    Posts
    7
    As far as I understand, considering that you are using the Teensy LC, according to tech specs, you are limited to 12bit max (its ADC has an usable resolution of 12bit).

    You may change the resolution of the analogRead, with analogReadResolution(desired bit), so analogReadResolution(12) at most for Teensy LC. That's the raw data, as far as what you pass to the Joystick class, it really depends on how your code is implemented.

    So I would say that with the Teensy LC there is a limitation to 12bit raw signal, while, then you may map it / modify it, smooth it within Arduino.

    Ultimately, on the OS side, it expects a sequence of data, formatted according to the contents of usb_desc.c (JOYSTICK_INTERFACE or the interface you are using), so if it expect 16bit data, it will read (at most) 16bit data for the axis.

    Just my 0.02$.

  4. #179
    Quote Originally Posted by antares190 View Post
    As far as I understand, considering that you are using the Teensy LC, according to tech specs, you are limited to 12bit max (its ADC has an usable resolution of 12bit).

    You may change the resolution of the analogRead, with analogReadResolution(desired bit), so analogReadResolution(12) at most for Teensy LC. That's the raw data, as far as what you pass to the Joystick class, it really depends on how your code is implemented.

    So I would say that with the Teensy LC there is a limitation to 12bit raw signal, while, then you may map it / modify it, smooth it within Arduino.

    Ultimately, on the OS side, it expects a sequence of data, formatted according to the contents of usb_desc.c (JOYSTICK_INTERFACE or the interface you are using), so if it expect 16bit data, it will read (at most) 16bit data for the axis.

    Just my 0.02$.
    That was sort of what I was thinking is that re-mapping would give me the 16bit to the computer but in REALITY it would only be 10bit with maybe some interpolation algorithm (which I will need to look into as that will be new for me) as the actual RAW would only be 10 bit (using default).. Thank you for the tip on the 12bit though as I didn't realize that as that will give me a bit more raw resolution.. So that is a hel, Thank you..


    ANOTHER QUESTION: (though you sort of asked the same question above.. so for someone else :-) )

    What might be done to the USB header file if I wanted to remove the Keyboard and Mouse functionality so that ONLY Joystick and Serial are used.. I really kind hate that my device in the end shows up as a Keyboard in windows, but, I can't just use Joystick as I need Serial for some other communication and as well I found that having the Serial as well is the ONLY way to get Windows to recognize a custom device name.

  5. #180
    Junior Member
    Join Date
    Feb 2013
    Posts
    7
    Ok, I managed to find the error of my implementation, as it was related to one of the question I arose, I thought of reporting it here, as if you are going to implement your own joystick it may be of use.

    All the additions/modifications were fine, but since I took as reference the "Serial/Keyboard/Mouse/Joystick" interface, it had a lot of stuff (I'm not really interested in having), among them:

    KEYMEDIA_INTERFACE

    The problem is that its KEYMEDIA_INTERFACE_DESC_POS is defined taking into account MTP_INTERFACE_DESC_POS, which in turn is defined taking into account JOYSTICK_INTERFACE_DESC_POS+JOYSTICK_INTERFACE_DES C_SIZE, so I simply had to add my interface size to the MTP_INTERFACE_DESC_POS definition.

    #define COUGAR_INTERFACE_DESC_POS SEREMU_INTERFACE_DESC_POS+SEREMU_INTERFACE_DESC_SI ZE
    #ifdef COUGAR_INTERFACE
    #define COUGAR_INTERFACE_DESC_SIZE 9+9+7
    #define COUGAR_HID_DESC_OFFSET COUGAR_INTERFACE_DESC_POS+9
    #else
    #define COUGAR_INTERFACE_DESC_SIZE 0
    #endif


    #define MTP_INTERFACE_DESC_POS JOYSTICK_INTERFACE_DESC_POS+JOYSTICK_INTERFACE_DES C_SIZE+COUGAR_INTERFACE_DESC_SIZE
    #ifdef MTP_INTERFACE
    #define MTP_INTERFACE_DESC_SIZE 9+7+7+7
    #else
    #define MTP_INTERFACE_DESC_SIZE 0
    #endif
    So I have a question: is it possible to have a simple USB_JOYSTICK_INTERFACE, with only the joystick? Or how can I drop keyboard, keymedia and mouse (I can live with Serial or SerialEmulation, as it is very handy)?

    Thanks

  6. #181
    Junior Member
    Join Date
    Sep 2020
    Posts
    6
    I have a Teensy 4.1 controller. Is there a version of the "extreme_joystick_test3.zip" that supports the 4.1? I tried coping the following files (usb_desc.h, usb_joystick.c, usb_joystick.h and usb_desc.c) into the Teensy 4 folder but this caused compile errors. When I compare the v3 to v4 there are significant changes to the files. Any support would be appreciated...

  7. #182
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,664
    Did you try simply editing the one file/line I mentioned in the other thread? I believe that all of this stuff has been included in the main USB stuff when you set the JOYSTICK_SIZE to 64...

    And I would expect these files to be reasonably different between T3.x and T4.x... Also the one in the zip file is a lot behind the one that currently installs for T3.x.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •