Week 21: Nov 7th - Nov 13th
- Neil Bishop
- Nov 13, 2022
- 2 min read
Resolving GUI Crashing:
Last week while testing the RCMS we ran into a constant issue where the GUI would crash after a certain number of movements. To find this error, I tried to transmit the received values back to the python program so that I could see that they were receiving the same values. While doing this I realized that the output of the Arduino was not consistent with what it was receiving and at points unintelligible. I realized that the same Serial.print() functions I was using to debug the Arduino were actually filling the serial buffer as well as the inputs transmitted from the GUI. After removing all Serial.print() functions in the Arduino code, the program functioned as implemented and the crashing issue was resolved.
Start and Rest Position:
When booting up the RCMS, the Arduino would automatically set all servos to 90 degrees. However, we wanted to have the RCMS start up at a resting position so that less battery power is used at start up. Also, this can be used in tandem with an automatic resting position for the servos that would be the same as the start up position. This way we can resolve any drastic movements that might waste battery power or even cause injury or damage.
To do this I created a function called startPos() which would essentially write initial values to the Arduino so that both the GUI and the RCMS are on the same page as far as the arm position.

The resting position was done using the smoothTransition() function that I created so that the arm could safely move to its resting position before closing the program.
Using the protocol method, when the program is closed a function can be called. This would call the rest function and prompt the user asking them if they would like to close the program. If yes, then the arm is smoothly put into resting position, the Bluetooth connection is closed, and the program is closed completely.

On the Arduino side, we can use the attach() function of the Servo library to set an initial position. This was implemented by setting a min and max PWM value, and a starting PWM value that corresponds to our desired angle. Since the resting position is 116 degrees for the up/down motor, this corresponds with 1800us PWM signal.


Comentários