Regbot settings
(→Line sensor) |
(→Heading control) |
||
Line 127: | Line 127: | ||
[[File:heading_ctrl_20_deg.png]] | [[File:heading_ctrl_20_deg.png]] | ||
− | Figure 9. The log starts at about 0.55 seconds and the turn starts at 0.1 seconds hereafter. The dotted line is the resulting heading, the magenta line is the target heading (when not in a turn | + | Figure 9. The log starts at about 0.55 seconds and the turn starts at 0.1 seconds hereafter. The dotted line is the resulting heading, the magenta line is the target heading (when not in a turn. As the acceleration is rather slow (1m/s^2) the turn radius is not reached when half the turn is reached, so at this time the turn is deemed finished so that there is time to recover. At this time the heading control is re-engaged and takes the heading to the desired 20 degrees. The x-axis is in seconds and the y axis in degrees. The mission graph (red) is the line number in the script below. |
This curve is generated with the following script: | This curve is generated with the following script: |
Revision as of 12:55, 28 December 2021
Back to Robobot.
This is some suggestions for changed settings for Robobot.
Using the regbot configuration GUI.
Contents |
Robot configuration
Metric setup
The main items are:
- Hardware version: 6 in all cases
- Wheelbase WB: The distance between centres of the driving wheels (0.2 to 0.3m)
- Gear N:1: Motor dependant, we have N=10, N=18 and N=30.
- Pulses per revolution: 64 on all TS-37GB-555 motors.
- Wheel radius: dependent on the wheels (0.03 to 0.08m)
Most settings require 'Edit' to be pressed prior to any change.
Use 'Save' and 'Save to flash' in this order to save the changes, also after a reboot.
Other settings:
- Reverse motor, 'rev.enc.left', 'rev.enc.right' should not be ticked.
- Tilt offset: a value in radians, that could offset the reported tilt angle (0.0 is fine).
- Go idle at: To keep the battery safe, this value should not be less than 9.9V.
Line (edge) sensor
The line sensor should be calibrated across a white tape line, and looking into nothing (reflection on black). After that "show normalized" should all sensors show about 75%.
The sensor will work on white lines only.
Figure 2. Line sensor calibration GUI, first where a white line is illuminated (for calibrating on white). Reflection on black is fine if the sensor looks at nothing (far away). The sensor works on white lines only. The second image with a line detected. Crossing detect is here set to '5', which corresponds to the number of sensors seeing white to be deemed a crossing line. On some GUI, mostly windows, the bars will not update until the maximum number (4096) is changed.
Figure 3. schematics. Each sensor, a BPW46, is biased by transistor, QN1, and the signal amplified and filtered through QP1, the output is LS0 and feed to a Teensy AD converter. VDD is 5V. The LEDs are pulsed 0.5ms on, 0.5ms off. each set of 3 LEDs is controlled by one constant current transistor. 12V is battery voltage. The PCB layout, where the LED and sensor sides are isolated.
Figure 4. Photo of the linesensor top and bottom view.
IMU calibrate
The gyro can be calibrated only. Let the robot stand still and press the calibrate button.
Figure 5. IMU calibration tab. Pressing the 'calibrate' button starts a 1-second offset calibration. The gyro values are shown on the low-left graph for 100 measurements, and with a y-scale in milli-degrees per second. The accelerometer, lower right, shows that the z-axis is affected by gravity showing about 10m/sec^2, the x and y-axis should be close to zero (but is ~1). The top-right graph is the tilt angle, around the y-axis, the scale is shown in milli-degrees, and is a combination of accelerometer and gyro.
Control issues
Some examples of control settings.
Velocity control works fine with "Feed forward" = 4 and a Kp = 15 - and keep the output limit = 9V (or less).
Edge control
For higher speed in the range 0.7-0.9 m/s the following control settings could be used.
With the new 10cm line sensor optimal setting is not found, a kp=0.1 - 0.15 seems OK, output limit should not be set. Here are two sets of settings that could be used, both with relatively short distance from the robot rotation point and the sensor (4-7cm) longer distance should have lower Kp gain.
Figure 6. From Thomas Marcussen - BSc project
Figure 7. The control uses a Lag-controller to decrease the static gain by a factor 5 (a pole with a time constant of 1.5 sec and a zero with a time constant of 0.3 seconds). This means that the high-frequency gain is Kp*0.3/1.5 = 0.06.
A test script to could be:
thread=1 vel=0.01, acc=5.0, log=50.0: time=0.2 vel=0.9, edger=1, white=0: dist=10.0, xb=20 vel=0,event=7 : xb<10 :vel< 0.1 vel=-0.3,tr=0.1:turn=60 vel=0.3,tr=0.1:turn=60 vel=-0.3,tr=0.1:turn=60 vel=0.7, edger=-1, white=0: dist=10.0, xb=20, log=0
The mission follows right side of line,
- in a left curve (1mØ) until crossing a line
- wait for crossing line to disappear,
- and velocity reach 0
- make a 3-point 180 degree turn
- follow the other side of line - now a right curve (until log is full or 10 meters or crossing another black line)
The difference between a left and a right curve is the "edger=1.0" and "edger=-1.0", this makes the robot follow the curve with an offset of 1cm towards the center of the curve (more left in a left curve). This gives more space for overshoot when hitting the curve - the sensor range is about +/- 2cm.
If the line is no longer valid, then the last curvature is maintained, i.e. there is a chance that the the line will be re-found.
Heading control
Heading control is not used during a tr=xx based turn, but after such a turn the heading control maintains the end heading. The end heading is the start heading plus the turned angle.
While driving straight, then the heading control attempts to keep the heading.
Heading control is somewhat speed-dependent, these parameters seem to be good at about 0.6 m/s.
Figure 8. Heading control parameters for OK turns at a velocity of about 0.6 m/s. The controller is a PI-Lead controller with a weak pre-filter.
A 20-degree turn with an acceleration limit of 1m/s^2 and a turning radius of 0.2m makes a turn like this:
Figure 9. The log starts at about 0.55 seconds and the turn starts at 0.1 seconds hereafter. The dotted line is the resulting heading, the magenta line is the target heading (when not in a turn. As the acceleration is rather slow (1m/s^2) the turn radius is not reached when half the turn is reached, so at this time the turn is deemed finished so that there is time to recover. At this time the heading control is re-engaged and takes the heading to the desired 20 degrees. The x-axis is in seconds and the y axis in degrees. The mission graph (red) is the line number in the script below.
This curve is generated with the following script:
thread=6 : time=0.01 vel=0.6, acc=1.0: dist=0.1,time=1 log=3.0: time=0.1 tr=0.2: turn=20.0 : dist=0.3, log=0
Distance sensor
The IR distance sensors are of type Sharp 2Y0A21. The sensor works reasonably from about 9cm up to about 50-80cm.
Figure 10. The raw sensor value for D1 and D2 shows a high value (up to about 100000) for near distances and down to about 10000-20000 for far away. The calibration is done by placing an object 13 and 50 cm from the sensor and copying the measured value to the corresponding calibration field. Press edit to open fields for edit. Remember "Apply" and "Save to flash" after calibration.