To move the cup, we modified a 2D gantry to produce a periodic motion unknown to the node calculating the trajectory. We created a custom part to move the AR tag and cup along the gantry axes. The modified CAD files are listed in the additional materials.
We designed and printed the cup interface specifically for the project, it's highlighted in red below.
User specifies desired pattern via custom interface on the right:
Desired pattern is converted into points and translated into G-code for the Arduino to interpret and control stepper motors. The user can scale the size of the pattern via the interface.
We used a Sawyer robotic arm from Rethink Robotics to throw the ball. The arm has 7 joints. We used the 4 joints to control the throwing motion. We used the pan angle to control the direction of the throw. We used joint 1,3,5 to stack the joint velocity to maximize the end effector velocity at the release position.
We used the cups and ping pong balls provided in the lab in our set up, we also designed and printed a mount for the cup to sit on the gantry
Our throwing Diagram above shows how we complete the motions. The main loop of the throwing node calls different functions and moves the arm in the order below:
vision_pose(limb):
This function moves the arm in a position to record the position of the AR Tag, it records the data and send it to the logger and tracking algorithm, which then compute the position to throw to, the angular velocity of each joints needed to throw the ball in the desired velocity.
load_ball(limb):
The arm move to a location for the user to put the ball into the gripper, there's also a delay to ensure nothing is in the path of motions of the arm.
reset_joint_ang(limb,pan_angle,joint_vel,release_pos,time_to_release):
This function calculates the reset position of the arm based on the max acceleration of each joints to ensure each joints has enough time to reach the target joint velocity at the release position.
delay_throw(period_start_time,period):
This function synchronizes the throwing motion to the period of the cup motion to ensure the ball reaches the target while the cup is in the right place.
throwing(limb,pan_angle,joint_vel,release_pos, time_to_release):
This function commands the joints to move to the desired velocity at the release position, open the gripper and decelerate.
To accurately track the path, the logger utilizes an AR lookup function to identify and log the AR tag's location along with timestamps in an array. With no delays between calls due to the slower pace of the AR lookup function, the array gathers 10 data points before exiting the initial loop.
We enhanced system accuracy by incorporating an offset, accounting for the differences between the AR tag's actual position and the target (the top center of the cup), as well as consistent minor throwing errors. Therefore, the logged positions represent the AR tag's location, adjusted by this offset within its frame, and then transformed back to the base frame using homogeneous coordinate transformations.
Upon accumulating enough data, the logger activates a tracking algorithm function to determine if a full period has elapsed, entering a continuous loop until this condition is met. It then records the number of samples from this period and collects an equivalent number of additional data points, effectively capturing data for an additional period.
Since the time of the AR logger doesn't have an inherent frequency, this means the time series of the cup position has random time in between each position. This would not work for the tracking algorithm, therefore we normalized the time between each point with a set sampling time. We linearly interpolated between the recorded data points at a set artificial sampling rate.
To track the motion of the cup we wrote a cross correlation inspired algorithm based on the AR tag location history. It takes the first few data points as the feature and compares the euclidian distance between feature points and all subsequences of subsequent points. The subsequence(s) with the minimum distance indicate when the motion has repeated, which we use to calculate the period of the pattern. The recorded data is then split into each instance of the pattern. The data is averaged across each instance to get a smoothed path. The period, starting time and averaged starting cup location is then returned to the projectile calculator.
Given the set joint angles we plan to release the ball at, the release position and direction can be determined as a function of the base pan angle (joint 0). The base pan angle is iteratively updated until the release direction aligns with the cup location.
The desired release velocity of the ball, based on the cup distance, is found via projectile motion. The Spatial Jacobian is calculated at the release position with the ball releasing horizontally to reduce projectile motion complexity. The joint velocities are determined from the desired release velocity. Joint 5 is prioritized, then Joint 3, then Joint 1.
To optimize the arm's throwing motion, we initially assessed the angular acceleration for each joint. This involved setting the arm in a vertical starting position and sequentially accelerating each joint to its peak angular velocity. We meticulously recorded the duration of acceleration for every joint. Utilizing these measurements, we determined the angular accelerations and estimated the time required for each joint to reach a specific velocity. The longest of these times was designated as the maximum acceleration time. We assume that the joints have constant angular acceleration. Using these parameters - the targeted angular velocity (omega), angular accelerations (alpha), individual joint acceleration times (t_accel), and the maximum acceleration time (t_max) - we wrote a formula to calculate the angular displacement needed for each joint to attain its desired velocity, up to the point where it hits its maximum angular velocity.
Our strategy for maneuvering the robotic arm involved a streamlined and efficient approach. We deliberately shifted the more intricate aspects of the operation to different components, focusing on simplifying the control mechanism. This involved precisely determining the necessary release velocities and initial positions of the arm to achieve these velocities as rapidly as the robot's capabilities permitted. The culmination of this process was the release of the ball, executed once each joint aligned within a predefined proximity to the optimal release position. This alignment, akin to the arm pointing vertically upwards, effectively imparted the ball with an initial horizontal velocity.