Pages: 1 2 [3] 4 5 ... 8   Go Down
Author Topic: Balancing robot for dummies  (Read 39072 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm going to try this code on a ChipKIT Uno32 because of the incredibly fast processing speed in comparison to the Arduino. (80Mhz) I think that should take the loop time down significantly, thus potentially leading to better balance.

One thing I really don't understand is the Kalman filter.

Patrik, or Kas, could one of you offer any insight into being able to further tune balance by changing the Kalman parameters?
Logged

Denmark
Offline Offline
Sr. Member
****
Karma: 10
Posts: 287
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,

Just want to show you a robot I made. It uses the motors, brackets and motorcontroller as Kas original used:


See my blog post for more details: http://blog.tkjelectronics.dk/2012/03/the-balancing-robot/.

Update
I have now ported the code to Arduino.
The code can be found at github: The Arduino version, can now be found at github: https://github.com/TKJElectronics/BalancingRobotArduino

Regards
Kristian Lauszus
« Last Edit: April 15, 2012, 04:19:37 pm by Lauszus » Logged

Moscow
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Good job, Lauszus!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

In wich sector ( industry, army ) it will be able to be use ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Unbelievable work Lauszus!!

I am also in the middle of getting my robot to balance.. Tried to implement the original coding from KASbot but I haven't yet managed to change the PID values etc.

It's only when you try to do this yourself that you realise how challenging it is! Hopefully I will get my balancing program working soon... RC control is a long way off!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



* Robot Pic.png (174.42 KB, 274x363 - viewed 82 times.)
Logged

Denmark
Offline Offline
Sr. Member
****
Karma: 10
Posts: 287
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

#ericlausanne
I'm not totally sure what you mean? smiley

#rob4white
Thank you, see my reply at my blog: http://blog.tkjelectronics.dk/2012/03/the-balancing-robot/#comment-20483
Logged

Moscow
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

In wich sector ( industry, army ) it will be able to be use ?
only for play and self-satisfaction =)
Logged

Moscow
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Lauszus make screenshot of your "Processing application" pls
Logged

Moscow
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

rob4white
why the IMU (red small board) placed on the middle platform, not near the wheel axis (middle of bottom platform)?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Eugene

I know what you mean that it is deemed most effective to place the IMU as close to the wheel axle as possible. However my thinking was that because the gyroscope measures the angular velocity, I thought it would be most effective if the gyroscope was as close to the top of the structure ie. where the battery is so it would measure any slight variations in angular velocity...

I could be wrong in the this... Let me know your thoughts!

Logged

Denmark
Offline Offline
Sr. Member
****
Karma: 10
Posts: 287
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

#Eugene
See my github, here a link for the compiled versions of the processing application:
https://github.com/TKJElectronics/BalancingRobot/tree/master/PIDController/Compiled%20versions

#rob4white
You should put the IMU as close to the axis as possible, as I wrote in my email.
Logged

CT, USA
Offline Offline
Sr. Member
****
Karma: 3
Posts: 446
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I just built a balancing robot using ATmega328 and Arduino libraries myself. I built it using a toy truck as a base, while not as stable as some other builds it is easy on the wallet. Here is a short video:


You can find more information on the theory and the build on my blog (three parts):

http://www.kerrywong.com/2012/03/08/a-self-balancing-robot-i/
http://www.kerrywong.com/2012/03/14/a-self-balancing-robot-ii/
http://www.kerrywong.com/2012/03/21/a-self-balancing-robot-iii/
« Last Edit: March 23, 2012, 07:25:31 pm by AlphaZeta » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Eugene and Lauszus for the advice, I fully understand now why the IMU should be as close as possible to the axis of rotation.

However, I am quite close to achieving balance with the current setup, I am kinda short on time to move the IMU to the lower deck as the project deadline is fast approaching... Or am I just wasting my time trying to achieve balance with the IMU located where it currently is?? (about 50mm above the axis of rotation in the vertical direction)

My current stumbling block is finding the correct PID parameters.. I am using the original coding as posted by Kas in the initial thread on this topic

Am I correct in thinking that I should tune the terms in this manner. Tune Kp value first then Ki value then the Kd value and finally the "outside"  K value? The coding I am referring to shown here:

Code:
float K = 1.4;
int   Kp = 3;                     
int   Ki = 1;                   
int   Kd = 6; 
int last_error = 0;
int integrated_error = 0;
int pTerm = 0, iTerm = 0, dTerm = 0;

int updatePid(int targetPosition, int currentPosition)   {
  error = targetPosition - currentPosition;
  pTerm = Kp * error;
  integrated_error += error;                                       
  iTerm = Ki * constrain(integrated_error, -GUARD_GAIN, GUARD_GAIN);
  dTerm = Kd * (error - last_error);                           
  last_error = error;
  return -constrain(K*(pTerm + iTerm + dTerm), -255, 255);
}

I will try to post a video today to show the stage of balancing that I am at! smiley

Any advice appreciated! Thanks guys!
Logged

Tennessee
Offline Offline
Newbie
*
Karma: 2
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys I am thinking about trying to build one of these self balancing robots.  I have an arduino r3 motor shield.  Im curious if I can find good enough motors that I can control with my shield and not push the 2 amp limit.
Logged

Pages: 1 2 [3] 4 5 ... 8   Go Up
Jump to: