Robotic Arm 2: Judgement Day
For part 2 of the Robotic Arm Lab we began with building a test code that was used to make sure our end effector positions and conversions were correct. We did this by storing initial angles values [angle1,angle2] in an array, then converting from polar to cartesian coordinates, and then from cartesian back to polar in a new array [angle1Out, angle2Out]. We then compared the input angles with the output angles to make sure they were the same. We moved the end effector to a new location and trying to work backwards and try to get the needed angles for each motor based on where we wanted the arm to move. Initially there was a discrepancy between the input angle values and what the device was returning to the second time around. We discovered that the cause of this was the fact that it takes a nonzero amount of time to move the motor to a new position. This meant that certain movement commands would be cut short- the larger the change in angle (i.e. moving the arm from fully extended to fully bent) the more drastic the movement would be cut short. This was remedied by adding a sleep command at the end of our for loop that was long enough to accommodate for the length of time it takes to move from one angle to another. We knew our code was correct when the arm started out and ended in the same location.
Testing our part one code in quadrant I
For the second part of the assignment we made a few modifications to our previous code to allow it to respond to (x,y,pen) inputs rather than (theta1,theta2). Unfortunately we ran into issues getting correct output angles despite using the same equations (and code) as before. We spent a LONG TIME trying to troubleshoot this issue and were unable to resolve it. We went back and forth between challenges 1 and 2 and for some unknown reason there was a bug in challenge 2 code preventing correct conversion. Despite these errors we still finished the rest of the code such that if these bugs were solved the robot would be able to play back the positions correctly, including the pen up and down commands. Here is a video of our robot stabbing itself in the SD card slot with a dry erase marker. Enjoy!