07.09.09

Homing Behavior – Home in on a Light Source

Posted in Behavior-based Theory, CollectorBot, My Robots tagged , , , , , , at 8:25 pm by Thom

CollectorLight My next robot is taking some time to build, code and  debug, so I thought I would create some quick posts about some of the behaviors I am implementing along the way.  Homing in on a target is a very useful behavior that can be broadly applied to many types of situations.

  • Finding a beacon
  • Finding a light source
  • Following a line


Homing in on a light source

By placing two light sensors on the front of the robot facing ~45 degrees to left and right, we can search for a light source and home in on the signal by checking the difference in light levels between the two sensors.  For example, if the light is brighter on the left, the robot will turn left attempting to equalize the signals between the two sensors (thus point directly at the light source).  Moving the robot forward at the same time allows the robot to home in on the source.

The concept is to utilize two (or more) sensors arranged to allow the robot to consume data and make steering decisions based on signal strength or quality between the two.

Implementation

If (Light > Threshold) {
  DriveCommand( speed, g(right-left));
}

The pseudo-code above illustrates how easy homing can be implemented.  If the robot sees a light to follow, it sets the drive command to move toward it using the difference between left and right light values (multiplied by a gain constant) to control the steering toward the light.

This code can also be implemented as a bang-bang controller by implementing a constant steering value based on the sign of (right – left).  If the light is on the left, sgn() returns –1, if on the right sgn() returns +1.  The gain becomes the steering value.

Other Homing Actions

Homing on a digital beacon can be implemented with the same logic.  The difference is the left and right signals may be counted pulses.  If the left sensor is aligned more to the source than the right, it should theoretically receive more pulses from the homing beacon.  The above implementation can be applied to the counts.

Simple line following also follows this concept.  Two light sensors pointing to the ground can be implemented this way by comparing the two signals and adjusting steering to keep the robot on the line.

WordPress Tags: Behavior,robot,beacon,example,concept,logic,light sensor


Leave a Comment