Logo

Forums » Segbot » Optimize balancing code

Gerry
Avatar

Hello,
first I want to thank Johndavid for all the material that he shared.
I just realized my segway clone and would like to improve some things.
The following list of problems:
1) The potentiometer Gain seems to have little influence on the speed
2) It seems that the available torque is much lower than the actual engine
3) I notice a slow response of the gyro
4) There are still large swings to achieve a balance "comfortable"
If anyone can help me in this I would be very grateful.
Here's the video of the first test:
http://www.youtube.com/watch?v=_ykJ9GF8tvg&feature=youtu.be
Sincerely,
EVO2013

miral7988
Avatar

concerns and issues

1) Gain pot is a problem with the code. I don't seem to know a way to help that unless you chane the range. I will try it and you should too. I am not sure if it will help.

2) I am using wheel chair motors which don't have a high speed in fact it's only 8mph. If you are using different motors let me know. and also the gear ratio is a factor.

3) Gyro are know to be slower than acc so you can change the ( float gyro_scale = 0.01; ) 0.02 or higher so its in the range of the acc. You can adjust the acc scale to be in range of gyro.

4) the large swing can be adjusted with                         (motor_out = map(output, -250, 250, -gain_val, gain_val); // map the angle) you can change the angle to be lower to gain full speed thus compensate for slow response. example  would be to adjust value -250 which equals 25 degrees to 20 degrees which means  at 20 degrees motors will ramp to full speed.  This will change the swing ratio if you will to a much lower  degree per speed ratio.

 

I tried my best to give you a full detail and possibly solutions to your problems. 

 

MY PROBLEM WITH MY SEGBOT IS THAT AT RAMP UP OR STEEDY SPEED MY MOTORS CUTOFF?!?!?!?!?!? HELP