How it came together
The inspiration for this project stemmed from when I had seen someone run a robot via machine learning and manual training in tandem. As someone who was curious about MATLAB as well, I was interested to see if I could capture the same results, running purely off of model data and feedback loop simulation.
Starting with SolidWorks, I was able to mock up a basic model of a 5-DOF robot arm with stretched out lever points to include a greater reach, while still utilizing a set of 6 STS3215 motors from Amazon. While I hadn't bought the motors at this step, I was able to find a rough model online where I was then able to dimension out and reverse engineer a model part to use in my assembly.
After learning how to set up an imported SolidWorks assembly into MATLAB, and wiring the power for each joint through trial and error in a bug-filled Simulink environment, I was able to run a simple demo. From here I took myself through researching MATLAB's built in inverse kinematics functions, and how to utilize them for my model. The first framework I put together gave me the bones, but it eventually led to a total of 7 different bugs: scrambled joint mapping with “phantom” joints driven from misinterpreted mates in SolidWorks, incorrect home positions, double-counted joint offsets, incorrect joint weighting, a misplaced end effector, incorrect limit setup, and a From Workspace compile issue. After spending a month learning MATLAB and researching how people handled simulation for my kind of scenario, I was able to eventually work through the issue, and get a basic inverse kinematics model running through Cartesian coordinates.
At this point, with my university starting back up in just over a month, I made the decision to invite my friend Krish Vatsa, who was already comfortable with robotics. He then handled the OpenCV work we had outlined, while I began cleaning up the MATLAB.
Once parts had arrived, knowing that when printing PLA more tolerances were needed, I printed a test part with just the fixture points, and adjusted my model to get ready to print again. After spending a day constructing, we hooked up a live server from MATLAB straight into Python, and set up our serial bus driver.
From here, Sim and Reality began to diverge. The model's numbers were inverted, so the solver was interpreting the incorrect moment arm. One jog moved the claw 30 mm where the model had predicted 13.8, off by a factor of 2.17. We instead decided to opt for a physical test at different points, measuring joint offsets with a ruler.
Hand-eye calibration never came together either. Every solve we ran put the camera 80 to 100 mm from the wrist, against the 24 mm we measured by hand. We stopped trying to trust an absolute camera-to-wrist transform and built the detection framework around relative corrections instead. That included a self updating and correcting vector-shortening model, at the reference of some literature Krish was able to find.
After weeks of trial and error with systems breaking down, motors jumping 180 degrees past limits, torque disabling, and adrenaline filled power cuts, we brought our held-out error down from the CAD model's 73.1 mm to 6 mm, which at the ground pick level left us with still a 100% success rate. Working with a 2 pose system, we were able to achieve an 80% success rate off an elevated surface, working with just 1 camera mounted to dictate height.