Shop OBEX P1 Docs P2 Docs Learn Events
QuadX - my latest Propeller with Propellers - Page 6 — Parallax Forums

QuadX - my latest Propeller with Propellers

12346

Comments

  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-07-24 14:04
    ratronic wrote: »
    Robert also now that you are getting close to flying I would recommend that before you actually fly it (do not touch for at least 2 seconds after power up to allow the gyro to setup) I would find a way to SAFELY hold it by hand staying clear of the propellers and then give it enough throttle so that you can feel it giving some lift.

    At that point while you are holding it up in the air you should feel it try to resist your rocking it from side to side and front to back. If you feel that resistance to rocking it back and forth then give it a shot. If you do not then you still have something to work out.

    Make sure you have a firm grip and throttle up slowly while holding for the first time in case you still have something wrong.

    This is an excellent idea - it's how I test the thing to make sure it's "close enough" before I test fly it. That said, be *really* careful that you have a firm grip, and start with just enough throttle to spin all the props. If your gyro is backwards, the system will go into a feedback loop, and can make the props spin very quickly in a very short period of time. Be ready to put the throttle back to zero quickly if necessary. The props we use are very sharp, and can easily cut you - I have done it myself a number of times, and it's always been from doing something careless or in a hurry. Once you've verified that the three different axis are responding properly, then you can turn up the throttle and get a feel for how it "fights you" when you try to tilt or twist it.
  • rpdbrpdb Posts: 101
    edited 2012-08-05 21:45
    Hi All,

    1. Try fly.
    2. Flip on take-off
    3. Break some props, bent the roll bar on top of the electonics
    4. repeat twice with minor changes.
    5. Quad back on workbench.
    6. Sign of Optomism. New Props ordered and arrived/installed.
    7. Working on code, line by line. Using prop term to observe the I/o on the prop board.

    Getting close to flying.

    Robert
  • ratronicratronic Posts: 1,451
    edited 2012-08-06 09:31
    Robert I would follow Jason's thought's in post#152 to save yourself some propellers! Also if your craft is wired to the QuadX specs then try this program to check your gyro status. This is Jason's QuadXV2 flight code modified to disable the motor control output and show the program's Igx, Igy, and Igz accumulated gyro variables on the serial terminal. The GyroOrientation variable in the DAT section compensates for how your gyro is physically mounted. Try all three posibilties to make the IgX variables to respond like this -

    Igx = more positive values when the craft is rotating towards it's left
    Igy = more positive values when the craft is rotating towards it's front
    Igz = more positive values as the craft is rotated C.C.W.

    You will need to have your transmitter on and give a little throttle to see the variables to start to accumulate. The motor control output is commented out so the motors will not run.

    EDIT:Wired to QuadX specs except the gyro wiring keep it as it is working for you.
  • rpdbrpdb Posts: 101
    edited 2012-08-07 19:31
    Thanks again Dave,

    I really appreciate your help! This is what I am doing now, just looking at the outputs on the motor pins and inputs on the rc. Your snippets of code or so much help, I found that my throttle was greater than -370:

    'Zero all targets when throttle is off - makes for more stable liftoff
    if( Thro < -370 ) 'was -370 rpdb changed to <0 looking at the values from rccheck.spin
    iGx := iAile := 0
    iGy := iElev := 0
    iGz := iRudd := 0
    DoIntegrate := false
    else
    DoIntegrate := true'

    I kept having one motor drooping off to a stop on an idle and one spinnig up. Usually the LR or LF.like you posted in the Ken/Cluso99/ W9GFO/JasonD's QuadCopter Build Log et.all thread.
    That RCcheck.spin is helping me alot to figure out the Futaba tx/rx.

    I have also been changing the code to output the motor outputs to the PST and watching the responses. I have put myself on a time out from trying to fly, and learning alot.

    I have some questions:

    1. When you state "Igx = more positive values when the craft is rotating towards it's left" does that mean 'as you sit in the drivers seat of "the craft" or as you are looking at the front of it, as in a passenger car, the drivers side or passenger side. My quad is responding as one would expect ie twist craft to left on z axis, the ccw props increase.to counter-act.

    2. When they discuss gain on Ken/Cluso99/ W9GFO/JasonD's QuadCopter Build Log about the hoverfly board switching to gain to 60% etc, does that equate to the PID filter level of : Filter_Heavy, Filter_Moderate and Filter_Light = $4923A29C ? or are they talking about a gain setting on the sticks of the rc transmitter?

    3. In the Dat section of the QuadX v2 code what settings, what do you have with the following::


    PitchRollControlScale long 4 ' 8 (rapid), 4 (agile), 2 (slower), 1 (beginner)
    YawControlScale long 4

    PitchRoll_PGain long $9_6000 '2400 << 8
    PitchRoll_IGain long 400
    PitchRoll_DGain long $0A00_0000 '2560 << 16
    PitchRoll_D2Gain long $4000_0000 '16384 << 16

    Yaw_PGain long $24_0000 '10240 << 8
    Yaw_IGain long 400
    Yaw_DGain long $1400_0000 '6400 << 16

    ?

    Thanks,

    Robert.
  • ratronicratronic Posts: 1,451
    edited 2012-08-07 20:38
    Robert Hoverfly's program no one has seen. My best guess is that their gain adjustment alters in some way the PID section of their program. Jason's PID settings he talks about in post#50 in this thread and a little better explanation of how to tune the PID in post#810 in the Builders forum quadcopter thread.

    The DAT section of gyro output.spin is how my craft is set now. I have played with the PID settings but I left them set where Jason tuned them for the ELEV-8. I think the confusion comes from Jason using the word "gain" in place of "gear" for the gear channel receiver instruction. It actually switches in a filter for the gyro that I think he is planning to use for self leveling when he gets that working.

    As far as determining oreintation the best way I can think of is pretend your craft is a ball sitting still on the floor with four sides marked front, rear, left, and right. If you are looking down upon it which way would it have to roll (rotate) to go closer to that side or twist CW or CCW. Jason's filter and Hoverfly's gain I think are different things. I hope Jason pops in if I have stated something not right.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-08-07 23:28
    Dave is right about the filter, gain, and PID settings. The Hoverfly software uses the gain value as a multiplier for the PID values (at least, I assume that's what they do). My own software uses the gain channel to control the noise filter. I only have it set that way to allow me to switch between them for testing - I'd like to set my own up to work like the Hoverfly board with the adjustable gain. On the other hand, having the gain set in code allows you to use a 4 channel radio and receiver, or use the extra channel for something else, like a camera gimbal.
  • nomadnomad Posts: 276
    edited 2012-08-13 01:23
    hi ratronic,

    today i make a first - test with your rccheckquadxv2.spin
    i find your programm verry helpful....

    my own rc-prog base on BS2-stuff as: PULSIN(ch_1,1)
    verry old stuff and archaric (my englich :-) )

    i have a analog receiver mhz 35, with 7 channels
    stick 1 right (left/right) turns
    stick 2 left (for/backwards) moves
    slider Throttle
    3-ways-switch modi-control

    my quadcopter have a + configurations

    running your program:

    the output on pst-terminal:
    ch1 0
    ch2 1500
    ch3 1500
    ch4 1500
    ch5 1500
    ch6 1500

    no response of my sticks on my sender

    i have made changing some stuff:

    1) long a[5] to long a[6] (6 channels)
    2) the pins
    on my propeller protoBoard-usb

    - P0 - P7 = Sensoren:
    - p0 = not used
    - p1,p2 - 1) LaserRangeFinder: output cm from ca. 25 - 150 cm
    p3,p4 - 2) L3G4200D: Output x,y,z in Degrees ?
    p5,p6 - control yellowLed (P5 for GPS Steady or Search)
    p7 - 3) GPS:

    - P8 - P13 = RC-6-channels input - this is important
    - P16 - P19 = ESC-4xServoPorts

    i have changed your
    rc.setpins(%111111)
    to
    rc.setpins (%0011_1111_0000_0000) right to left p0-p15

    is this correct ?? or wrong

    many thanks for help, tips and hints

    regards nomad
  • ratronicratronic Posts: 1,451
    edited 2012-08-13 08:18
    nomad I am sorry but I do not have the time to figure out the modifications needed for Jason's code to work with your custom setup. I could possibly help you more if it was wired to the QuadX specifications.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-08-13 21:50
    Nomad - You're better off using the attached object for the R/C input. The one you have likely has the pin mask hard-wired in the assembly portion of the code - the mask isn't properly implemented. The one I've attached is from the Sport / Open version of the code, and it handles the pin assignments properly. If you change the PinMask value in the Start method, you should get correct inputs.
  • nomadnomad Posts: 276
    edited 2012-08-13 22:19
    hi jason
    thank you verry much for your help
    today i testing your code and make a response to you
    thank you
    regards nomad
  • nomadnomad Posts: 276
    edited 2012-08-14 02:01
    re: RC_Receiver-Open.spin

    hi jason,
    thank you for your help.

    i have testing your code.
    1) on your code i have make a change at
    - my inputPins: p8,p9,p10,p11,p12,p13
    PinMask := %0011_1111_0000_0000

    2) for running the code i take the rccheckquadxv2.spin code
    with some improvements:
    (excuse i dont know how i can change to the code - show)
    --- code

    Var

    long a[6] -> 6 channels

    Obj

    pst : "parallax serial terminal"
    rc : "RC_Receiver_Open_10" -> aka change PinMask

    Pub main | i

    pst.start(115200)
    'rc.setpins(%111111)
    rc.start
    repeat

    repeat i from 0 to 5
    a := rc.get(i)

    pst.char(1)
    pst.str(string("ch1: ",11))
    pst.dec(a[0])
    pst.str(string(13,"ch2 ",11))
    pst.dec(a[1])
    pst.str(string(13,"ch3 ",11))
    pst.dec(a[2])
    pst.str(string(13,"ch4 ",11))
    pst.dec(a[3])
    pst.str(string(13,"ch5 ",11))
    pst.dec(a[4])
    pst.str(string(13,"ch6 ",11))
    pst.dec(a[5])

    waitcnt(clkfreq/100+cnt)
    --- code end


    the programm runs fine, thanks a lot.

    one failure on ch6:
    on my receiver its a "3-way-switch"
    - switch 1 (down) = value should be 2_000
    2 (middle) = 1_500
    3 (up) = 500

    at the moment is the value of a[5] (ch6: 1_500) (static) no response if i make a switch
    how can i improve this ??
    is this my fault or the program cant detect such switches ?

    many thanks
    regards nomad
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-08-14 09:46
    The switches are no different than other channels to the code, so of your radio is configured correctly you should see the switch change the value. Try plugging that channel from your receiver into a different channel on the Propeller. If it works that way, it is probably a wiring problem with that last channel.
  • rpdbrpdb Posts: 101
    edited 2012-08-14 22:06
    Hi Dave, Hi Jason,

    Thanks for your help. I am waiting on some more props on back order from HK and a couple LiPo's. I bought a set of props from Parallax just for bench testing and to feel the feedback. I really appreciate the RCtest.spin and am learning alot watching the values and waveforms on the silliyscope. I found an old text book on vector analysis that has info about 3d matricies and studying that as I go through the code line by line. Re-learning PASM at the same time.

    I still have LF and RR spinning to a stop at idle after about a minute.. I think I have a drift issue with the 6dof board. If I look at it with the DCM visualizer, it rotatesand tilts.
    I will review those posts.

    Thanks again,

    Robert
  • nomadnomad Posts: 276
    edited 2012-08-14 22:19
    hi jason,
    thank you for your answer.
    today i make some tests about your hints.
    yesterday i make some tests a similar code (servoInput.spin) and i have no problems with the values of the 3-way-switch :-)
    and i make some improvements with the rc-receiverOpenDemo.spin
    i make a reply when i have new results...
    thanks for your help
    regards nomad
  • nomadnomad Posts: 276
    edited 2012-08-15 03:50
    ref. static ch6 at 1_500 on rc-openDemo1.spin

    hi jason,

    on the morning i make some experiments.
    i change the PinMask := %0111_1111_0000_0000
    the pin p14 as Fake-channel
    Run: with the same result.

    but in the moment i cant change the pins on my prototype (i must take appart the whole stuff)
    but later i can make some changes ( i dont use channel 4 (i can change this, channel6 is then on p11 aka channel4 ))

    but in the moment this is my littlest problem.
    now i would integrate my L3G4200D 3AxisGyroscopte to my rc + esc- programms....
    my english :-)

    your program is verry helpful for me, thanks for help
    regards nomad
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-08-15 12:25
    rpdb wrote: »
    I still have LF and RR spinning to a stop at idle after about a minute.. I think I have a drift issue with the 6dof board. If I look at it with the DCM visualizer, it rotatesand tilts.

    With the DCM stuff, if everything isn't working properly and in the correct orientation, it will do some really strange things. It took me quite a while to work it all out, and I supposedly know what I'm doing. :)

    Be sure that you have valid results coming from the accel and the gyro, and make sure that those chips are in the same orientation as mine are. If they aren't, your results will be wonky. Also, if ONE chip is off, the results will be *really* strange, because the code will be getting conflicting readings. The gyro provides "instantaneous" orientation info - IE, I just spun 30 degrees around X. The accelerometer, over time, stabilizes that result and corrects drift. If the two aren't oriented correctly with respect to each other, you'll get a decent "instant" result from the gyro, and then the accelerometer will pull it out into the boonies and screw it all up over the next few seconds. If that sounds like what you're seeing, you probably have the chips oriented incorrectly.

    All that said, the QuadX code doesn't use the accelerometer or DCM code at all - if your LF and RR props are stopping, and the other two keep going, it could mean you have a non-zero rudder input when the sticks are centered. If your rudder is trimmed off center, it could cause this. It may very well be something else, but start simple.
  • ratronicratronic Posts: 1,451
    edited 2012-08-15 14:35
    nomad as far as using the l3g4200dtestmod.spin that I posted in post#108 you can specify any free Propeller I/O pins that don't interfere with the flight code. I used it by just inserting it as the gyro object in Jason's code. See the start method of l3g4200dtestmod.spin to see pin use.
  • nomadnomad Posts: 276
    edited 2012-08-15 22:20
    hi ratronic,
    thanks for your hints on l3g4200d-mod.spin
    today and in the next days (or weeks) i make my develop
    on the gyroscope to integrate all the stuff into my rc-esc-code.....

    to jason and ratronic
    many thanks for your help
    regards nomad
  • nomadnomad Posts: 276
    edited 2012-08-16 02:14
    ref: l3g4200dtestmod.spin

    hi ratronic,

    troubles with wiring l3g4200d
    in the moment i working with your L3G4200D_Example_Code.spin
    with mod

    this progs works with
    SCLpin = on my system pin3
    SDApin = pin4

    the program are now working in my prototype-thing

    in your l3g4200dtestmod.spin
    on start : your working with

    is this access correct (for a demo-prog)

    ascope.start(3,4,5) or for me better ascope.start(3,4)

    this is in the moment my problem.

    Pub start(cs, clk, dio)

    gcs := 1 << cs 'cs pin
    gclk := 1 << clk 'clk pin
    gdio := 1 << dio 'dio pin

    i think gcs is = (CS) SPI mode selection ( new pin for me)
    gclk = my SCLpin (3)
    gdio = ? possible SDA/SDI/SDO or
    SDO

    now i have a probleme (more or less)
    1) the whole stuff works inside of my prototype-thing
    and must take appart the whole thing to change the pins from SCL,SDA to CS,CLK,SDO

    2) i thinks with your older code its run with 500 samples per sec
    - your new code runs on 2_000

    now some questions:
    1) it's for me possible work with your older code ?
    aka SCL and SDA
    - this is with no 2000 smp (only 500)

    2) its possble change the DAT method init and initialize to work with SCL,SDA
    - aka : only the stuff under mainLoop

    3) if i work with my old code it's possible to integrate my stuff into Jason's code?
    or must i develop my own code for this stuff

    excuse the chaotic questions....

    thanks for help
    regards nomad
  • ratronicratronic Posts: 1,451
    edited 2012-08-16 08:07
    nomad I never had written an I2C program for Parallax's L3G4200D module. Only 3 wire SPI. I did clean up the first program (3-wire) I posted and move it to post#108 but that original code works the same as new code. Jason has sent me his I2C version but I have not had a chance to try it.

    From what I understand from Jason is that the L3G gyro is more sensitive than the ITG gyro as it output's a larger # range for the same DPS settings. But as you can see from the video I posted that I was able to get it to work with my quad.

    My program is setup with the method's that Jason's flight code call's for the gyro. To use it with Jason's code you will need to comment out his gyro object and his gyro.start instruction and replace them with my program as the gyro object and a new gyro.start instruction using any free I/O pins including the ones you are using now for I2C if they are not used with another device.

    The DAT section has nothing to do with gyro pin settings.

    Here is a description of 3-wire SPI use of Parallax's module -

    module - pins
    CS - CS
    SCL - CLK
    SDA - DIO
  • nomadnomad Posts: 276
    edited 2012-08-16 23:59
    hi ratronic,
    thanks for your answer.
    excuse my missunterstanding, i mean the L3G4200D_Example_code.spin

    i work with this programm, with SCL and SDA aka as Ic2-stuff not SPI

    you wrote:
    "and replace them with my program as the gyro object and a new gyro.start instruction
    using any free I/O pins
    including the ones you are using now for I2C if they are not used with another device. "

    now my question:

    in your l3g4200dtestmod.spin
    -> Pub start(cs, clk, dio)
    gcs := 1 << cs 'cs pin
    gclk := 1 << clk 'clk pin
    gdio := 1 << dio 'dio pin

    cognew(@init, @gx)
    offset

    can i change the code into

    Pub start(scl,sca)
    gclk := 1 << clk 'clk pin
    gdio := 1 << sda 'sda pin

    cognew(@init, @gx)
    offset

    or is this not possible ??
    if this not possible then i go the hard way and develop my own code.... with
    the base of l3g4200d_example_code -> my prog named: ppb-myL3G4200D-mod-3.spin

    for me it's complex to change the pins on the Board
    my prototype is finished last week and i must do change the pins
    take appart the whole thing... and change never a running thing :-)

    regards nomad
  • ratronicratronic Posts: 1,451
    edited 2012-08-17 09:30
    nomad if you are talking about code I posted in another thread somewere it was propably in Spin and not fast enough for quad use. Jason's flight code needs to see new gyro updates 250 times a second.

    When I wrote the asm section of my code I did it in SPI because I hadn't done I2C in asm yet and it was done at the end of last year. Jason sent me his current code for the MiniIMU that has the L3G4200D gyro along with an accellerometer and magnetometer.

    It is not possible to use my code with I2C devices. I only posted it because after I wrote it I had wondered if it could be used with QuadX and I was able to adapt it somewhat crudely.

    When you write your I2C code for the gyro I can say when Jason sets up the gyro for the MiniIMU he sets Reg$20 to $8F (400Hz, 110 cutoff, Normal power mode, all axes enabled), then Reg$23 to $20 (2000 deg/sec).
    Jason is much more experienced with gyro use than I. Also I would use his method for FindZero.

    I hope you share your work with us as you get these things incorporated!
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-08-17 18:10
    Dave - If you have my MinIMU version you can post it here. I'll do it, but won't be able to get to it until tonight or tomorrow.
  • ratronicratronic Posts: 1,451
    edited 2012-08-17 18:30
    Ok nomad here is Jason's MiniIMU code.
  • nomadnomad Posts: 276
    edited 2012-08-17 22:32
    hi ratronic, hi jason

    thanks for your answers and the code

    on this weekend i make some experiments with this....

    yesterday i make some experiments with simple PID (spin and under linux in "c")
    to testing the output of this PID.

    on the moment i want develop a program which can hover the quad automatical (aka 1) start the engine, then lift of, then hover over the qround about 1 meter...)
    i hope so.
    please think my quad have diameter about 96cm , weight about < 2 kg, Height of the frame ca. 25 cm
    also a big thing :-)
    it should be run in the + configurations
    engines 1+2 = for/back , engines 3+4 = left/right
    on my rc-system i have only the 2 stick (1 = for/back, 2 = left/right) 1 slider for thrust-control (1_500 to 2_000) and my 3-way switch to control different modes.
    with my code i can start the engines (with propellers) (the thrust of only one engine, the quad make from stand a big flipflop)
    in the moment my quad hange with 2 bones (?) on 2 styro-blocks so the quad can manuel swinging in the y-axis (pendulum)

    in this configuration i want test the 3AxisGyro (on x-axis) the the PID....
    excuse my chaotic english....
    thanks all for the hints....

    and of course i share my code and my stuff ......
    regards nomad
  • nomadnomad Posts: 276
    edited 2012-08-27 00:10
    hi jason & ratronic,

    after some experiments and tests:
    my first PID-Spin-Program with L3G4200D 3Axis-Gyroscope
    in the moment i can run this Programm on a Pendulum - Test
    Legs 1 + 2 and the xAxis of my thing (it's a archaic prototype and the program is
    verry simple, but's its run...

    the quadSys-Pend-1-0167.jpg shows the whole stuff....

    as attachments:
    1) ppb-rc-esc_AxisPid-22.spin
    2) quadSys-Pend-1-0167.jpg

    regards nomad
  • ypapelisypapelis Posts: 99
    edited 2012-09-05 11:46
    ratronic wrote: »
    Ok nomad here is Jason's MiniIMU code.

    I loaded the MiniIMU-pasm program and I am getting -1 for the magnetometer; gyro and accelerometer give out proper values.
    I looked at the configuration (:MagSetConfig) and all settings appear correct (75Hz/1.3G/cont conv).

    Any help would be greatly appreciated!
  • ratronicratronic Posts: 1,451
    edited 2012-09-06 11:14
    @ypapelis I do not have a MinIMU, Jason had only sent me his code so I could see how he set up the gyro for it.
  • ypapelisypapelis Posts: 99
    edited 2012-09-06 12:49
    ratronic wrote: »
    @ypapelis I do not have a MinIMU, Jason had only sent me his code so I could see how he set up the gyro for it.

    Hi ratronic,

    I have one of these and using them for a different project, and have not managed to get a high speed i2c propeller driver to work. I can read the gyro and mag/acc using Spin, but it is not fast enough. I can read the mag/acc using a Pasm code from obex but not the gyro. And Jason's code is fast but it reads the gyro and acc, but not the magnetometer. So I am stuck and will have to either do my own or try to figure out why Jason's code is missing the mag. On first inspection the register configuration values look correct, so something else is going on.

    Thanks!
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-09-06 15:08
    I'm not sure I ever had the mag code functional - the QuadX code only uses the gyro, and my DCM solver doesn't have heading integrated in yet. Hopefully I'll have a chance to get back to this in the coming weeks to see if I can finish it off.
Sign In or Register to comment.