|
#1
|
|||
|
|||
|
Working Vex Pendulum Balance Robot
I finally have a working inverse pendulum robot (bbot as I call it).
It uses Vex motors , Vex parts and the following non Vex sensors: 5 DOF IMU from Spark (3 axis accelerometer and 2 axis rate gyro) $100 http://www.sparkfun.com/commerce/pro...roducts_id=741 Absolute analog output encoders from US Digital MA3-A-B8. http://www.usdigital.com/products/ma3 ($35 each) These are neat little magnetic encoders that can be read by a/d inputs rather that fooling with interrupts. I programmed using MPLAB and also EasyC. The bbot has a noticeable limit cycle about vertical because of the large nonlinearity in the motors due to friction and slop in the transmission of force between the motor and wheel. Both are significant contributors. The a/d sampling is too coarse for this IMU but I had it around and used it anyway. The LS Bit of the rate gyro represents about 2.5 deg/s and is difficult to integrate without some drift due to sampling errors. However, I blend the integrated pitch rate with fwd/aft accelerometer to get a better measure of vertical. I used MATLAB control systems tool box to design the feedback gains using linear quadratic regulator optimization (LQR) in the discrete domain. They were pretty close to the final settings I used. The feedback command u=k1*angle_error +k2*angle_rate + k3*encoder_rate_symmetric + k4*encoder_pos. Seems to work ok with k4=0. There is not a stable solution if k3=0. So those who try to use just a PD controller on angle will have some trouble if encoder rate is not included. The angle_error and angle_rate are a blend of accelerometer derived tilt and rate gyro output combined in a complementary filter. The accelerometer is lagged with a time constant =1/k_filter and then blended with gyro_rate to eliminate the lags in the short term and retain accelerometer angle in the long term. In pseudo code it looks something like this: angle_rate= (ax-angle_error)*k_filter + gyro_rate ; angle_error=angle_error+ angle_rate *dt ; Note the correction term to the gyro_rate based on the difference between the tilt angle derived from acceleration "ax" and the angle_error used by the system. This effectively converts gyro_rate drift into an angle_error offset rather than a increasing ramp angle_error. For example , if the gyro_rate had a bias of .1deg/sec without the filter blending, the expected error would be 1 deg in 10 seconds. With the filter, the error would only be .1 deg in 10 seconds assuming k_filter is 1. The second line is just the integration of the angle_rate with an update time of dt (=18.5ms) On the to do list is doing the optimization with integral feedback (simulating a PID controller) and adding the remote control inputs to the software. Please feel free to contact me for further information. I will eventually post video on Youtube. I am doing a summer workshop on control theory of a pendulum robot for Robodox team of Granada Hills in LA if anybody wants to participate. Enjoy, Chris S. vamfun@yahoo.com Retired Lockheed Control System Engineer Last edited by vamfun; 07-25-2007 at 11:34 PM. Reason: Added accelerometer paragraph |
|
#3
|
||||
|
||||
|
Re: Working Vex Pendulum Balance Robot
Quote:
I would encourage you to think, about doing an Article for Robot Magazine or Nuts and Volts. Have you found Back Lash in the Gears of the Vex Drive System to be a contributer, or is it the Friction in the Motors that is the Major cause of the limit cycle about vertical? This issue has been raised before.. Another "Lockheed Engineer"!!! Awsome!!! And a "Lockheed Control System Engineer" at that.... What do you think of the Vex System in General??? Also, the link for: 5 DOF IMU from Spark (3 axis accelerometer and 2 axis rate gyro) $100 http://www.sparkfun.com/commerce/pro...roducts_id=741 Works better with the "park" removed from the end. You only have 24 Hours after posting to re-edit your messages... |
|
#5
|
|||
|
|||
|
Re: Working Vex Pendulum Balance Robot
thanks, see my edit of original post. Nuts and Volts has done a balance bot with the Stamps processor and using the same IMU. I have not read the article but have come across web references to it.
I have tried to tighten up the linkages by inserting paper shims where the axle joins the wheels and motors. It helped a little but still probably 5 -10 degs of slop. My MATLAB model has a friction term that attempts to model Coulomb friction but I only have two free body elements (wheels and body) so it is difficult to model the slop. I don't seem to get the limit cycle behavior unless I crank the model gains up by 150%. Eventually, I will add the axle as a free body and I'll be able to estimate the relative effects. As far as Vex system is concerned I'm fairly new to it but its pretty cool. So far I'd like to see improvments in a few areas. First....get rid of those encoders. It is hard to imagine selling a product that cannot get direction when it is so easy to do!@##$$. They are sloppy and much larger than they need to be. Second...the documentation on the timing of the Vex EasyC is sure sparce and at least some explanation of how the EasyC master code works relative to the MPLAB software would help. Ie where are the routines called from relative to the interupt timing loops and how are the interrupts that are accessable to EasyC integrated into the processor software. Third:I had to buy a $35 crimp kit just to add a few wires to the processor input. I'd like to see a few wired pins included with the kit so you can easily add your own sensors. Forth: Include data sheets on the motors and servos... I think I have the right stuff from your forum but not sure. Fifth: lets get most of this stuff made out of aluminum. My bbot weights a ton. Sixth:It would not be hard to tighten up the tolerances on the axles by providing metal hubs or at least provide a set screw collar attached to the wheels and motors which can be tighten to eliminate slop. I was thinking of epoxying the set screw collars included with the kit to the wheels and motors but even then it would be easy to score the axle if high loads were experienced. Well, TTFN Last edited by vamfun; 07-25-2007 at 11:55 PM. |
|
#6
|
||||
|
||||
|
Re: Working Vex Pendulum Balance Robot
Quote:
The Link works correctly now.. Here is a link to the thread Vegway, Balencing Vex Robot that was discussed previously on this forum. What will "add the axle as a free body" do for the linkages??? I am older than most here But I don't know all the Terminology of Control System Engineers... I would believe that others don't either. So please educate us ![]() |
|
#7
|
|||
|
|||
|
Re: Working Vex Pendulum Balance Robot
Well , Classical Control Theory involved adjusting feedback gains and creating compensators using frequency domain (Bode , Nichols, Nyquist) or root locus techniques. Now days with the advent of computers, Modern Control Theory emerged which uses optimization of cost functions to determine gains assuming full state feedback. Instead of adjusting the gains directly, we adjust the weighting factors of the state variables and the control input in the cost function. This is an iterative process. We pick a cost function, look at the response and if it isn't fast enough, we increase the weighting on the state variables. This then uses more control input but the system error converges faster. On the reverse side, if our control inputs tend to saturate because of high gains, we weight them higher in the cost function relative to the state varables. Eventually, a balance is reached and we go with those gains.
Generally, all states are not measured in the actual system due to limited sensors so we create observers that generate the missing states based on error signals from the states that we do measure. When noise is present on the signals we use stochastic control techniques which minimize the error variances. This gets into estimation theory and one of the more common optimal estimators is a KALMAN filter which assumes the noise is a random variable with normal distribution. Rather than try to give a controls course here, try looking up the following on wikipedia or look for tutorials using the following key words. Optimal control theory Linear Quadratic Regulator Kalman filter Estimation Theory Although the theory is upper division college level, a high school kid can use MATLAB with a little calculus under his/her belt to easily design control gains. A good MATlAB controls tutorial : http://www.engin.umich.edu/group/ctm...nd/invpen.html MATLAB control tutorial Last edited by vamfun; 07-26-2007 at 03:54 PM. Reason: added link |
|
#8
|
||||
|
||||
|
Re: Working Vex Pendulum Balance Robot
Quote:
fourth. theres information on the vexlabs site if you click on the motor kit http://www.vexlabs.com/vex-robotics-motor-kit.shtml fifth. there are already aluminum vex parts sold separately http://www.vexlabs.com/vex-robotics-all-products.shtml (7th one down) |
|
#9
|
||||
|
||||
|
Re: Working Vex Pendulum Balance Robot
Quote:
u want the lock to be inside the wheels center so it wont come loose faster i like it ![]() |
|
#10
|
|||
|
|||
|
Re: Working Vex Pendulum Balance Robot
Quote:
which has enough for 10 male and 10 female servo connectors including wire and crimp tool for $35 seemed a much better deal but requires a little more work. Since the 5v and grounds were common to several signal leads, I saved on some pins as well. Quote:
Quote:
![]() |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|