Lights &, joystick mapping

Hi everyone,
I am trying to use the buttons on my joystick to operate Lights and smoke on my rover/boat. I can use the extra channels to operate the lights etc via the X & Y axis on the Joystick but that leaves me on channel short. I have 7 extra buttons on my joystick so I was hoping to map the channels to the buttons but can figure out how to do it.
I'm using APM 2.6, MP, Turnigy receiver servo switches, 3DR radio, Thrustmaster T-Flight joystick.
I will also post this on the new site.
Thanks in advance
RS

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Moderator

    ???

    ...Or, you can map the buttons in the joystick interface using a DO_SET_SERVO and a PWM value

    3702214238?profile=original

    • Hi Graham,
      I have tried that and I can map Roll (rudder) on the Rz and Throttle on the slider. I tried the auto detect on the buttons but it only detects the slider.
      Are you saying I can pick a button and change the "ChangeMode" to DO_SET_SERVO and then adjust the PWM value in the Full params list?
      How do I set the channel I want to use? Do I hit the settings button next to the "DO_SET_SERVO"?
      Thanks in advance,
      RS

    • Moderator

      I don't have the system in front of me but from what I remember you pick a button and change the "ChangeMode" to DO_SET_SERVO and then adjust the PWM in the settings button next to the dropdown box.

      You'll have to set one button high (eg 1900) and one low (eg 1100) - (for on/off). In the settings it'll have the channel and a single PWM value.

      It should autodetect the button if you click autodetect and tap the button, we used a standard game controller and could map all the buttons this way. If you can't get the buttons to show up or work then you might need a different controller or the right driver, you can check if it's working through the standard Windows game controller interface.

    • Hi Graham, In most cases the Joystick config works as intended. I am able to use the auto detect, but there are limits, for instance the channel options will see the joystick axis movement but they will not see the button activation and only record "Slider 1" no matter what button I push. The button section auto detect works as it should and sees what ever button I push. For peace of mind I reloaded the driver for the joystick and re-installed Mission Planner to ensure I have the latest version. This made things a lot smoother.

      I have followed your instructions and set up the DO_SET_SERVO on two channels one with a high PWM 1000 I think and the other high 1900PWM.

      But where I am stuck now is the DO_NOT_SET settings options asks me for the "Servo #" as I have the switch plugged into ch6 I assumed that that would be the servo number but no, I have also tried "A6" neither work.

      Can you please tell me what the "Servo #" correlates to on the APM outputs?

      Please see attached image.

      Thanks,

      RS

      Screenshot (1).png

      https://storage.ning.com/topology/rest/1.0/file/get/3702811225?profile=original
    • Moderator

      Hi Richard, you can see your servo IN's (#) and OUT's in the status window, anything non-zero is getting it's value from the RC Rx or are assigned in the Joystick window, this is mine with nothing connected:

      3702859713?profile=originalCH1-8 show OUT values and those are the corresponding OUT's on the Pixhawk. You must "calibrate" any channel you want to use by manually giving it a max and min PWM value in the full parameter list (eg RC6_MAX - 2000/RC6_MIN - 1000/RC6_TRIM - 1500) otherwise it will not work.

      If you put a servo now on RC6 OUT on the Pixhawk with 5V power, and have one DO_SET_SERVO pushing 1900 and another pushing 1100, that servo should respond when those buttons are pressed, you should also see that CH go high or low in the status window.

  • @Darius,
    Thank you!!!!!
    Sounds a bit above my head but I'll give it a go.
    Thanks again,
    RS

  • @Richard,

    generally, you can do your job with a single channel and protocol implemented to let you map every button on your joystick and send button codes to your rover/boat

    and have rover/boat run script to parse the protocol codes and invoke actions within APM.

    So you need to script APM via a single channel.

    If scripting is enabled rover/boat - side, you can do it.

    You can assign ANSI alike codes to joystick buttons (extended range).

    Here are some examples :

    https://www.autohotkey.com/docs/misc/RemapJoystick.htm

    https://www.autohotkey.com/docs/KeyList.htm

    Joystick test scripts

    https://www.autohotkey.com/docs/scripts/JoystickTest.htm

    Xbox joystick mapping by natural numbers

    http://answers.unity3d.com/questions/8094/what-are-all-the-joystick...

    Remapping a Joystick to Keyboard or Mouse | AutoHotkey
    Learn how to make joystick buttons or other joystick controls send keystrokes or mouse clicks.
This reply was deleted.