To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 22084
     
   
Subject: 
Re: Balancing robots
Newsgroups: 
lugnet.robotics
Date: 
Tue, 20 Jan 2004 23:10:19 GMT
Viewed: 
3127 times
  

Hello PeterBalch,

Tuesday, January 20, 2004, 9:19:20 PM, you wrote:


P> How does a balancing robot like Legway balance on a patterned floor? Or can
P> it?

P> I've got some of the way there.

P> My understanding from reading the web descriptions of various projects is
P> that you _ought_ to measure
P>         - angle of tilt
P>         - rate of change of tilt
P>         - position of wheel
P>         - rate of change of wheel

P> If you have only IR sensors then you can measure the rate of change of tilt
P> on a plain floor. If you assume that when the robot is turned on, the IR
P> measurement is "upright" then you can estimate absolute tilt. If you
P> integrate the motor commands over a few seconds and you're mostly heading
P> "forwards" then you adjust the "upright" estimate.

P> But the Legway (for instance) can't measure the position of wheel or the
P> wheel velocity. You can pretend that the motor commands correspond to the
P> wheel velocity and smooth or integrate those numbers. That helps with
P> balance but the results (in my simulation) are never as good as a robot
P> that has wheel encoders. Is it possible to measure wheel velocity by
P> measuring the motor back-emf?

P> On a patterened floor, maybe you can have several IR sensors and discard
P> the measurements with the bigest changes on the assumption that they
P> represent a change in the pattern.

P> Has anyone tried it?

P> Peter

|P> How does a balancing robot like Legway balance on a patterned floor? Or can
|P> it?
|
|P> I've got some of the way there.
|
|P> My understanding from reading the web descriptions of various projects is
|P> that you _ought_ to measure
|P>         - angle of tilt
|P>         - rate of change of tilt
|P>         - position of wheel
|P>         - rate of change of wheel
|
|P> If you have only IR sensors then you can measure the rate of change of tilt
|P> on a plain floor. If you assume that when the robot is turned on, the IR
|P> measurement is "upright" then you can estimate absolute tilt. If you
|P> integrate the motor commands over a few seconds and you're mostly heading
|P> "forwards" then you adjust the "upright" estimate.
|
|P> But the Legway (for instance) can't measure the position of wheel or the
|P> wheel velocity. You can pretend that the motor commands correspond to the
|P> wheel velocity and smooth or integrate those numbers. That helps with
|P> balance but the results (in my simulation) are never as good as a robot
|P> that has wheel encoders. Is it possible to measure wheel velocity by
|P> measuring the motor back-emf?
|
|P> On a patterened floor, maybe you can have several IR sensors and discard
|P> the measurements with the bigest changes on the assumption that they
|P> represent a change in the pattern.
|
|P> Has anyone tried it?

P> Peter

I built a Legway clone using two standard lego light sensors, both pointing
down, one on the front one on the back. Control was via a PID type
algorithm. The actual
control wasn't that robust and only worked well in a darkened room but
it did balance and I could get it to spin on the spot. I don't have the
code to hand at the moment but this is a basic pseudo listing.

offset = light_sensor_front - light sensor back;

/*light sensors don't produce an equall reading so need to be matched using an offset.
This is achieved by holding the bot vertically while it takes a
reading*/

while(1)

{
        error = light_sensor_front - light sensor back + offset;
        error_rate = (error - error_old)/2;
        error_int = (error + error_old)/2 + error_int;
        error_old = error;

        /*PID*/
        error_total = (KP * error) +  (KI * error_int) + (KD *
        error_rate);

        if (error_total >= 1)
           {
           motor direction = forward;
           }
        else
            {
            motor direction = reverse;
            error_total = -error_total;
            }

        motor_PWM = error_total

        wait 20ms;

}

Think that's it, probably mistakes. That code will just do basic
balance, if you want to move forward alter offset. If you want to
spin use one of the above code blocks for each wheel.

Probably not the best code and no where near as god as Steve's but it
does the job, sort of.

I'm currently messing with a homemade accelerometer circuit. (ADXL105)
and a fe gyroscopes. I've sucessfully interfaced these to the RCX. The
fun is just starting!

Good luck

Allen

--
Best regards,
Allen                            mailto:Kaptain.korolev@ntlworld.com

   
         
   
Subject: 
Re: Balancing robots
Newsgroups: 
lugnet.robotics
Date: 
Wed, 21 Jan 2004 13:18:03 GMT
Viewed: 
2252 times
  


I built a Legway clone using two standard lego light sensors, both pointing
down, one on the front one on the back. Control was via a PID type
algorithm. The actual
control wasn't that robust and only worked well in a darkened room but
it did balance and I could get it to spin on the spot. I don't have the
code to hand at the moment but this is a basic pseudo listing.


Hi Allen,

Could you post the actual code and perhaps a photograph of your robot, I want to
try that for a while and it would eliminate some fiddling!

TIA,

Philo

   
         
   
Subject: 
Re[2]: Balancing robots
Newsgroups: 
lugnet.robotics
Date: 
Wed, 21 Jan 2004 23:57:47 GMT
Viewed: 
2449 times
  

Hello Philippe,

Wednesday, January 21, 2004, 1:18:03 PM, you wrote:


I built a Legway clone using two standard lego light sensors, both pointing
down, one on the front one on the back. Control was via a PID type
algorithm. The actual
control wasn't that robust and only worked well in a darkened room but
it did balance and I could get it to spin on the spot. I don't have the
code to hand at the moment but this is a basic pseudo listing.


PH> Hi Allen,

PH> Could you post the actual code and perhaps a photograph of your robot, I want to
PH> try that for a while and it would eliminate some fiddling!

PH> TIA,

PH> Philo

Hi,

I'll try and find the code and grab a picture of the bot  at the
weekend. I'm snowed under at the minute with a progress report on my
university project. I don't have the code to hand at the minute
as it's on an old computer that I use for Mindstorms stuff. The code
itself is not more complicated that the pseudo listing I gave you,
nothing like what Steve wrote for the Legway. I'll also try and take a
few small mpegs to stik on the web of it doing it's stuff.


--
Best regards,
Allen                            mailto:Kaptain.korolev@ntlworld.com

   
         
     
Subject: 
Re: Re[2]: Balancing robots
Newsgroups: 
lugnet.robotics
Date: 
Thu, 22 Jan 2004 07:01:15 GMT
Viewed: 
2459 times
  

I'll try and find the code and grab a picture of the bot  at the
weekend. I'm snowed under at the minute with a progress report on my
university project.

Thanks a lot ! I'm not in a hurry ;o)

Philo

   
         
   
Subject: 
Re: Re[2]: Balancing robots
Newsgroups: 
lugnet.robotics
Date: 
Wed, 28 Jan 2004 10:04:53 GMT
Viewed: 
2696 times
  


I'll try and find the code and grab a picture of the bot  at the
weekend. I'm snowed under at the minute with a progress report on my
university project. I don't have the code to hand at the minute
as it's on an old computer that I use for Mindstorms stuff. The code
itself is not more complicated that the pseudo listing I gave you,
nothing like what Steve wrote for the Legway. I'll also try and take a
few small mpegs to stik on the web of it doing it's stuff.

As I was stuck home yesterday by a sore throat, I had plenty of time to build a
legway clone that works quite well using an adapted version of your generic
code. I choose to ease the problem by lowering center of gravity (I put the
bottom of RCX between the motors, not above) so it balances well even with
non-optimal light conditions.

I'll try to post some videos and code in the near future...

Philo

 

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR