In the design document we have defined five functions that have to be performed.
We already decided to not implement the tool switch. This also means that the wiper is probably not something that is going to be achieved either. We will split these function into software requirements.
The marker is specifically moved by the SCARA. The SCARA itself is attached to the carriage. This carriage is then moved in function 5.
Therefore the following things are required:
The servo will lift the marker. For this the servo needs a PWM signal. This is purely feedforward.
For this the software has to move the steppermotors such that the carriage moves. Similar to the move marker on board.
The motors are powered themself with stepper controllers. The controllers have a direction pin and a step pin.
For that I will build a struct in the code with the following assets:
For the pathing instruction we need to be able to read the next path instructions. For this we need to be able to store a list with points. For path instructions it might be useful to look in to wtk Maybe I can just work with characters and a path for each. The system must be able to plan positions. Where to write stuff and if the carriage should be moved or only the SCARA.
A point struct is needed. This struct contains two integers. We need some point calculations. Add, subtract, distance, angle etc. Probably just use ccVector or gb_math.h
We need to be able to calculate the angles from the position of the motor. This is done with the cosine-law. Also required for the carriage.
We need to be able to calculate the positions from the angles of the motor. Also required for the carriage.
The main function has to start everything off course. It will call the initialisation functions of everything.
Before the actual writing, we need to know where my steppers are. As they do not have a complete reference. The is done by sensors. Some sensor will detect the arm in a certain position. Then we know the actual angle, and can set the actual angle position.
The sensors need to be read and return a boolean. Currently they are planned to be some light gates, with an analog output.
Struct