p. 1
u.s $5.50 canada $7.00 0 4 0 74470 58285 4
[close]
p. 4
page 76 columns 08 robytes by jeff eckert stimulating robot tidbits 10 13 geerhead by david geer the ultimate wall-e robot toy ask mr roboto by dennis clark your problems solved here tweaks 58 twinand evan woolley by bryce bug sport 68 robotics resources by gordon mccomb organizing your robotics workbench 72 76 page 58 beginner electronics by william smith basic atom robotics then and now by tom carroll european robots departments 06 07 16 18 mind/iron bio-feedback events calendar new products 21 64 81 81 showcase servo webstore robo-links advertiser s index servo magazine issn 1546-0592/cdn pub agree#40702530 is published monthly for $24.95 per year by t l publications inc 430 princeland court corona ca 92879 periodicals postage paid at corona ca and at additional entry mailing offices postmaster send address changes to servo magazine p.o box 15277 north hollywood ca 91615 or station a p.o box 54,windsor on n9a 6j5 cpcreturns@servomagazine.com 4 servo 04.2009
[close]
p. 5
04.2009 vol 7 no 4 features projects 30 unwinding the ax-12 communication protocol by fred eady build up some special hardware and firmware to drive the dynamixel ax-12 robot actuator 38 page 46 computer control and data acquisition by david a ward part 2 introduces national instrument s most affordable computer interfacing hardware and how to use its digital features the combat zone features 22 28 build report t6 evolution of a full body spinner parts is parts custom colson wheel hubs results and upcoming competitions event report 2009 chattanooga robot battles upheaval 42 robot vision for everyone by john blankenship and samuel mishal see how easy it is to implement visual capabilities with robotbasic 46 navigation and tree measurement by jaakko jutila learn how the forestrix project implements sensor technology for data gathering events 25 25 50 a3950 dc motor controller tips and tricks by jose quinones allegro micro s a3950 provides a versatile and economical solution for small to medium sized dc motor control applications servo 04.2009 robot profile 29 5
[close]
p. 6
published monthly by t l publications inc 430 princeland ct corona ca 92879-1300 951 371-8497 fax 951 371-3052 webstore only 1-800-783-4624 www.servomagazine.com mind iron by bryan bergeron editor subscriptions toll free 1-877-525-2539 outside us 1-818-487-4545 p.o box 15277 n hollywood ca 91615 publisher larry lemieux publisher@servomagazine.com associate publisher vp of sales/marketing robin lemieux display@servomagazine.com editor bryan bergeron techedit-servo@yahoo.com technical editor dan danknick dan@teamdelta.com contributing editors jeff eckert tom carroll gordon mccomb david geer dennis clark r steven rainwater fred eady kevin berry david ward john blankenship samuel mishal bryce woolley evan woolley william smith jose quinones jaakko jutila dennis beck thomas kenney travis schmidt circulation director tracy kerley subscribe@servomagazine.com marketing coordinator webstore brian kirkpatrick sales@servomagazine.com web content michael kaudze website@servomagazine.com production/graphics shannon lemieux administrative assistant debbie stauffacher copyright 2009 by t l publications inc all rights reserved all advertising is subject to publisher s approval we are not responsible for mistakes misprints or typographical errors servo magazine assumes no responsibility for the availability or condition of advertised items or for the honesty of the advertiser the publisher makes no claims for the legality of any item advertised in servo.this is the sole responsibility of the advertiser.advertisers and their agencies agree to indemnify and protect the publisher from any and all claims action or expense arising from advertising placed in servo please send all editorial correspondence ups overnight mail and artwork to 430 princeland court corona ca 92879 stimulus package for robotics if you ve been tracking the economic developments in robotics you know that only real business opportunities have been primarily in the military and entertainment industries several of my friends in consumer robotics joke about how their niche desperately needs a stimulus package to get things moving again they take the position that nothing revolutionary has happened in every day use of robotics for decades although i think that significant progress in consumer-level robotics has been made the relative stasis in robotics was brought home to me on a recent visit to an mit museum that featured prototype planetary crawlers built for nasa in the 1970s although today it s possible to replicate the functionality of those crawlers with off-the-shelf components they are just as compact expertly machined and functional as anything on the consumer market today so what happened to the innovation and rapid evolution characteristic of robotics decades ago and why hasn t it percolated down to the consumer level economics is obviously an issue most small robotics companies that don t have the good fortune to have contracts with the government have no choice but to innovate in order to make due with less because as enthusiasts we re in the same practical situation our innovation tends to be in the realm of duplicating technology as inexpensively as possible while this is certainly a worthy and practical exercise it doesn t necessarily advance the field of robotics but it can furthermore it doesn t take a team of scientists to innovate consider the developers of the killer apps that eventually made the personal computer a consumer commodity most of these applications were created by one or two innovators working with little or no capital while holding down a regular day job clearly the equivalent of the electronic spreadsheet has yet to be developed in practical robotics for the consumer market and without the killer app in consumer robotics it will be decades before the family pooch is replaced by a robot capable of fetching the newspaper assuming newspapers are still around all is not lost however another way to frame the apparent lack of innovation is to argue that the pressure to innovate in a way that advances the field isn t there robotics for many enthusiasts is a means to an end students considering a career in engineering use robotics to gain practical hands-on experience at problemsolving electrical and mechanical systems engineers in training employ robotics to demonstrate concepts they ve mastered and computer scientists use robotics as a platform to explore artificial intelligence and machine learning concepts for these mind/iron continued 6 servo 04.2009
[close]
p. 7
innovators the current state of readily available somewhat standardized robotics platforms allows them to innovate in their areas of interest so perhaps there isn t really a need for a stimulus package for robotics after all it s just adjusting expectations that s in order while robotic technology can help you park your car today it will likely be decades before wal-mart offers personal care robots that will ferry your slippers and paperthin view screen from one room to the next check on your medications and take out the trash i have to admit that such a future would be nice for now my crustcrawler arm fleet of parallax carpet rovers and homemade robots provide stable useful platforms for my ai experimentation and hopefully innovation sv dear servo i read zac o donnell s article in the feb 09 combat zone on running the lifepo2 a123 batteries in series with the bottom two cells powering the motor and the entire pack powering the weapon i am a professional bsee/mscs engineer with 25 years design experience i have to tell you the way he configured these batteries is a very bad idea at the very least he will severely limit the life of these very expensive cells and while they are resistant to fire overheating leading to venting is not outside the realm of possibility lithium cells even the safe lifepo2 a123 cells need to be protected against overcurrent overvoltage and undervoltage the way zac has these cells connected is a problem waiting to happen while the batteries may have enough capacity to survive a normal three minute run in the ring without reversing any number of things could happen to drive the lower two cells under their minimum voltage point of 2-2.6v this could occur if the ring was especially sticky hot or rough causing the drive motors to draw more than their usual current or battle damage could cause a wheel to drag increasing current or the weapon motor could stall or become heavily loaded chewing into another bot if the lower cells are driven below 100 dod depth of discharge of about 2v they will be ruined if they are driven in reverse they may overheat and vent dangerous continued on page 55 steer winning robots without servos erform proportional speed direction and steering with only two radio/control channels for vehicles using two separate brush-type electric motors mounted right and left with our mixing rdfr dual speed control used in many successful competitive robots single joystick operation up goes straight ahead down is reverse pure right or left twirls vehicle as motors turn opposite directions in between stick positions completely proportional plugs in like a servo to your futaba jr hitec or similar radio compatible with gyro steering stabilization various volt and amp sizes available the rdfr47e 55v 75a per motor unit pictured above www.vantec.com p order at 888 929-5055 servo 04.2009 7
[close]
p. 8
robytes robot theme park on track artist s conception of what korea s incheon robot park certainly won t look like the axel rover from nasa jpl and caltech courtesy of nasa/jpl by jeff eckert the overall risk manageable for a video of an axel prototype at work see www.jpl.nasa gov/video/index.cfm?id=806 avoiding the sand trap a recent study published in the proceedings of the national academy of sciences offered what is possibly the first precise look at the problem of robot locomotion on granular surfaces translated into standard english that means why they get bogged down in dirt sand and piles of leaves the answer might seem obvious to anyone who has ever managed to get his car stuck at the beach but a few weeks ago the south korean government authorized construction of the world s first robot theme park emphasizing the country s view of the robotics industry as a prime area for economic growth the ministry of knowledge economy has set aside a 767,286 m2 about 8.3 million ft2 development area in the incheon free economic zone for the park which is budgeted at 784.5 billion won 562.3 million proving that the korean government is a lot smarter than ours almost three-fourths of the investment capital 680.5 billion won will come from private sources with the remainder chipped in by the central and local governments this and a second park to be built later in the south gyeongsang province are expected to create 18,000 new jobs and generate 2.8 trillion won in industrial output the parks won t be all fun and games though sure they will feature amusements exhibition halls water parks and stadiums for bot competitions but there will also be r&d and education centers the incheon park is not scheduled for completion until 2014 so there s no need to book your hotel room yet steep terrain rover unveiled axel rover developed by engineers at nasa s jet propulsion lab and students from the california institute of technology www.cal tech.edu sounds a bit like a rock star and in a way it is it s designed to rappel off cliffs travel over steep and rocky terrain and explore deep craters based on the idea that simplicity is a good thing it is basically just a symmetrical two-wheeled rover with a trailing link the machine uses only three motors one for each wheel and a third to control a lever the lever is fitted with a scoop to gather lunar or planetary material and it also adjusts the robot s two stereo cameras which can tilt 360 degrees the tether attached to its midriff can be unreeled allowing it to descend from a larger lander rover or other anchor point axel can be the georgia tech sandbot in a fitted with wheel types ranging poppy seed-filled trackway from large foldable units to image courtesy of daniel goldman inflatable ones which help it deal with hard landings and rocky terrain axel extends our ability to explore terrains that we haven t been able to explore in the past such as deep craters with vertically-sloped promontories said axel s principal investigator issa a.d nesnas also because axel is relatively low mass a mission may carry a number of axel rovers that would give us the opportunity to be more the georgia tech sandbot tries to plow its way through a pit of poppy seeds aggressive with the terrain we image courtesy of daniel goldman would explore while keeping 8 servo 04.2009
[close]
p. 9
robytes maybe the georgia tech guys don t get out much in any event according to daniel goldman assistant professor in the school of physics www.physics.gatech.edu sand is a uniquely challenging terrain because it can shift quite easily from solid to fluid to solid and requires different locomotion strategies experiments were conducted by placing a device with six c-shaped legs on an eight-foot trackway filled with poppy seeds which simulates conditions that might be found in deserts extraterrestrial surfaces and a number of agricultural operations in afghanistan the result we have discovered that when a robot rotates its legs too fast or the sand is packed loosely enough the robot transitions from a rapid walking motion to a much slower swimming motion the researchers discovered that the bot can easily traverse the grit if it maintains a constant rpm and some parameters are properly adjusted the durations of the slow and fast phases and the angle at which each limb changes from slow to fast but in a pinch you can just pour some water on the sand skippy the mudskipper courtesy of the aquarium of the pacific photo by hugh ryono robot darwinism in a curiously abstruse press release researchers at aberdeen scotland s robert gordon university www.rgu.ac.uk claim to have caused a stir in the world of engineering by taking the first steps in developing a robot that has the ability to evolve in the same way as animals they say that the technique offers the potential to make machines which can interact with their environment and perform useful tasks in difficult or dangerous circumstances or even around the home it does this by gradually developing the robot s body and environment from simple to complex while at the same time growing its brain a special control circuit called an `artificial neural network by adding new parts one on top of the other to end up with a structure rather like the layers of an onion using this system researchers have produced a complex robot the robot started off pulling itself along in a primitive way rather like a `robotic mudskipper and then went through a series of developing body plans actuators sensors and environments until it had evolved into a walking quadruped able to react to visual stimuli avoid obstacles and react to predefined objects as `predators or `prey unfortunately no details were offered as to how it accomplishes such evolutionary upgrades and there were no accompanying photos that might give us a clue but the announcement inadvertently posed a much more interesting question what the heck is a mudskipper for a fascinating answer visit www aquariumofpacific.org/online learningcenter/species/mudskip per this is evolution at its best the mellowtron stuffed robot in need of prozacĀ® photo by bill brown morose rejected fauxbots the way the yarn goes 100 mellowtron robots not to be confused with the mellotron tape-loop keyboards employed by the moody blues et al back in the good ol days were created and sold as service robots but the only service they were designed to perform was to dream all day when their owners discovered that the mellowtrons could not cook clean out the cat box or otherwise assist around the house they were all fired sent back to the factory and dumped in a warehouse where they are now idle sad and confused if this somehow brings a tear to your eye be advised that you can adopt one of the little slackers by logging onto www.stuffedrobot com and shelling out $70 plus s&h although they all look exactly the same each one professes to have its own story and personality no 32 for example has trouble distinguishing between reality and his dreams no 47 gets his feelings hurt if everyone doesn t say hi to him and so on as of this writing 43 of them have already found homes but you might still get one if you hurry or even if you don t hurry sv servo 04.2009 9
[close]
p. 10
by david geer contact the author at geercom@windstream.net the ultimate wall-e robot toy on the big screen wall-e the last functional waste allocation load lifter-earth class robot is a curious blue-collar working trash compactor robot tasked with cleaning up mountains of consumer garbage from the earth s surface wall-e is completely alone in this mess because human beings have moved off the world on a permanent vacation due to pollution and the inability of the planet to support life o keep this endless mundane chore interesting wall-e collects artifacts and treasures from the glut of consumer by-products which help him in his search for the meaning of life and his own worth wall-e manages to squeeze in a little fun too in the brief shallow respites he takes from his manual labors on the toy shelves at disney wall-e is another `stor-e altogether the child-sized robot approximately three feet tall consists of genuine movable arms the central body unit eyes and mobile tracks for locomotion the robot t responds and interacts by talking to the user following the user dancing and playing mp3s sensors sounds and responses ten deluxe grade brushed motors manipulate wall-e s movements based on input from several multi-directional smart sensors here s what wall-e can do and how he does it followmode when wall-e detects any movement he will turn around and follow it when wall-e detects movement behind him he will turn around to examine the source of the movement according to the owner s manual these features are available when the unit is in followmode wall-e has a square followmode button on top of his front container area signified by a red circle users can also activate followmode via remote through an oval button with a picture of wall-e following sound waves wall-e will use his three forward microphones to detect and follow you simply clap twice and he will follow continue clapping twice as you move and wall-e will continue to follow the sound of your hands using his infrared obstacle detection and avoidance sensors wall-e can detect obstacles in his path stop movement and change course to avoid them so as not to hang itself up on the landscape there are four infrared sensors three in the front and one in the back wall-e emits an infrared light and an infrared receiver processes the reply when the light bounces ultimate wall-e robot toy 10 servo 04.2009
[close]
p. 11
geerhead processing head and body actions wall-e uses one chip to control his head and another to control his body his roboticists have connected the chips via serial peripheral interface spi in order to communicate with wall-e s actuators the head motion is triggered by audio motion sensors and pre-coded digital ir signals the roboticists pre-programmed the head to produce actions for wall-e s emotive expressions the head motion is also controlled by secondary 16-bit chips on a board inside the robot says albert chan thinkway toys ceo and president wall-e uses five motors to direct the head alone one motor is used to make the head nod up and down one is used for left to right head motion/turns still another actuates the head s opening and closing to form the expressions the final two open and close each of wall-e s eyes explains chan wall-e uses two motors to control the arms wrists and hands each motor controls an arm s up and down motion wrist turns and hand opening and closing once the arms are active the arms are time sharing when commanded by one of the main ic chips boarded on wall-e continues chan for the body and track motions wall-e uses three motors one motor controls the right track s turns while another controls the other track a third motor actuates the body s tilts forward and backward the body and track motions can be interactively triggered by the audio motion sensors and pre-coded ir digital signals the internally pre-programmed actions also generate commands from the main 16-bit chip chan concludes lower center trigger wall-e s programmed curiosity the cds motion sensor is a special resistor that responds to changes in light in the surrounding environment which wall-e can interpret and then react to says albert chan thinkway toys ceo and president wall-e uses his dsp and motion sensors to locate and follow people by the sounds that they make wall-e recognizes a single short discrete sound such as a hand clap and determines the sound s location whether to the right left or directly in front of him continued chan talkback off an object so wall-e can determine where and how far an object is three motion sensors in the front and one in the back wall-e s four audio sensors microphones placed in the front back and each side of the robot enable him to hear voices and sounds when wall-e recognizes voice patterns he can respond verbally using his talkback feature.wall-e does this by isolating the origins of varying sounds he then uses a digital signal processing dsp unit to calculate the abstracted sound s location of origin in order to respond to children with ultimate wall-e shows actual robot size servo 04.2009 11
[close]
p. 12
geerhead to the dsp which also does analog-to-digital signal conversions exploremode wall-e can explore his environment using his dsp ir obstacle sensors and a pre-assigned road map according to company technicians this road map actually consists of three individual routes that wall-e can follow users activate exploremode by selecting the green triangle button on top of wall-e s yellow body users can also select exploremode via an oval button on the remote control that looks like an asterisk with wall-e moving in front of it wall-e does not scale stairs or navigate steep slopes users should avoid these when selecting an area for wall-e to roam dancemode and playing mp3s wall-e has a square yellow dancemode button on his body and an oval button with a picture of two notes and a staff on the remote control through a small active pre-programmed sequence of steps and synchronization wall-e synchronizes his dance moves with the rhythm of the beat wall-e comes with a compartment for mp3 players which users plug into wall-e so he can play back music from the device and put on a light show wall-e with remote control that audio input wall-e s talkback feature is on by default to turn it off select the talkback on/off button which will beep twice as the feature is turned off the button s graphic looks like sound coming out of a speaker sound sensors and the talkback feature resume when the user selects the button again the user will hear a single the white black and yellow ultimate programmable beep for on wall-e uses his 16-bit dsp to play any remote control console is a wireless infrared device that number of customized sounds wall-e operators can use to program and navigate the if you are to one side of wall-e you can get his robot from up to 25 feet away attention and get him to turn and face you by clapping the remote will send action commands instantly or loudly at him twice when he turns his head clap again program and store action sequences for wall-e with up to twice or three times so he can hear you wall-e should 1,000 different combinations of actions possible wall-e then turn to face you will record up to 64 programmed actions in a sequence in order to ensure that wall-e can hear you recognize sent from the remote control with the press of a single your speech and give the appropriate response you do the button wall-e will play out the actions in the sequence following stand one foot in front of wall-e while he is explains chan in talkback mode speak loudly with long sentences so wall-e receives plenty of input to make a decision about the sounds he hears if he can hear your voice you will see wall-e has already become a popular robot for an indicator light flashing on his chest experimenters check out the posted modifications and wall-e will respond by saying his name as in the movie ways to build your own wall-e robot in the resources or with sounds lights and movement his response will be sidebar sv different based on the volume of your voice loud sounds evoke a frightened response a combination of pixar animation films resources responses that make him appear frightened www.pixar.com wall-e s unique sound capabilities are the search for the ultimate wall-e result of the dsp which provides dual channel links to build your own wall-e on http disneyshopping.com voice mix output www.slipperybrick.com www.hacknmod.com wall-e movie overview wall-e designers have connected his www.instructables.com www.imdb.com/title/tt0910970 many sensors and motors via i/o control pins the ultimate programmable remote control conclusion 12 servo 04.2009
[close]
p. 13
our resident expert on all things robotic is merely an email away roboto@servomagazine.com tap into the sum of all human knowledge and get your questions answered here from software algorithms to material selection mr roboto strives to meet you where you are and what more would you expect from a complex service droid by dennis clark this column marks one year for me answering your questions and hoping that i am helping you along with your aspirations towards building useful or entertaining robots the fact that you are still reading the column makes me believe that i m doing something right please keep those questions coming they inspire me to keep researching and writing about what i have learned to help you with your projects life is all about constantly learning one of my favorite authors robert a heinlein once had a character utter these memorable words when you stop learning you start dying with this in mind i hope to live forever Ā and i ll do everything in my power to help you live forever too the current economic times are less than ideal for most of us to be spending money on non-essentials let s face it there are however lots of things that get thrown away that could net some really good robotic components does anyone out there have any questions about how to salvage good stuff from technological marvels that we no longer want to keep using for their original purpose i d love to hear them and offer you suggestions to get the most from what you have on hand already let s move on to your questions or rather question there was only one this month but it was a good one i am an old servo reader and i really enjoy your column i have learned very much from it and it answered almost all my questions except this one first a little introduction is needed i ve been using continuous rotation servos to propel my robots but i want to move on to using dc motors with encoders i have read the articles in servo about pid control but that does not teach one how to make the robot move smoothly ramping up to the maximum speed and slowing down just before reaching the destination point looking up on google i have found that a trapezoidal or even a more advanced s-curve type control is needed my question is can you show me how to implement using pseudo code a trapezoidal motion control and for a more advanced movement can it be combined with a pid control thank you very much in advance gabriel petrut canada thanks for your support you ask a good question and using a ramped acceleration and deceleration curve will most definitely smooth your robot s direction and speed changes in fact if you have ever seen a robot or any motorized machine for that matter that controls its acceleration and deceleration you will most likely be very impressed using a ramped curve will help reduce wear and tear on your gear train and if properly implemented will eliminate the wheelies that a highly a q figure 1 trapezoidal acceleration curve servo 04.2009 13
[close]
p. 14
loop does maximum acceleration is not your maximum pwm the figure 2 pseudo-trapezoidal acceleration profile maximum pwm is your maximum motor speed you need to calculate your change in speed divided by your change in time v we usually don t have t that kind of horsepower in our microcontrollers if we want to do anything else in the program we re writing for our robot a dedicated processor can handle this alongside any pid algorithm we might want to implement this gives us spectacular results but we might not want to put forth that much effort to get powered drive train can cause in a powerful robot it s there some motor control chips have this capability built in worth the effort the hp/agilent hctl 1000 for instance but these chips there are a variety of acceleration curves that you can are expensive 40 use over many years the trapezoidal acceleration curve has for the hctl 1000 pretty much been considered the best to use because it you knew it wouldn t be as easy as just asking didn t minimizes the jerk characteristic in a drive train without you well you d be correct if you did know that but we acceleration ramping acceleration is full-on or full-off which can come reasonably close to a trapezoidal acceleration can be a major source of vibration in our robots you curve by taking some shortcuts way back in november already know this if you use a camera on your robot the 2008 i wrote about a simple pid algorithm that you could trapezoidal acceleration curve smoothes out acceleration implement without doing any difficult math operations in deceleration changes which will remove much of the that article i referenced source code picpid.c that you can vibration attributed to the drive train the one drawback to get from servo website www.servomagazine.com a trapezoidal acceleration curve is that instantaneous in that source code i used a simplified trapezoidal changes in speed or direction become impossible acceleration curve which i ll call the sawtooth acceleration in a remotely controlled robot this may make the robot profile feel sluggish or unresponsive in a fully autonomous robot figure 2 shows an approximation of what that the motion looks more deliberate and controlled so pick acceleration profile would look like and its affect upon the your poison if you are driving your machine remotely you velocity of the robot after a speed was chosen a simple won t want the trapezoidal curve you ll control your rate formula was applied such that several intermediate speeds of acceleration with your thumbs if you have a fully were selected for the pid loop to reach the end result of autonomous robot then you can tune your trapezoidal that formula is that we moderate the acceleration to our curve to the desired level of responsiveness you ll need in desired speed figure 2 shows an approximation of the fact with a closed-loop system that is always looking for effect this pseudo-trapezoidal acceleration has on our environmental conditions that necessitate a velocity change robot s speed it isn t perfect but it comes reasonably you can change the ramp rate based upon the impending close to what we want to achieve without taking over our collision or other need for action microcontroller i ll apologize ahead of time for these in case you are wondering what we re discussing graphics i simply could not find a program that would figure 1 shows what a trapezoidal acceleration and allow me to do a better job with those curves deceleration curve looks like figure 1 also shows that a the simple functionality of this program is to avoid trapezoidal acceleration profile will give you an s-curve large jumps in speed by introducing many intermediate velocity profile that velocity profile is what makes your steps in the pid target speed my code has a constant robot look so smooth on the go note how the ramp in interval the time between pid loop calls in which an the acceleration causes a curve in the change of velocity incrementally higher speed is assigned as the pid target the vertical dashed lines simply delineate the parts of the curve affected by the ramps you calculus buffs should speed this results in a small acceleration since the delta between the current velocity and the new target velocity is immediately recognize those first derivative curves and rather small so we get a short period of acceleration then you thought you d never use that math a short period of constant velocity at the new speed then as you can imagine calculating a constantly changing another short period of acceleration and so on it isn t a acceleration would require that you know your current real trapezoidal acceleration profile but it simulates some acceleration your maximum acceleration and your time of the better aspects of the true profile delta this is a very complex calculation that requires as now about that program picpid.c i m getting a lot of much knowledge of your motor power package as a pid 14 servo 04.2009
[close]
p. 15
mileage from it the general ramping function is shown in listing 1 there are three variables that are of interest here endpos calcpos and vacc the variable endpos is the eventual terminal velocity calcpos is the intermediate velocity that is incremented by vacc on every pass through the pid loop this simple construct will limit the acceleration by only accelerating in small increments the overall effect is to smooth that acceleration by limiting the effect of any instantaneous velocity change note that this will prohibit an immediate or sudden direction change as well we re not changing the rate of acceleration we re limiting how much velocity change each acceleration pulse will cause this will give us a rough approximation of the effect of a trapezoidal acceleration profile in main there are two keyboard inputs that will change the rate of change of calcpos the a and a keys will decrease the ramp rate by one and increase the ramp rate by one respectively see listing 2 can you see a way to better simulate the trapezoidal profile how about if we increase vacc each time it is used in that way we have a larger v delta-v each pass through the loop which essentially will increase the rate of change each time through the loop again it wouldn t strictly speaking be trapezoidal acceleration but simply a closer simple approximation another way to come even closer to a true trapezoidal acceleration curve would be to start out with a longer interval between increments to calcpos which will shorten as more passes through the pid loop occur this would simulate less acceleration at the front of the ramp and with shorter intervals at the end of the ramp simulate faster acceleration because of a larger delta between the current speed and the desired target speed perhaps we could combine these two improvements and induce smaller longer deltas at the start of the ramp up or down and shorter time deltas with larger velocity deltas at the end of the acceleration ramp the source code for picpid.c is available for the november 2008 column at www.servomagazine.com under mr roboto as picpid.zip rather than duplicate this file for this article i ll point you back to the code as it was set up with the earlier article in the spirit of green energy perhaps this will save us a few electrons as i have said before this isn t a perfect implementation but it is a serviceable one that won t interfere too badly with the execution of any other code you may have running in your robot a better implementation would be to implement the pid and trapezoidal acceleration curve in a dedicated processor so that it can concentrate on the job of simply moving the robot by turning the listing 1 pseudo-trapezoidal acceleration ramp code figure the speed ramping value if action a_const ifabsendpos calcpos counter calcpos dirvacc else skip if we are close calcpos endpos vc getcorrectioncalcpos setmotorvc listing 2 pseudo-trapezoidal acceleration ramp setup code case `a vacc 1 if vacc 1 vacc 1 counter vacc+1 break case `a vacc 1 counter vacc+1 break decrease the ramp rate by 1 increase the ramp rate by 1 motors well that`s it for another mr roboto column i hope you ve felt that it was time well spent as usual i can be reached for questions comments and criticisms at roboto@servomagazine.com and i ll be happy to work on it until next time keep on building those robots sv servo 04.2009 15
[close]