Setting 3 Pos switch for APM Mode selection

Guys,

 

I'm a little confused as to what and how to set-up a 3 pos switch.  I would like the 3 positions to be:

 

Manual

Stabilize

RTH

 

The Arduino interface says:

 

 If you only want 3 modes set 1=2, 3=4, 5=6 and set your switch to produce 1165, 1425, and 1815 (assuming you want hardware failsafe MUX)
*/

#define POSITION_1 AUTO
#define POSITION_2 AUTO
#define POSITION_3 FLY_BY_WIRE_B
#define POSITION_4 FLY_BY_WIRE_B
#define POSITION_5 MANUAL  // Software Manual - recommended
#define POSITION_6 MANUAL  // Hardware Manual - you can put something else here, but the hardware multiplexer will force manual control

 

How do I change the settings to get what I want?  Where does the 1=2, 3=4, and so on go?


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

Join diydrones

Email me when people reply –

Replies

  • Developer
    Adam - seriously, if you have not been able to get this together with the fairly specific directions I gave you then you really should not be trying to fly alpha code.

    Wait for the firmware to be stable and the manual to be finished.
  • @Jason,

    Are you refering to my post or Max Levine's. Did you see the video I posted as well?
  • Video now posted on my page regarding the questions asked in this thread. Please view and comment back here.
  • Developer
    Here is my 6 position Mode switch.
    Maybe you'll find it helpful :)

    Hot glue on the plate from other side.

    Using switch debug, mark the positions on the knob.

    And you good to go.

    no mixing, no programing, hardcore DIY :)))
  • Developer
    Adam,

    To add to Dave's answer - we have written the software to allow you to select between up to 6 modes based on the pulse width input on channel 7 (8). Depending on what you have available on your transmitter you may be able to utilize 2, 3, or 6. Ideally mix a two position and three position switch (and set the relevant travel adjustment) on your transmitter to get the six pulse widths specified in the config file comments. As Dave mentioned you can use the radio test program or the debug option to monitor the pulse width while you play with your transmitter. Depending on your TX, getting theses pulse widths set can be easy or a real pain. You don't need to hit the exact values, but you should be close.

    If you don't want to do this and just want 3, then you can just use a three position switch. I would HIGHLY recommend setting the endpoints so that the high position is above 1750 microseconds as this is the value that triggers the hardware multiplexor and gives you the failsafe manual mode. I won't toss out the whole discussion here, but be aware there are really two Manual modes - one using the hardware and one using software.

    In the config file only the positions corresponding to pulse width inputs you are inputting are relevant. My comment about setting 1=2 etc is just a best practice.
  • Adam,
    The things that have to be set are the following:(I use three modes - MANUAL, FlyByWireA, AUTO)
    1. you need to set up your transmitter so you get three different pulse widths on the control channel (you can use the radio_test program (or DEBUG_SUBSYSTEM == 1 in APM_config.h) to watch the values - I had to mix my gear switch and my flap switch on the transmitter. The values that matter are listed in the "control_modes.pde" code - here is the important part:
    byte readSwitch(void){
    int pulsewidth = APM_RC.InputCh(MODE_CHANNEL);
    if (pulsewidth > 1230 && pulsewidth <= 1360) return 2;
    if (pulsewidth > 1360 && pulsewidth <= 1490) return 3;
    if (pulsewidth > 1490 && pulsewidth <= 1620) return 4;
    if (pulsewidth > 1620 && pulsewidth <= 1749) return 5; // Software Manual
    if (pulsewidth >= 1750) return 6; // Hardware Manual
    return 1;
    }
    2. Now you set the modes based on those measured values (I was able to set my transmitter up so that I got 1100, 1250, and 1800) and therefore here are the changes to my APM_config.h file:
    #define POSITION_1 FLY_BY_WIRE_A
    #define POSITION_2 AUTO
    #define POSITION_3 FLY_BY_WIRE_A //doesn't matter
    #define POSITION_4 FLY_BY_WIRE_A //doesn't matter
    #define POSITION_5 MANUAL // Software Manual - recommended - doesn't matter
    #define POSITION_6 MANUAL
    3. When you startup on the ground at home with the serial monitor going, you will see the modes printed out (I use GCS_PROTOCOL set to 5) (watch out for modes that will spin the prop like AUTO !!!)
  • ANYONE?...How do I change the modes for input #7 on the APM? The instructions in the arduino interface do not explain. Anyone with knowledge or idea's please reply.
This reply was deleted.

Activity