We set out to have our robot be able to throw into a cup being moved in a repeated pattern by a separate 2D gantry.
Our robot is designed to be able to detect the target cup, using an AR tag, and determine the pattern it was making as well as the period of that pattern. The robot would then calculate the motion required to hit the cup and wait until the timing aligned to then throw the ball into the cup.
Generate periodic cup motion
Detect periodic motion of the cup using Sawyer hand camera
Throw ping pong ball into a desired point along its periodic motion
We designed our Sawyer arm implementation with two parts in mind: AR Tracking and Throwing.
Once the Sawyer sees the AR tag on the cup it would log the position and the current time until our tracking algorithm determines the pattern.
The target position and the period of the pattern are then used to calculate the initial position, joint velocities and release time. The Sawyer would then time the throw to hit the moving cup.
The 2D gantry operates with three main parts:
Patterns are generated by first receiving the desired shape from the user. The desired shape is then broken down into an array of points
G-code is generated from these points.
The onboard Arduino converts the G-code to stepper motor commands to move the cup in the desired pattern
Set release position at a vertical pose
In order simplify the throwing motion and reduce the number of parameters we needed to solve for we constrained the Sawyer to throw the ping pong ball horizontally at a vertical pose (arm pointed straight up). This constraint limits the robustness of the system and the max throwing distance since if we could solve for throwing position and velocities' in the x and z directions we could use joint 0 to increase the maximum throwing distance.
Choose to only used joints 1,3 and 5 when throwing
To simplify the throwing motion we constrained the other joints such that the throw would be linear. Joint 0 would only be used to pan the arm to point towards the cup. This decision limited our throwing distance.
We chose to prioritize maxing out the angular velocity of joint 5 then 3 then 1
When calculating the angular velocities of joints 1, 3 and 5 we would max out the angular velocity of joint 5 then increase joint 3 if more angular velocity was needed to reach the desired ball velocity. Joint 1 held the lowest priority since the higher the desired angular velocity the further back the arm needed to be initially to reach the desired velocity and have the ball release horizontally. During testing we discovered that if we prioritized joint 1 then the required initial position would hit the wall in the lab.