Go Back   VEX Forum > Community > VEX Robot Showcase

VEX Robot Showcase Post photos and descriptions of your robots here. Make suggestions and comments on other's robots.

Reply
 
Thread Tools
  #1  
Old 07-25-2007, 02:57 AM
vamfun vamfun is offline
Member
 
Join Date: Jul 2007
Location: Southern Calif
Posts: 78
Images: 2
Send a message via AIM to vamfun
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
Attached Images
File Type: jpg vex_bbot_front_forum.JPG (34.1 KB, 665 views)
File Type: jpg VexBbot_back_forum.JPG (18.4 KB, 460 views)

Last edited by vamfun; 07-25-2007 at 11:34 PM. Reason: Added accelerometer paragraph
Reply With Quote
  #2  
Old 07-25-2007, 10:38 AM
corpralchee's Avatar
corpralchee corpralchee is offline
Senior Member
VEX # 0038
 
Join Date: Dec 2006
Location: Southeast Michigan/Boston Mass.
Posts: 1,753
Images: 30
Send a message via AIM to corpralchee
Re: Working Vex Pendulum Balance Robot

Very cool. I'd love to see a video of that thing.
__________________
Former member of VEXELLENT and Cranbrook Robotics

Currently a Freshman at Northeastern University, member of the NUTRONs #125 College Division/FRC
Reply With Quote
  #3  
Old 07-25-2007, 12:35 PM
MarkO's Avatar
MarkO MarkO is offline
Senior Member
 
Join Date: Aug 2006
Location: Albany, Oregon, USA, North Western Hemisphere, Planet Tera
Posts: 1,577
Images: 10
Re: Working Vex Pendulum Balance Robot

Quote:
Originally Posted by vamfun View Post
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...cts_id=741park

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. 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.

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
WOW!! When is the Video comming out!!!

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...
__________________
MarkO


See Linn-Benton CC's, 2010 MATE Qualification Video.

THANKS for Rating my ROV Team's Video, From Dyno... to DyKnow.
There were 117 redirects from http://www.vexforum.com.


Tech Support Notice and Disclaimer

My "emerging" Vex Site
My Tech Site
Reply With Quote
  #4  
Old 07-25-2007, 02:53 PM
pacoliketaco's Avatar
pacoliketaco pacoliketaco is offline
Senior Member
 
Join Date: Jun 2006
Location: NJ
Posts: 767
Images: 14
Send a message via AIM to pacoliketaco Send a message via Yahoo to pacoliketaco
Re: Working Vex Pendulum Balance Robot

wow, that looks incredible i would love to see a video. now you just have to make it work with vex sensors
__________________
Pace Nalbone
Carnegie Mellon University
Mechanical Engineering Class of 2013

2009 NYC Winner - 56 and 1796
(2009 Regional Record: 18-0-7 wins/ties/losses)

Reply With Quote
  #5  
Old 07-25-2007, 06:22 PM
vamfun vamfun is offline
Member
 
Join Date: Jul 2007
Location: Southern Calif
Posts: 78
Images: 2
Send a message via AIM to vamfun
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.
Reply With Quote
  #6  
Old 07-25-2007, 06:40 PM
MarkO's Avatar
MarkO MarkO is offline
Senior Member
 
Join Date: Aug 2006
Location: Albany, Oregon, USA, North Western Hemisphere, Planet Tera
Posts: 1,577
Images: 10
Re: Working Vex Pendulum Balance Robot

Quote:
Originally Posted by vamfun View Post
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 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 Columb 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.

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
__________________
MarkO


See Linn-Benton CC's, 2010 MATE Qualification Video.

THANKS for Rating my ROV Team's Video, From Dyno... to DyKnow.
There were 117 redirects from http://www.vexforum.com.


Tech Support Notice and Disclaimer

My "emerging" Vex Site
My Tech Site
Reply With Quote
  #7  
Old 07-25-2007, 07:49 PM
vamfun vamfun is offline
Member
 
Join Date: Jul 2007
Location: Southern Calif
Posts: 78
Images: 2
Send a message via AIM to vamfun
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
Reply With Quote
  #8  
Old 07-26-2007, 07:55 AM
Heavy Metal's Avatar
Heavy Metal Heavy Metal is offline
Senior Member
 
Join Date: Dec 2006
Location: Pennsylvania
Posts: 309
Images: 47
Send a message via Yahoo to Heavy Metal
Re: Working Vex Pendulum Balance Robot

Quote:
Originally Posted by vamfun View Post

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
third.you dont need wire pins cause though this can come loose its cheaper to just solder normal wire to breadboard wire u get at radio shack and connect the 2-3 wires to a vex extender cable http://www.radioshack.com/product/in...entPage=family
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)
__________________
my favorite online game http://runescape.com/
warning: vex may cause...
1.sleepless nights
2.anger issues
3.the possbility to go insane
plz build responsibly
(ironically webster defines vex as:
1.to bring trouble, distress, or agitation to
(this suggests stress and/or anger after hours of building vex)
Reply With Quote
  #9  
Old 07-26-2007, 07:59 AM
Heavy Metal's Avatar
Heavy Metal Heavy Metal is offline
Senior Member
 
Join Date: Dec 2006
Location: Pennsylvania
Posts: 309
Images: 47
Send a message via Yahoo to Heavy Metal
Re: Working Vex Pendulum Balance Robot

Quote:
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.
i think i know wat u mean
u want the lock to be inside the wheels center so it wont come loose faster i like it
__________________
my favorite online game http://runescape.com/
warning: vex may cause...
1.sleepless nights
2.anger issues
3.the possbility to go insane
plz build responsibly
(ironically webster defines vex as:
1.to bring trouble, distress, or agitation to
(this suggests stress and/or anger after hours of building vex)
Reply With Quote
  #10  
Old 07-26-2007, 03:44 PM
vamfun vamfun is offline
Member
 
Join Date: Jul 2007
Location: Southern Calif
Posts: 78
Images: 2
Send a message via AIM to vamfun
Re: Working Vex Pendulum Balance Robot

Quote:
third.you dont need wire pins cause though this can come loose its cheaper to just solder normal wire to breadboard wire u get at radio shack and connect the 2-3 wires to a vex extender cable http://www.radioshack.com/product/in...entPage=family)
Hmmm..I'm well aware of these items and of course have used all of them at some time. My beef is with the price that they charge these kids for extender cables. To interface my sensors , I needed 7 male servo connectors. A 4 pack kit extender with male and female ends costs $20 so we have $40 total cost to get 7 male ends. (One might be cleaver and cut them in half and insert wires into the female ends) The Hansen servo wire hobby kit http://www.hansenhobbies.com/product...orkits/ck_sck/
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:
fourth. theres information on the vexlabs site if you click on the motor kit [url="http://www.vexlabs.com/vex-robotics-motor-kit.shtml"]..
As a controls engineer, I would like a detailed data sheet, not just the summary.

Quote:
fifth. there are already aluminum vex parts sold separately [url="http://www.vexlabs.com/vex-robotics-all-products.shtml"]
Glad to see this. Too bad I didn't see any of these on Ebay when I bought mine.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 11:47 AM.