Skip to content

Commit 4c97696

Browse files
WeixuanZjr-brownGhifax
committed
Add implementation details to README
Co-authored-by: Jason Brown <[email protected]> Co-authored-by: Ghifari Pradana <[email protected]>
1 parent efc7421 commit 4c97696

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

README.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,57 @@
22

33
This repository contains code for the robot controller, it should be added as a
44
submodule to the [main Webots project
5-
repository](https://github.com/IDP-L211/simulation).
5+
repository](https://github.com/IDP-L211/simulation). Documentation can be found
6+
at https://idp-l211.github.io/controllers/.
7+
8+
The robot chooses the closest accessible target to drive to, or perform a scan
9+
if no such target is available. When the robot reaches a target, it will check
10+
the colour using two LDRs. If the colour is wrong, the robot will send the
11+
confirmed position to the other robot.
612

713
<p align="center">
814
<img alt="Overall Flowchart" src="docs/figs/overall_flow.svg" width="300">
915
</p>
1016

11-
The class diagram is shown below
17+
Custom classes for devices are created by inheriting from classes in Webots C
18+
interface, which are then composed together in a robot class. Various
19+
subroutines are also handle by child classes (e.g. `TargetingHandler`). The
20+
class diagram is shown below
1221
![Class Diagram](docs/figs/uml.svg)
1322

14-
## Subroutines
23+
## Algorithms and Subroutines
24+
25+
DBSCAN clustering algorithm is used in the scanning subroutine to calculate
26+
block positions from filtered data from IR sensor and GPS. This means the
27+
effect of noise is minimised, and the target positions are relatively accurate.
28+
29+
The targeting algorithm picks the closest block of a valid class that has a
30+
clear path to it. A clear path is determined by creating a rectangle from the
31+
robot to the target and checking no other object is inside it. It will start
32+
the check from the closest potential target and continue until a valid target
33+
is found. When driving to the selected target, an active collision avoidance
34+
algorithm (with a similar working principle) diverts the robot to a different
35+
target if necessary.
36+
37+
A passive collision avoidance algorithm is used when the robot is not moving
38+
towards a block. It calculates the distance to each known object and then does
39+
a weighted sum of the current target angle and the angles to avoid each object
40+
(i.e. right angle away from it). A recursive component is added to combine
41+
small obstructions into larger ones to avoid clusters of blocks.
42+
43+
When the robot is far from the target, proportional combined with open loop
44+
control is used to achieve a velocity. When nearby, a proportional distance
45+
controller is used. A non-linear controller which uses both error and
46+
derivative are used to control the angle. The two controllers produced forward
47+
and rotational velocities respectively, which were combined to give the overall
48+
motor velocities.
1549

1650
<p align="center">
1751
<img alt="Motion" src="docs/figs/overall_flow.svg" width="250">
1852
<img alt="Scanning" src="docs/figs/scan_flow.svg" width="200">
1953
<img alt="Targeting" src="docs/figs/target_flow.svg" width="200">
2054
</p>
2155

22-
2356
## Development
2457

2558
It is useful to set up a proper development environment with the provided

0 commit comments

Comments
 (0)