Part 0: Map configuration
First of all, you need to understand the 2D space that describes a robotic arm, a goal, and obstacles.
The following example map, named 'BasicMap', would help you to understand map configuration specifications.
[BasicMap]
Window : (300, 200) # (Width, Height)
ArmBase : (150, 200) # (x-coordinate, y-coordinate)
ArmLinks : [
(100, 90, (0, 180)), # (length, initial angle, (min angle, max angle)
(50, 60, (-150, 150)),
]
Obstacles : [
(125, 70, 10), # (x-coordinate, y-coordinate, radius)
(90, 90, 10),
(165, 30, 10),
(185, 60, 10)
]
Goals : [
(150, 50, 10) # (x-coordinate, y-coordinate, radius)
]
The window size for the given example map is 300x200 pixel. The arm base is placed at (150, 200).
Note that (0, 0) is the left-top corner and (300, 200) is the right-bottom corner.
There are two arm links. The length of the first arm link is 100 and its initial angle (\(\alpha\)) is 90.
The minimum and maximum angle for this arm link is 0 and 180. The next arm link can be explained in the same manner.
Look carefully at the conventions for \(\alpha\) and \(\beta \) in the
diagram at the top of this page. Both angles are measured counter-clockwise.
\(\alpha\) is relative to the ground and
\(\beta \) is relative to the direction of link-1.
There are four obstacles, each of them is described in tuple (x-coordinate, y-coordinate, radius).
Goals can be described in the same convention. Technically, there can be more than one goal.
However, for simplicity, you can assume that there is only one goal for this MP.
The generated 2D map for above configuration is shown in following:
You can play with the above map with the following command if your geometry functions are correctly implemented:
python3 mp2.py --human --map BasicMap
Once the window pops up, you can rotate the arm using the following keys:
- z / x: increase / decrease \(\alpha\)
- a / s: increase / decrease \(\beta\)
- q / w: increase / decrease \(\gamma\) (if you have 3 arm links)