Skip to content

Commit

Permalink
add state diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelurgio committed Mar 15, 2024
1 parent 1c6c84b commit 44ad89d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
11 changes: 11 additions & 0 deletions _pages/electrical.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ In an early design, both servos were driven using PWM signals generated from the
Instead, we elected to use a PCA9685 I2C servo driver breakout board provided by a member of our team. This driver allows up to 16 servos to be controlled independently, with an onboard clock providing the timing signal for PWM frequency and duty cycle. The PWM duty cycle, which determines servo position, is set by I2C message and is maintained until a subsequent message is received.

Both servos are powered by a dedicated 5V regulator.
<div class="row justify-content-sm-center">
<div class="col-sm-8 mt-3 mt-md-0">
{% include figure.liquid loading="eager" path="assets/img/i2c_components_electrical.png" class="img-fluid rounded z-depth-1" zoomable=true %}
</div>
</div>

### Beacon Sensing
The beacon sensing subsystem is based on an LTR-3208E phototransistor sourced from our lab kit mounted on the robot swivel. The overall purpose of this circuit is to provide an analog voltage level corresponding to the strength of the 3333 Hz beacon signal received by the phototransistor: this allows the robot to measure the direction of maximum received signal and thereby orient itself relative to the IR beacon.
Expand All @@ -78,6 +83,12 @@ The basic sections of the circuit are:
- A final low pass filter to reduce high frequency interference.
- A peak detection circuit, with reset, to provide a smooth analog output voltage to the Arduino.

<div class="row justify-content-sm-center">
<div class="col-sm-8 mt-3 mt-md-0">
{% include figure.liquid loading="eager" path="assets/img/ir_sensors_electrical" class="img-fluid rounded z-depth-1" zoomable=true %}
</div>
</div>

A [Python program](https://github.com/rcollins130/TRACBOT-models) was written to aid in calculation of the required amplification gains, cutoff frequencies, and component values in each stage of the circuit. The [eseries library](https://pypi.org/project/eseries/) was extremely helpful for determining the best combination of resistor and capacitor values to meet gain and frequency specifications.

A video demonstrating use of the beacon sensor for initial orientation is provided in the Results section.
Expand Down
10 changes: 7 additions & 3 deletions _pages/software.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ Our GitHub repository can be found [here](https://github.com/hbuurmei/TRACBOT21-
### State Diagram
---

[insert state diagram]
<div class="row justify-content-sm-center">
<div class="col-sm-8 mt-3 mt-md-0">
{% include figure.liquid loading="eager" path="assets/img/state_diagram.drawio.png" class="img-fluid rounded z-depth-0" zoomable=false %}
</div>
</div>

### Libraries
#### TimerInterrupt
Expand All @@ -27,11 +31,11 @@ The IMU processing class was developed in-house and inherits the open-source [mp
- ``calibrate()`` reads IMU data for an user specified amount the time. The arithmetic mean of this data is stored as the bias for each sensor. This bias is then used to correct the IMU raw measurements to greatly improve accuracy.
- ``update_integrator()`` is called at a fixed interval by ITimer1 to provide estimates of angles and position/velocity. It works by collecting the current bias-compensated measurements and integrating those measurements via a forward Euler approximation.

$$\theta_{z,n+1} = \theta_{z,raw}+(\omega_{z,n}-\omega_{z,bias})\Delta t$$
$$\theta_{z,n+1} = \theta_{z,n}+(\omega_{z,raw}-\omega_{z,bias})\Delta t$$

This function along with the ability to ``reset_integrators()`` is key in measuring our turns to a high degree of precision, necessary for many events in our state diagram.

### Beacon Processing
#### Beacon Processing

#### Line Sensor Processing
The line sensor processing was relatively straight forward in our software. We used hysterisis in order to remove chattering around a single threshold, and the min and max thresholds were turned experimentially such that we could detect line crossings. The software also kept running counters of the number of transitions between ``on_line`` and ``off_line`` states which was useful for debugging. The reliability of our sensor meant that this simple software implentation was very reliable, and it did not cause many issues during the project.
Expand Down
Binary file added assets/img/state_diagram.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/state_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 44ad89d

Please sign in to comment.