Front End: Not my part
Backend (Python) receives requests from front end in the form of normal x,y,z of the end-effector.
It then calculates the necessary rotations and sends them to STM32 via UART.
a1,a2,a3 are calculated with inverse kinematics.
Next 2 lines are for UI so the UI can update position.
THis is what I helped out with:
Self.send (a1,a2,a3) which transmits absolute angles over UART
Port name is COM7 on the laptop
Baud Rate is 115200 bps
a1-a3 are the angle positions that need to be moved to
Speeds s1 to s3, are none because the motor uses its default set speed (from initialization)
Flips angle because parser function interprets a positive number as a clockwise rotation.
- converts angle to integer value
- Creates a command string “M1 -30 X M2 45 X M3 -120
- Port.write (command.encode) – built in python string method to convert string to bytes object using UTF-8. Serial port sends and receives raw bytes 0-255.
- Backwards compatible with ASCII with simple characters so each character maps correctly.
STM32 Code
Reads 1 byte from UART2 in interrupt mode. I dont know the length of the ASCII lines.
Configures an interrupt as soon as one byte is received and store it in rx_buffer
Once RX-not empty flag occurs and 1 Byte is met, it calls:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.