Magnets, sensors create paths for automated guided vehicles

Application Update: An automated guided vehicle (AGV) can be built with as little as two components: a magnetic guide sensor and a dual-channel motor controller.
By Cosma Pabouctsidis December 19, 2013

Magnetic guide sensor will detect the center position of an adhesive magnetic tape up to 60 mm away. Courtesy: RoboteqAn automated guided vehicle (AGV) can be built with as little as two components: a magnetic guide sensor and a dual-channel motor controller. The AGV will follow a track made of an adhesive magnetic tape affixed on the floor. The magnetic sensor will measure how far from the center of the tape it is and provide the information to the motor controller, which will then adjust the steering so the vehicle remains at the center of the track.

Magnetic markers positioned on the left and right side of the track give the AGV location information that will be used to make stop and fork left/right decisions.

Magnetic track guiding

Magnetic tapes are one of several line-following techniques. The other two main techniques are induction wire guide and optical. A table compares each of these techniques.

Automated guided vehicles table: Tracking comparison

When comparing AGV tracking techniques, magnetic tape is the easiest to lay and modify while providing excellent durability and reliability, compared to induction wire and optical. Courtesy: Roboteq

Chassis design

When designing the vehicle, there are four basic ways of providing drive and steering, shown in the diagrams. Some types are easier to build; others have better steering characteristics. Two of these designs are fully symmetrical and may be operated in both directions. The chassis design table lists the characteristics of each design.

Four typical AGV chassis designs are shown. Courtesy: Roboteq

Automated guided vehicles table: Chassis design

Various AGV designs differ in characteristics, as shown. Courtesy: Roboteq

Sensor mount

An AGV uses a magnetic guide sensor from Roboteq. Courtesy: Artisteril SA of Barcellona, Spain.The sensor should be placed as shown in the above diagrams for each chassis design. For the first two chassis types, the sensor must be placed near the front edge of the chassis. On long AGVs, this means that a little steering will cause a wide swing at the front and will make the steering control more difficult.

On the steerable drive wheel design, the sensor can be placed on the chassis. Or it may be made part of the wheel assembly and turn with it.

For best results, place the sensor at 30 mm above the floor and ensure that the height fluctuates within +/-10 mm at most as the AGV moves along the track.

Sensor-motor controller interface

The MGS1600C has several output types. Features and typical uses are shown in the sensor attributes table.

Automated guided vehicles: Sensor attributes table

Sensors used for AGVs vary in attributes. Courtesy: Roboteq

In the MutliPWM mode, the sensor data is output on one wire in a series of variable width pulses, containing the track detect signal, track position, and left and right marker detect signals. This pulse can be connected to any of the Roboteq motor controller’s pulse inputs. Once the pulse input is configured as “Magsensor,” the sensor information is transferred transparently and continuously to the motor controller, from where it can be processed using the MicroBasic scripting language, or accessed by an external computer or PLC via the controller’s serial or USB port.

Electrical wiring

An example AGV wiring diagram is shown. Courtesy: RoboteqThe wiring diagram shows the magnetic guide sensor and motor controller in a typical four-wheel-drive chassis. This diagram is applicable to all Roboteq dual-channel brushed motor controllers.

A figure shows the controller’s connector details. This wiring is compatible with all Roboteq controllers equipped with a 15-pin DSub connector. The sensor and button can be connected to any other pulse and digital inputs. Refer to the product datasheet for the list of available signals and pin outs. The pulse output is on the blue wire of the sensor cable.

Configuration, testing

The sensor and controller must be configured so that they will each function as desired, and communicate with each other.

A sensor and button connect to the AGV motor controller. Courtesy: RoboteqThe sensor is configured by default to output MultiPWM pulse and therefore can be used without further configuration if the track is made of Roboteq-supplied 25 mm magnetic tape. Once powered, the Tape Detect LED will flash at a low rate if no tape is present. When tape is in range, the LED will be on steady, and its color will change when the tape is at the right or left.

For configuration, monitoring, and troubleshooting, connect the sensor to the PC via the USB connector located under the screw plug. Run the Magsensor PC utility to change the tape width if using a 50 mm tape, or use the waveform display view to monitor the shape of the magnetic field.

Magnetic sensor connectors and LED indicators are shown. Courtesy: RoboteqWith no tape present, the PC utility must show a nearly flat line. For best results, always perform a zero calibration when operating the sensor in a new environment.

Moving a tape under the sensor will cause a "bell" curve to appear on the chart. The curve must be on the positive (up) direction. If the curve is going down, change the Tape Polarity setting in the configuration menu. Makers will also cause a bell curve, but the curve should be going down. A screenshot shows the resulting curve when placing a left marker and a centered track.

Motor controller configuration

To receive and recognize data from the sensor, the controller must first be connected to a PC running the Roborun+ PC utility. In the configuration menu, the pulse input that is connected to the sensor must be enabled and configured as “Magsensor.”

This is the captured magnetic field waveform when no tape is present. Courtesy: Roboteq This is the captured magnetic field when the left marker and center track are present. Courtesy: Roboteq

Next, the controller must be configured to operate in mixed mode so that the steering command will apply a different amount of power to the left and right motor for making turns.

Magsensor to controller

When the sensor and the motor controller are connected to each other using the single wire and MutiPWM mode, the sensor data are transferred periodically, and in the background, into the motor controller from which they can be accessed and used.

An additional set of queries is available for reading this information from the motor controller. The queries can be sent either from the motor controller’s serial port, or from within a MicroBasic script running in the motor controller. (See the query set table.) 

Automated guided vehicle table: Query set

Queries can be sent either from the motor controller’s serial port or from within a MicroBasic script running in the motor controller. Courtesy: Roboteq

Implementing the AGV controls

Diagram shows the left and right AGV track captures at the forks and merges. Courtesy: RoboteqOnce the sensor and motor controllers are verified to work, we can proceed to the automatic mode. In this article, all the computation is done in the motor controller using the MicroBasic scripting language

Steering control

The sensor outputs a value that is the tape’s distance from the center of the track. This information is then used to correct the steering. If the tape is centered, the value is 0, and no steering correction is needed. The farther the track is from the center, in one or the other direction, the stronger the steering change. In this example, a proportional control is implemented. For best precision and response time, the control algorithm may be improved to a full PID (proportional-integral-derivative).

Throttle control

How the throttle power is controlled (when to start, stop, accelerate, slow down) is application dependent. In this example, the AGV will be made to move when a tape is detected, take left or right forks, and stop at precise locations. The AGV will then resume moving after a set time, or when a user button is pressed. The AGV will stop when the track is no longer present.

Markers are used for indicating fork, merge, and stop locations. Courtesy: RoboteqIn a practical implementation, the AGV throttle will be controlled by an external device, such as a PLC. The PLC must then be connected to one of the motor controller’s inputs. The throttle information can be an analog voltage or a variable duty cycle PWM signal.

Fork, merge management

The sensor has an algorithm for detecting and managing up to two-way forks and merges along the track. Internally, the controller always assumes that two tracks are present: a left track and a right track. When following one track, the sensor considers that the two tracks are superimposed. When entering forks, the track widens, and so does the distance between the left and right tracks. When approaching merges, the sensor will report a sudden spread of the left and right tracks but will otherwise operate the same way as at forks.

Localization using markers

An example AGV track shows one possible layout. Courtesy: RoboteqMagnetic markers are a piece of magnetic tape of opposite polarity located left and/or right of the center track. Markers provide a very simple and cost-effective method to identify specific locations along the track.

This application uses markers on the left or right side to indicate which track to follow at a fork. Markers located at the left and right side will indicate a stop location.

More elaborate marker arrangements can be made to carry more information about a location on the track. An example of multi-level markers is provided in a diagram.

Manual steering override

It is common to require that the AGV be driven manually, to place it in position, or to move it along an untracked path. Buttons, a joystick, a PLC, or an RC radio can be connected directly to the motor controller’s free inputs. The program running inside the motor controller can easily be made to switch from automatic to manual command. Manual override is not described here.

Test track description

Here is the program flow chart for the example provided. Courtesy: RoboteqThe test track figure shows a simple AGV track with several loading stations and one stop station. For simplicity, the AGV here will stop 30 seconds at every station, or until the operator presses the push button.

The flow chart shows the structure of the MicroBasic program that will run inside the motor controller to move and steer the AGV along the track. The full source code is provided at the bottom of the article.

Manual AGV test drive

Before the sensor can be used for automatic steering, it is a good idea to test drive the chassis manually, either by attaching a joystick to the PC that is connected to the motor controller, or by using an RC radio. If the vehicle is difficult to drive manually, in automatic mode it will be equally challenging. Modify the design so that it drives and steers as smoothly and accurately as possible.

Testing the automatic steering program

When running the program for the first time, it is recommended to lift the AGV’s wheels off the ground. Then place a piece of magnetic tape below the sensor. Verify that the left and right wheels start rotating when the tape is detected. Verify that the left and right rotation speed changes as the tape is moved away from the sensor’s center, in a manner that would cause the AGV to rotate so that the sensor would become centered with the tape. If the AGV rotates away, then invert the polarity of the Gain value in the script.

With the AGV wheels on the floor, verify that the steering correction is such that the sensor never moves far from the track. Increasing the Gain value will cause a stronger correction when the sensor moves away from the tape, but it can make the AGV oscillate if the gain is too high. Find the optimal Gain value for stable and accurate tracking.

Testing fork, stop markers

Make a new path for an AGV with a magnetic guide sensor from Roboteq can be easier than some other methods. Courtesy: Artisteril SA of Barcellona, Spain.Markers are best tested with the AGV on the track. Verify that the AGV follows the expected track at a fork. When entering a merge, ensure that the AGV is following the correct track and that it will not jump to the opposite track when it enters the sensor’s range.

Verify that the AGV stops when a left and right marker are detected at the same time. Check that the AGV resumes motion after 30 seconds, or when the button is pressed. Beware that as the AGV moves away from the marker pair, one of the two markers will disappear from the sensor’s range before the other. The other marker will remain active for a short duration and will therefore be considered as a left or right fork marker. Ensure that one marker is present before the next fork or next merge following a stop location.

Improving the AGV

Using a more complex steering algorithm: The sample script uses a simple proportional control, where the amount of steering correction is the distance from the center track, multiplied by a gain factor. For better results, the script may need to be enhanced so that a proportional-integral or full proportional-integral-derivative control is used instead.

The amount of correction can also be capped to avoid oversteering. In a variable speed system, it may also be desirable to have a different correction gain at slow and high speeds.

Using multi-level markers

Diagram shows an example of a multi-level marker. Courtesy: RoboteqIn this application example, we used a simple left and right marker pair to identify a stop location. In typical applications, more information is needed about location so that the AGV will change its behavior. For example, identifying segments of tracks where the AGV must move at a high speed and others at low speed, identifying load stations requiring longer pause time than others, or identifying charging stations where the AGV will stop only when its battery level is low and resume when the battery is charged.

One simple and free technique is to count markers in a track segment delimited by a marker segment on the opposite side. A figure shows such a marker configuration. When a left marker first appears, the counter is reset. The counter is then incremented at every appearance of a right marker while the left marker is still present. When the left marker disappears, the counter is evaluated and the AGV can alter its operation accordingly.

Improving stop position accuracy

In applications requiring the AGV to stop at a very precise location, a secondary sensor, oriented at 90 degrees from the main sensor, can be added. This sensor can then be used to locate another magnetic guide with 1 mm position accuracy. Sensors and guides arrangements are shown in the figure.

AGV localization, safety

Using secondary marker adds precision for longitudinal stop positioning. Courtesy: RoboteqFor safety reasons, it is typically necessary to fit the AGV with an infrared or a laser range finder so that it will stop if a person or obstacle is detected along the track. Range finders typically provide a digital signal which can easily be connected to an input on the motor controller or to a PLC if one is present.

If more information is needed by the AGV about its location along the track, RFID tags positioned in key locations are a good solution. However, RFID tags typically imply the presence of a microcomputer or a PLC on the AGV to process the data and make navigation decisions.

Script source

The source code below is written in Roboteq’s MicroBasic language and runs inside the motor controller to perform the AGV functionality described in this article.

option explicit

‘ This script provide basic control for an AGV.

‘ Motor will turn on upon the presence of a track and stop when track disappears.

‘ The track position information is used to provide left/right steering.

‘ At forks, the AGV will follow the left or right track depending whether the last

‘ marker detected was on the left or right side of the track.

‘ Make sure you precede merges with a marker so that the AGV remains on the main track.

‘ The presence of a left and right marker simultaneously will cause the AGV to stop for

‘ 30 seconds or until the operator presses the button

‘ declare variables

dim Gain as integer

dim DefaultThrottle as integer

dim TapeDetect as boolean

dim MarkerLeft as boolean

dim MarkerRight as boolean

dim Throttle as integer

dim Tape_Position as integer

dim LineSelect as integer

dim Steering as integer

dim GoButton as boolean

dim RunState as boolean

dim NotOnStopMarker as boolean

dim PauseTime as integer

‘ initialize constants

Gain = -7 ‘ Use negative value to invert steering command

DefaultThrottle = 250 ‘ Motor power level while the AGV runs

LineSelect = 1 ‘ Use left track by default

PauseTime = 30000 ‘ in milliseconds

‘ main loop to repeat every 10ms

top:

wait(10)

‘ read sensor data

TapeDetect = getvalue(_MGD)

MarkerLeft = getvalue(_MGM, 1)

MarkerRight = getvalue(_MGM, 2)

‘ Read button state

GoButton = getvalue(_DI, 2)

if (GoButton) then SetTimerCount(1, 0) ‘ Pressing the button will clear the pause timer

if GetTimerState(1) then RunState = true ‘ When pause timer is cleared, AGV is allowed to run

‘ Use TapeDetect and Pause Timer to apply throttle or not

if (TapeDetect and GetTimerState(1))

                  Throttle = DefaultThrottle

else

                  Throttle = 0

end if

‘ Check Marker presence to select Left or Right track

if (MarkerLeft) then LineSelect = 1

if (MarkerRight) then LineSelect = 2

‘ Detect when transitioning onto stop markers

if (NotOnStopMarker and MarkerLeft and MarkerRight)

                  NotOnStopMarker = false ‘ Mark stop marker detection so that it is not detected again until AGV moved away

                  SetTimerCount(1, PauseTime) ‘ Load stop timer timeout value

                  RunState = false

else

                  NotOnStopMarker = true

end if

Tape_Position = getvalue(_MGT, LineSelect)

‘ use tape position multiplied with gain as steering

Steering = Tape_Position * Gain

‘ Send throttle and steering to controller Configured in Mixed mode

setcommand(_G, 1, Throttle)

setcommand(_G, 2, Steering)

‘ Log output. Useful for troubleshooting. Comment out when done.

print("r", TapeDetect,"t", Tape_Position,"t", MarkerLeft,"t", MarkerRight,"t", Throttle,"t", Steering,"t",RunState,"t",LineSelect)

goto top ‘ Loop forever

– Cosma Pabouctsidis is senior technologist, Roboteq Inc.  Edited by Mark T. Hoske, content manager, CFE Media, Control Engineering, mhoske@cfemedia.com.

ONLINE

www.roboteq.com

Search AGV at www.controleng.com for other AGV advice.