Once Poolbot receives the ball's coordinates in its own frame of reference, it will then proceed through two steps of the motion planning process. In the first stage, Moveit! will compute a trajectory of the robot's end effector to the ball's coordinates using inverse kinematics. Before this calculation, an offset equal to the length of the poolstick in the direction opposite to the intended direction of striking the ball is added to the ball's pose transform. This is to allow the poolstick to have it end point end at a ball's position so its ready to hit the ball.Â
In the second stage, Poolbot will need to plan a linear trajectory from the end effect's position from the previous stage to the balls position. The key aspect here is that this linear trajectory must be straight and powerful in order to accurately simulate hitting a cue ball with a cue stick as a player would. To accomplish this, our team used the Jacobian pseudo inverse from the Python API reference of the Kinematics and Dynamics Library (PyKDL) to precisely compute body velocities of our end effect at each time step of its trajectory. Our team also leveraged PID controller's to minimize error in this stage. After the end effector hits the ball, the system repeats the process by opening the G.U.I. once more for the next shot.