Robot Design  



Home
Lab 1
Lab 2
Lab 3
Botfest Project
Trinity Contest
Motion Control
Laser Engraving
Motion Control Lab


 

Objective

The objective of this lab was to look into feedback systems and motion control. 
 

Design

A small setup was put together, as can be seen in the pictures above, to demonstrate PID control.  What I have in these pictures is a piece of wood onto which everything else is strapped to keep all the parts in place.  The control of this system is the handy cricket, which has built in input sensor ports and output motor ports.  One of the motor output ports is connected to a small servo motor for moving the purple stand, or to put it another way, for positioning the purple stand anywhere from 0 to 180 degrees.  The sensor that gives feedback of the current position in this setup is a potentiometer that is located on the opposite side of the motor on the wooden block.

So all the parts are there for a feedback control system.  The control, the sensor, and the actuator are in place.  Next, a small program was written in cricket logo to do the controlling.  A basic PID equation was used for the control, although I never did implement the Integral part of it as there was no real reason to use it.

The cricket output values for setting the power to the motor port range from -8 to 8 (16 discrete values), with negative values moving the motor in opposite direction than the positive values and with a setting of 0 producing no motion.  Due to the weak motor that I was using any value between -5 and 5 produced no motion by the motor.  So I ended up shifting all the positive values below 6 to 6 and all the negative values below -6 to -6.  Although this did not give me a large range of motor power control, it was sufficient to have a decent feedback control system with which one could demonstrate problems such as overshoot and damped oscillation as well as show a working stable system. 

Below is the cricket logo code listing for a stable system:

global [tmp P I D val act actp mov]

to main
  settmp 6
  setpower tmp
  a, off
  setval sensorb
  setP 12
  setI 0
  setD 0
  setact sensorb
  setactp act
  loop [
    setmov (((val - act) / P) - ((act - actp) / D))
    if (mov > 8) [setmov 8]
    if (mov > 0) [if (mov < tmp) [setmov tmp]]
    if (mov < (0 - 8)) [setmov (0 - 8)]
    if (mov < 0) [if (mov > (0 - tmp)) [setmov (0 - tmp)]]
    ifelse (mov > 0)
      [thatway setpower mov on]
      [thisway setpower (0 - mov) on]
    setactp act
    setact sensorb
]
end
 

 

 

design by RS