586,072 active members*
4,575 visitors online*
Register for free
Login
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2009
    Posts
    16

    LinuxCNC gamepad (switches only) pendant

    I have just completed the HAL that enables a £2 Hong Kong USB gamepad (no analogue joysticks) to be used as a jogging pendent for the X,Y and Z axis.

    A push of the top left rear button cycles through the jog speeds. The lower left rear button must be pressed before jog can take place. Both right rear buttons when pressed give E stop. The front middle buttons select manual or programme resume.

    I did find a problem with the left hand joystick buttons that are used for X and Y. After initialisation, by the Axis postgui HAL, these button are not initialised, but return a value indicating that the left X and lower Y buttons have been pressed. The HAL logic is arranged so that you must press one of these keys to initialise the returned value before the jog enable button will work. If gamepads with joysticks do the same then you could get a jog with only the enable button pressed when using the joypad Hal files that appear online and in the Knowledge base.

    I drew the logic circuit using Free PCB circuit drawing package. I just added outlines to its library. Helps a lot for the design and HAL debugging. The HAL has run out of AND2 gates and I had to make one up using inverters and an OR gate, so adding a fourth axis might be difficult.

    I have uploaded a YouTube video of it in action
    https://www.youtube.com/watch?v=18DhP3zjP24

    Files attached:
    Attached Thumbnails Attached Thumbnails gamepad_keys.jpg   custom_panel_xml.jpg  
    Attached Files Attached Files

  2. #2
    Join Date
    Apr 2009
    Posts
    16
    I have done further work on the gamepad, adding incremental jog and correcting the HAL so that pause, run and step work using HAL code written by Anders Wallin which use Toggle2nist HAL logic to interface the run stop code. Documentation I had found indicated the maximum number of logic elements was 9, this has proved not to be the case and this HAL used 24 AND gates.
    The HAL uses an arrow (green or greyed out) to indicate whether jog or increment is selected.

    Files are attached below:
    Attached Thumbnails Attached Thumbnails not_this.gif   this.gif  
    Attached Files Attached Files

  3. #3
    Join Date
    Jan 2012
    Posts
    14
    i am about to try this joypad install thingy will report back, hopefully. mark

    ok a trip to wallmart 19.00 game controlled and woo hoo it works in just 5 minutes.

  4. #4
    Join Date
    Apr 2009
    Posts
    16
    Happy to hear of your success, if you make any improvements, please report back.

    Malcolm

  5. #5
    Join Date
    Jan 2012
    Posts
    14
    LinuxCNC with USB controller - Qjoypad - YouTube

    here is a video that i found and i followed his instructions and like i said it took me 5 minutes to get it running. i just downloaded a file installed the software plugged up my xbox controller and it worked first time. mark

  6. #6
    Join Date
    Dec 2008
    Posts
    3

    My anologue control

    This is what I did to add my joypad with ANALOGUE control from the sticks!! I used rejoystick to map the buttons initially.
    Presuming your machine is called "my-mill"
    I identified the USB joypad by typing in a terminal window
    lsusb
    My joypad is named "DragonRise Inc. Generic USB Joystick ".

    cnc-mill@cnc-mill:~$ lsusb
    Bus 004 Device 003: ID 0e8f:0021 GreenAsia Inc.
    Bus 004 Device 002: ID 0079:0006 DragonRise Inc. Generic USB Joystick
    Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 003 Device 002: ID 046d:c001 Logitech, Inc. N48/M-BB48 [FirstMouse Plus]
    Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    cnc-mill@cnc-mill:~$

    So in your machine's my-mill.hal file add the following lines

    # joypad
    loadusr -W hal_input -KRAL DragonRise

    In your machines my-mill.ini file, under the [HAL] section add the following if it is not already there
    HALUI = halui

    Add the following line to your custom_postgui.hal file The number is in mm per minute for my machine.
    setp halui.jog-speed 900

    Add the following to your custom_postgui.hal file
    net joy-x-jog halui.jog.0.analog <= input.0.abs-x-position
    net joy-y-jog halui.jog.1.analog <= input.0.abs-y-position
    net joy-z-jog halui.jog.2.analog <= input.0.abs-rz-position

    I needed to reverse the direction of Y and Z axes.
    setp input.0.abs-y-scale -127.5
    setp input.0.abs-rz-scale -127.5

    I found the left hand buttons can work under HAL too if you use input.0.btn.hat0x-is-neg, hat0x-is-pos, hat0y-is-neg and hat0y-is-pos.

    I use the right SICK x-movement (input.0.abs-rx-is-pos and input.0.abs-rx-is-neg) to increment & decrement the jog-step,
    and the right BUTTONS x-movement (input.0.btn.top and input.0.btn.thumb) to select continuous/incremental mode

    Other button mapping I found useful

    Key Function hal.btn pad-button
    F1 E-Stop input.0.btn-base 6 - Top Left lower
    F2 Power input.0.btn-top2 4 - Top Left upper
    Shf Shift-key input.0.btn-base2 7 - Top Right lower
    Ent Enter input.0.btn-pinkie 5 - Top Right upper
    F7 SpindleOn input.0.btn-base3 8 - select
    F8 Dust Extract input.0.btn-base4 9 - start
    R Run input.0.btn-base5 10 - press left stick
    End Touch-Off input.0.btn-base6 11 - press right stick

    I use the left buttons for XY incremental jog, and the right up/down for Z incremental jog.

    All in all a busy little joypad!!

    Hope this is helpful to you.

    Noel.

Similar Threads

  1. Gamepad and other questions
    By speedydumpster in forum Dynomotion/Kflop/Kanalog
    Replies: 9
    Last Post: 06-07-2015, 07:50 AM
  2. Want to Make a Hand Pendant from a Gamepad
    By glentner in forum Benchtop Machines
    Replies: 17
    Last Post: 03-16-2010, 08:47 PM
  3. My $10.00 Logitech Gamepad / Pendant
    By mattgatten in forum DIY CNC Router Table Machines
    Replies: 4
    Last Post: 06-18-2009, 04:02 PM
  4. REAL CHEAP GAMEPAD as PENDANT
    By micsit1 in forum Mach Wizards, Macros, & Addons
    Replies: 13
    Last Post: 05-29-2008, 07:19 AM
  5. gamepad help
    By drafterman in forum Mach Wizards, Macros, & Addons
    Replies: 2
    Last Post: 08-29-2007, 03:51 PM

Tags for this Thread

Posting Permissions

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