Shop OBEX P1 Docs P2 Docs Learn Events
building a segway/riding Dancebot for under a $1000? — Parallax Forums

building a segway/riding Dancebot for under a $1000?

rjo_rjo_ Posts: 1,825
edited 2009-02-05 13:41 in Propeller 1
We have been discussing http://www.tlb.org/scooter.html over at mibbit

One of us made the assertion that with mostly off the shelf parts from Parallax and with DanceBot Logic... it should be possible to cobble a PropWay riding DanceBot.

The conversation then became what kind of motors and gearing and motor control would be required...

Obviously, we each have our opinion about the details... and we don't agree... so, we thought it might be useful to go to Mecca and ask the experts...

You don't have to be an expert to express an opinion... but if you have a thought, we would both like to hear it.

Rich And Rinks

Comments

  • rjo_rjo_ Posts: 1,825
    edited 2009-01-15 03:59
    so as to give you the flavor of the conversation so far here is a transcript from Mibbit

    RinksCustoms I came across this 3D laser scanner http://www.david-laserscanner.com/ that uses a webcam and a $5 laser line generator
    21:16 RinksCustoms also..
    21:17 rjo_ and you have esp too...
    21:17 RinksCustoms Build your own segway for less than half! http://www.tlb.org/scooter.html
    21:17 RinksCustoms ?
    21:19 RinksCustoms and heres the REAL creme-de-la-creme http://www.reprap.org/bin/view/Main/RepRapOneDarwin DIY 3D printing for under $200
    21:19 rjo_ I've been thinking about laser interferometry ... which requires a scanning laser
    21:20 rjo_ ... on the segway... if you use Parallax parts...and dancingbot logic should be doable for $1000
    21:21 rjo_ I've seen the 3D Printer...there is another one... made out of plastic, which can produce parts for itself!!!
    21:21 RinksCustoms that's the one, but it can't do all the parts
    21:22 rjo_ tpw warned me that I would have to modify SuperDos... he was right... not to mention that I need a new setup just to test the mod
    21:22 RinksCustoms the expensive part is going to be the gearboxes and motors/controllers
    21:25 rjo_ ... your right... I wasn't considering amperage...but if you chose the right electric motor, could't you get away without a gearbox?
    21:25 rjo_ going for adult beverage...
    21:27 RinksCustoms i suppose a big Azz NEMA torque monster could do the trick, but then your gonna need a massive controller to grab the reigns of one of those beasts
    21:28 rjo_ looking up Azz Nema
    21:28 RinksCustoms lol
    21:30 rjo_ Wellllllllllllll... I find Azz and I find NEMA... but what is Azz Nema?
    21:30 RinksCustoms lmao, you left out the big
    21:30 RinksCustoms 1 sec
    21:31 rjo_ by the way... there is a new micro projector... which uses a TI micromirror set up... you could use it to make desktop 3D measurements
    21:32 RinksCustoms http://www.anaheimautomation.com/42Y65_Series_IP65_Sealed_High_Torque_Stepper_Motors_Splash_Proof.htm
    21:32 RinksCustoms is it tha same TI chip thats in practically ALL DLP TV's?
    21:33 rjo_ I finally got what you meant... Remember I just started to drink... it gets worse
    21:33 RinksCustoms lmao, your a riot
    21:33 rjo_ TI? yes
    21:35 RinksCustoms over complicated
    21:35 rjo_ no... that's a stepper... that's can't be right. wju wpi;dm just a regular old electric motor is what you need.
    21:35 rjo_ why wouldn't you use a regular electric motor?
    21:36 RinksCustoms For one thing "holding torque", another, "accuracy"
    21:36 rjo_ with accurate encoding
    21:37 RinksCustoms steppers have unparalleded accuracy even without encoders when compared to regular motors
    21:37 RinksCustoms they are as accurate as long as you don't exceed holding torque
    21:38 rjo_ yes, but... with pwm modulation, your control is limited in terms of time... you can only do so many steps per second...
    21:38 rjo_ with a regular motor... your control can be instantaneous
    21:38 RinksCustoms yeah and multiple phases, i know
    21:39 RinksCustoms what do you think brushless DC is?
    21:39 rjo_ hey... let's take this to the forum...and see what kind of argument we can get going?
    21:39 RinksCustoms lol, not a bad idea, haven't been there in ages
    21:40 rjo_ I don't know much about motors... but I like them
    21:40 rjo_ I'll start a thread... let's see how long we can keep it going
    21:40 RinksCustoms Brushless DC Outrunners really are the torque monsters for their size
    21:49 rjo_ we only need two
    21:49 RinksCustoms http://www.horizonhobby.com/Products/Default.aspx?ProdID=CYLBB This one can drive a 32x12 prop on a 1/4 or 1/3 scale model aircraft!! That's roughly 3HP!
    21:50 RinksCustoms and it's TINY
    21:51 RinksCustoms actually, it's more like 5-7HP
    21:51 RinksCustoms that's a huge prop!
    21:52 rjo_ we are going to get into a serious discussion about torque... what is it... how much do we need and what is available vs time with these type motors
    21:52 RinksCustoms Well outruners are rated different... Kv/turn
    21:53 rjo_ I started a thread
    21:53 RinksCustoms and it's weird cuz more Kv/turn doesn't always mean more powerful motor
    21:54 rjo_ so... what we need to know is how much torque we need to keep the thing balanced and how much is available vs time from a cold start... right?
    21:55 RinksCustoms pretty much...
    21:55 rjo_ mind if I copy out this conversation to the thread?
    21:56 rjo_ it's ok if you don't want to
    21:56 RinksCustoms moving isn't too much trouble, the nitty/gritty comes from having to balance/control ~200lbs
    21:56 RinksCustoms go right ahead, copy away, saves me time typing later
    21:56 rjo_ ok
    21:56 sevs you could try a fisher&pykel motor
    21:57 sevs a minor rewire
    21:57 sevs voila
    21:57 sevs 3 phase brushless dc
    21:57 rjo_ I have to be careful... if I look up fisher&am I going to find out that you are pulling my leg?
    21:58 sevs bwahaha
    21:58 sevs only one way to find out
    21:58 rjo_ that should read fisher&pykel
    21:59 rjo_ it's a washing machine motor http://www.google.com/search?hl=en&client=safari&rls=en&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=fisher+and+paykel&spell=1
    21:59 sevs will be interesting to see what the folks come out with
    21:59 sevs correct
    21:59 sevs plenty of torque
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-01-15 04:53
    I love this idea, Rich! This sort of goes along the same lines as far as balance and what not...

    My Robotics team at my university are thinking about building a "quadrocopter" type flying machine. Obviously, to make the thing hover in one place, it must be perfectly level, much like your segway/dancebot. I'm just curious as to what kind of accelation detection system you are using... I got some free samples from ST MicroElectronics a while back. They are 3-axis accelorometers with something like 1 milli-G resolution. What are you guys using?
  • HannoHanno Posts: 1,130
    edited 2009-01-15 05:32
    Great idea! Let me know how I can help....
    Hanno
    Info about the dancebot
  • rjo_rjo_ Posts: 1,825
    edited 2009-01-15 06:32
    Either I ate too much or didn't drink enough... but I just can't sleep tonight.

    DaPill,

    From my end there are a couple of issues.

    I am at least a couple of skill sets short of doing this myself even if it is possible... that doesn't matter because Rinks has a heck of a skill set, exactly where my biggest voids are...AND on the other end there is the issue of control... and if we get stuck there we have the very reliable Hanno and most likely some other highly talented people here.

    The second issue is whether this can be done as described... with mostly off the shelf components from Parallax and by Hanno's control logic either as is or with some modifications.

    What I know for sure is that we could build a Prop-way/DanceBot to balance a keg of beer for a couple of days[noparse]:)[/noparse]

    The only thing that Parallax really doesn't have is the motors... and what we are mostly trying to figure out right now is what kind of motors we need... then can we find a way to use or adapt the controllers... for standard electric motors, Parallax controllers are rated up to 16 volts and about a half a horse... or should we look at some gynomous stepper motors... which sounds like fun too and would have lots of other applications.

    Hanno...

    Thanks... this is going to have to be done by committee... which I think we can get together, here.

    Why do it?... I have some good friends in wheel chairs.... the application of this to their problem is obvious and somewhat compelling.

    Rich

    Post Edited (rjo_) : 1/15/2009 6:37:52 AM GMT
  • sevssevs Posts: 50
    edited 2009-01-15 07:55
    Hey [noparse]:)[/noparse]

    I'm happy to help out where i can. I have a little experience in tilt detection, however against the giants of knowledge in this forum i will be of little help! This project runs mostly paralell (or parallel, i always forget :P) to a project i was going to start, which i started researching about a few days ago. There is nothing new in an inverted pendulum robot, but it will easily push my knowledge into new areas [noparse]:)[/noparse]

    Im in the #propeller irc chan where i can, and ill watch this thread.

    An idea for a motor is a geared down Wheelchair motor. I used one in an EV i had to make. From memory it drew ~30Amps while accelerating hard, but with alot less mass you should be able to draw alot less than that i would imagine.

    Good Luck!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Advertisement sponsored by dfletch:
    Come and join us on the Propeller IRC channel for fast and easy help!
    Channel: #propeller
    Server: irc.freenode.net or freenode.net
    If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
  • JoeBoticsJoeBotics Posts: 17
    edited 2009-01-15 15:24
    Hey Rich and RinkCustoms, I posted this information earlier on James Woods's IMU - Kalman Filter Thread, but since it is related to this one, I am re posting it here:

    I have been working on a balancing robot using the excellent IMU.spin object (thanks JWood!!), but I needed more cogs, so I started looking into the IMU and the KalmanFilter objects, trying to figure out a way to reduce the number of cogs, and I think I found a way to do it: if you look into the main IMU code loop, it constantly invokes the KalmanFilter routines state.update and kalman.update, but the KalmanFilter object does not have a main loop constantly running calculations, the KalmanFilter object only goes to work when invoked by IMU, so why not run the state.update and kalman.update internally in the IMU object instead? so I copied those routines into IMU, and it works!, also, the KalmanFilter object uses FloatMath.spin, created by Chip, these are a bunch of spin based Float routines, so I also copied them into the main IMU object in order to support the KalmanFilter routines, they fit nicely into IMU. Next, Float32Full is used by the IMU, and it takes two cogs (FLoat32Full uses Float32A), when you look into it, you notice that IMU uses ATan and ATan2 routines (present on Float32A), so I decided to create a limited version of Float32Full that included those routines, of course I had to remove a bunch of routines from Float32Full in order to be able to fit Atan and Atan2 + the associated routines into one cog. tricky, but I got it working.. smile.gif so:

    Original cog count as follows:

    IMU.spin: 1 cog
    KalmanFilter.spin: 1 cog for Pitch calculations, 1 cog for Roll calculations = 2 cogs
    FloatMath.spin: 1 cog ( this object was invoked by the original KalmanFilter.spin)

    Total number of cogs = 4 cogs, so this object saves 3 cogs... smile.gif

    The Limited version of Float32Full running on one cog saves another cog by eliminating the need for Float32A.spin for a total savings of 4 cogs.

    Please email me if this information is not correct at joebotics@gmail.com

    Attached are the IMU+KF object and the limited version of Float32Full....

    I haven't been able to test all the routines on IMU+KF, but when I use these objects on my balancing robot it works. So I would like to validate that:

    If these objects are a logical and practical approach to reducing the number of cogs on the IMU Object
    If the objects really work as intended

    Then for us to get together and test all the routines and fix the bugs and/or improve the objects



    I hope this helps... Thanks.. Joebotics
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-01-15 19:05
    Very impressive JoeBotics!
  • JasonDorieJasonDorie Posts: 1,930
    edited 2009-01-15 19:51
    I went in a somewhat similar direction as JoeBotics (though not quite as impressive) and made a single-instance version of Float32.· My Kalman Filter and PID code both made use of Float32, and I had two PID objects, so there were 3 copies of Float32, each using a cog.· Since my Kalman filter and PIDs were all updated by the same single thread, they easily share a single Float32 object without contention.· I just moved the VARs in Float32 into DAT, and made a 'StartIfNotAlreadyStarted' method.· [noparse]:)[/noparse]

    I didn't need atan2 because the H48C accelerometer object has CORDIC routines for computing·angles.· I just modded the object to read 5 channels (accel + gyro) from an MCP3208 ADC, instead of using the H48C itself, and I also added some really simple filtering.· It runs in a loop at ~300Hz (the max rate for the gyro & accel).

    My quadrotor uses 1 cog for flight control / Kalman / 2 PIDs, 1 cog·for Float32, and 1 cog for the gyro/accelerometer sampling and conversion to angles.· Similar number to JoeBotics version, but a slightly different approach.· I'm willing to share the code if anyone wants to have a look.· (I'd post it now, but I'm at work)

    I'm going to have to try this code and see how it behaves compared to what I've got.· My quad is reasonably stable, but I'm hoping for hands-off hover, and it's not there yet.

    Jason
    ·
  • JoeBoticsJoeBotics Posts: 17
    edited 2009-01-15 20:18
    Thanks Phil and Jason.. smile.gif

    If you look into both state.update and kalman.update routines in IMU+KF_with_Pitch_and_Roll.spin you notice that there is a formula that converts angle_Pitch to integer values multiplied by 100, so a value of float 823.76 becomes integer 82376, those values can be called from your main balancing program as IMU.get_angle_pitch_integer, the reason behind it is that I didn't want to use Float32Full calculations on my main program, I just wanted to use integer values, however, no other variables are being converted to integer values on the state.update / kalman.update, since I don't know if doing that affects the performance of the IMU object, I will work on adding those calculations and additional routines that passes only pure integer values to your main balancing program as a test only initially, I will test it to make sure those additional calculations do not affect performance.... my idea is to simplify things by only using integer values.

    Jason, please let me know how it goes when you test these objects, if you run into issues, please do not hesitate to private IM me or email me at joebotics@gmail.com

    Going back to the original purpose of this thread, I think that Electric Wheelchair motor assemblies can do the trick for the motors, the assembly comes with the motor, gear set, and wheelbase for connecting the wheel directly and supporting the weight of the human being crazy enough to climb on a homemade Segway... smile.gif I was lucky enough to find an electric wheelchair for free at craigslist, and if you do some search on Youtube for "homemade segway" you will find plenty of ideas, also please look into Trevor Blackwell's Balancing Scooter at: http://www.tlb.org/scooter.html ····
    BTW: Trevor is a freakin' genius ! go to www.anybots.com


    Thanks much!!!!.. Jose

    Post Edited (JoeBotics) : 1/15/2009 8:35:16 PM GMT
  • RinksCustomsRinksCustoms Posts: 531
    edited 2009-01-18 17:41
    I'm lost in the code (being pretty much a rookie with limited "good" programs), but i have a 2.5HP Metal lathe and a 53" 2.5HP Milling machine that do come in handy and have access to a full machine shop (waterjet/5-axis CNC/Brakes...), my buddy installed a copy of Solidworks 09 on my O.C. rig (cost me a keg of beer and fabricating a twin turbo kit for his honda -longer story), also have Multisim 10.0, so i can sim just about any electronic circuit. I'm also great at sourcing parts for occasions like this. Software will be the cheapest part of the whole build, finding motors will be "interesting" as those noted in the DIY segway links below are standard 1/2HP wheelchair motor/gear units with 20:1 gearbox, not exactly segway speeds here! Do NOT fall prey to the notion that one of these can be built for $200 safely.

    Feature list: (cut paste @first post?)
    • The platform should be able to balance ~250lbs + gear,
    • have enough torque at the axle to use a 15" bicycle tire/hub,
    • be able to achieve ~ 15MPH.
    • economical - cuz we're not made of money like those dweebs in silicon valley....
    The main cost of a build like this will be the motors, the gearboxes, batteries and motor controllers.

    Motor technology selection: The transmission type & ratio will be the determining factor in motor choice
    • Standard brushed DC - Possible fire hazzard for holding loads still/noisy(acoustic/electrically)/only 70% efficient (on a good day)/cost
    • DC Stepper - Can hold a load still/better efficiency than brushed DC/more power to weight/usually limited RPM/cost
    • Brushless DC - better than brushed for noise/power hungry/not alot of available holding torque
    • Outrunner type BLDC - Very high torque/speed ratings for size/bell design causes acoustic noise/very economical
    • 3Phase AC - Low holding torque/very quiet & economical/controller cost $, needs near perfect sine output

    For the motor -
    An Outrunner motor would be choice in this application. An outrunner motor features stationary windings in the center and is usually wired in a 3 wire delta configuration. The magnets, which are high power neodymium, are mounted in the bell on the outside of the windings. This type of motor's characteristics are different in a few ways from other motor technologies. High speed and torque output for it's size, (roughly double that of the same size stepper/brushed DC). The wiring of the motor allows for back EMF readings giving accurate data of speed/load/direction, eliminating the need for external encoders. An outrunner that's roughly equivalent to a 4HP gas version costs under $200USD, is 2 in.dia. x 2in long, and weights 23oz, can draw 60A continuously and withstand a 15sec burst of 78A!

    For the transmission -
    Two ways this can be done WITHOUT a very expensive precision zero backlash gearbox. To save wear and tear on the motors/controllers/user, the transmission requires the following features:
    • Very low backlash - 2deg or less.
    • Balanced ratio - needs to be able to steady a ~250lb load and should be able to reach a design speed higher than 13MPH but no more than 20MPH
    • Economical to build/source

    First up is the timing belt style. Timing belts can be ordered in a variety of widths, tooth pitches and HP ratings. Timing belts are also economical and very quiet in operation. The design of a DIY segway demands that safety by redundancy be incorporated into the deign, thus two or three smaller belts will need to be used in the event that one timing belt fails. Belts would need regular servicing/replacing once every two years or more depending on the environment and usage. Timing belts need little tensioning for proper operation and would provide a 0-1 degree of backlash.

    The next contestant is the chain drive. The common bicycle chain can be very efficient and quiet, low cost and widely available. Two VERY high quality chains cost less than $150 and are available at many non-department store bicycle shops. Sprockets can be made very quickly and economically. Chains are also very safe and very rarely break without warning.

    My choice for a solid design: (target ~$1000)
    • 2x BLDC Outrunner 2.5in.dia. or larger
    • 2x 100A ESC with reverse - if not 1x custom design controller
    • 2x High quality mountain bike chains like an SRAM
    • 2x Pair of drive sprockets 15-30:1 ratio
    • 2x 15" BMX style/size tires mounted on custom hubs available online.
    • ?x Li-Poly or lead acid batteries

    I will do some calculations/research and whip up a 'draft' in CAD within the month for a feasible version. along with a BOM and source list.

    Links:

    scooterlabs So easy, a H.S. student could do it!
    $286 motor + gearbox
    Silly MIT undergrads...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quicker answers in the #propeller chat channel on freenode.net. Don't know squat about IRC? Download Pigin! So easy a caveman could do it...
    http://folding.stanford.edu/ - Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.

    Post Edited (RinksCustoms) : 1/18/2009 5:46:31 PM GMT
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-01-18 17:51
    I can back that up about the outrunner motors. In my university Robotics team, one of the team members introduced us to a 2.5HP version. The thing is absolutely tiny. I didn't believe him until he showed me some specs and some testing videos on youtube. "Wow" is all I can say.
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-01-18 20:56
    Man, I just gotta say, I'm excited about this project! I've wanted to do this sort of thing for a long time, and you guy's seem to really be getting it off the ground! Keep us posted!
  • HannoHanno Posts: 1,130
    edited 2009-01-18 21:42
    Great thoughts everyone... Here some of mine:
    - Outrunner motors are wonderful- especially suited for model airplanes. Size and weight not as critical for this application, so would look for cheapest solution that interfaces well with the wheels (transmission), base, and is easy to control.
    - Cost for this scales pretty linearly with power. If you want to go slowly on level surfaces you need WAY less power than speeding up grassy hills. Running up hills costs ~5hp, coasting on floors inside ~1/10th.. Controls, batteries and motor able to deliver 5hp is much more expensive than 1/10th.. Optimal for this project might be somewhere between the two.
    - Controller must go forward and backwards (although to save costs, doesn't need as much power going backwards unless you want to go up hills backwards)
    - Autonomous balancing robots are much more challenging than Segway's. DanceBot uses a complex cascading PID loop implemented in fuzzy logic to keep the angle AND the position at their setpoints. This allows me to move the bot where I want it programmatically. Controlling a Segway by moving the balance point "manually" makes the control program MUCH easier. I use a fixed point Kalman filter because I update the motor speed at 200Hz. Way overkill for Segway style, so using the much slower float might work. Also, Segway style doesn't require wheel encoders.
    - As long as you're moving, backlash is not so critical, however for standing absolutely still it's critical
    Hanno
  • sevssevs Posts: 50
    edited 2009-01-19 09:26
    An idea for batterys, the A123 Li-Ion batterys are phenominal. They are a little $pricey though, so may not be too viable. Some quite stats for people who havnt heard of these batteries before:

    Nominal voltage: 3.3V
    Nominal capacity: 2.3Ah
    Core cell weight: 70 grams
    Internal impedance: (1kHz AC) 8 mΩ typical
    Typical fast charge current: 10A to 3.6V CCCV
    70A continuous discharge
    120A, 10 sec pulse discharge
    Cycle life at 10C discharge, 100% DOD: over 1,000 cycles

    Also a link to the datasheet:

    http://a123systems.textdriven.com/product/pdf/1/ANR26650M1_Datasheet_AUGUST_2008.pdf

    If you are prepaired to sacrifice a little life span they can be charged in 15 mins @ 10A!

    Just some food for thought.

    *EDIT* Never mind with these, using the 'Buy It Now' price on ebay, to build a 33v, 30Ah pack will cost ~$1000USD

    These would be premo, but way cost prohibitive. */EDIT*

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Advertisement sponsored by dfletch:
    Come and join us on the Propeller IRC channel for fast and easy help!
    Channel: #propeller
    Server: irc.freenode.net or freenode.net
    If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com

    Post Edited (sevs) : 1/19/2009 10:10:41 AM GMT
  • Stan671Stan671 Posts: 103
    edited 2009-01-20 19:36
    FWIW, I own a Segway (that is my Segway in the mud puddle in my avatar) and know quite a bit about it mechanically and technically from taking it apart and from talking with the Segway engineers extensively. If I can be of any help, just ask.

    BTW, Hanno, I have not been able to get your Two-Wheeled DanceBot video to play.· All of the others I tried on your site work, but not that one.· Is it available another way?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Stan Dobrowski
  • JasonDorieJasonDorie Posts: 1,930
    edited 2009-02-05 06:39
    JoeBotics said...
    Jason, please let me know how it goes when you test these objects, if you run into issues, please do not hesitate to private IM me or email me at joebotics@gmail.com

    Thanks much!!!!.. Jose
    I've started putting together a small 'Balance Bot' to play with some of this stuff, so I've had a quick look at the code here and have a few comments.· There are a bunch of math routines that are 'inlined' as Spin instead of calling the float32 library - Specifically the Kalman_update and state_update functions are making use of fadd, fsub, fmul, fdiv, and fneg, all of which are written in Spin.· Using the·floatMath cog versions of these functions will make this MUCH faster.

    I've also noticed there are a few things in the computations themselves that can be removed, like this:
      PCt_0 := FMul(1.0, P[noparse][[/noparse]0]) {46 uS}
      PCt_1 := FMul(1.0, P[noparse][[/noparse]2]) {46 uS}
    
    

    The code that uses PCt_0 and PCt_1 could be changed to use the p[noparse][[/noparse]0] and p[noparse][[/noparse]1] values, since they're just being multiplied by 1.0.· There are a few, less obvious others as well, like repeated work in the·pitch and roll updates that could be removed if both functions were rolled into one.· I'm going to time what's here (and make sure I'm not mistaken on this), and then I'll do an optimize·pass over the code and re-post it.

    Jason
    ·
  • JasonDorieJasonDorie Posts: 1,930
    edited 2009-02-05 09:17
    I've attached a rough first pass at optimizing this code, and left some comments in the 'get_timeDelt' function that document where the savings came from.

    The original version took ~2,630,000 clocks per iteration.· The attached version takes ~312,000, or is roughly 8.5 times faster.· The previous version, at 80MHz, ran just over 30 iterations per second, while this one will do roughly 256 iterations, so you could lump your PID loops in there and still have time to spare.· I should be able to shave off another 50,000 or so, but I'm quickly getting to diminishing returns.

    I haven't tested it very thoroughly (actually, I've only been looking at one axis on my graph, so it's quite possible I've botched it) but if some brave soul wants to give it a go, it's attached.· I'll update here if I find any bugs.

    It's also worth noting that I culled out ACos and ASin from the modified floatMath lib, since they weren't being used, and got FAdd working again.· The math cog is down to ~385 longs, so there's enough room in there for more functions if any needed to be put back.

    Jason
  • Peter J. FischelPeter J. Fischel Posts: 28
    edited 2009-02-05 10:48
    Using my RC experience, I can talk towards the drive. The 4 motors would best be whats known as "outrunners". Brushless Motors such as Rimfire. They are controlled by a motor controller which actually the RPM is based on a servo input. So, a prop chip could easily drive the 4 motors.

    Now keeping it level and in control, well geez. Tilt and accelerometers are fine but I don't see how that will work for any length of time.

    Wow this is a awsome project for a prop.
  • simonlsimonl Posts: 866
    edited 2009-02-05 13:41
    Great work Jason! I'll keep watching this thread. scool.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,
    Simon

    www.norfolkhelicopterclub.com

    You'll always have as many take-offs as landings, the trick is to be sure you can take-off again wink.gif
    BTW: I type as I'm thinking, so please don't take any offence at my writing style smile.gif
Sign In or Register to comment.