Robo-Pitcher

By Frank Hu & Cole Peterson

Gazebo Simulation

Introduction

What was Created/Implemented:

Simulation Model:

Arm:

Our Simulation Model was modeled off rrbot, a basic arm made from three rectangular poles which served as arm segments, and two joints connecting these segments. Catapult

Basket Model:

Basket

Control Algorithm:

Control Problem:

​ The arm joints are revolute, effort, positional joints that have 1 degree of freedom and take in a float angle in radius as control input. When a joint receives an angle, the joint uses a PID controller to reach the received angle, which results in over-swing and redundant compensation. Such a condition is not ideal for throwing. Having an arm idling then suddenly accelerates to 50 rad per second is terrible for controlled throwing. Surely, it throws, but no-one knows where it would go.

Failed Solution:

Due to the lack of velocity control over the arm, we attempted to gather data on the robot’s current rotational speed, and use that to give new movement commands until the correct speed was obtained. However, the joint position controllers did not by default publish any information on current velocity.

Final Solution:

​ Because of this, we changed the joint type to be Velocity controllers. This is to say that we changed the programming of our joint controller to take in a velocity command in radians per second, and use the pid algorithm to reach this speed regardless of angle. Then it was a simple task to publish a desired speed and track the current angle (which was being published by default). With this vital data and control over velocity we were ready to create an algorithm for throwing a ball to an accurate distance, as was our original plan.

Math:

Objective:

Initial Goal:

Reason behind Initial goal:

Initial Implementation:

​ With this initial goal in mind, we searched online for the projectile motion equation which relates distance moved to angle and speed of the projectile. This is known as the Range Equation, and takes the following form:

\(R = (v2 * sin(2θ))/g\) In this equation, In this equation, R is the range (or total distance) of the projectile, v is velocity, and g is gravity. Using this, we simply solved for v in order to determine what speed was necessary to reach the given R with a known gravity. With the assumption of 45 degree, sin(2θ)=sin(90) comes out to equal 1.

​ However, simply calculating the velocity wasn’t the last step. This equation provided the linear velocity needed to meet our requirements, but the commands we gave our robot arm were angular. As such we had a final calculation to make, which was simply dividing the linear speed by the radius of the arm in order to determine the angular velocity it had to rotate in order to generate the correct velocity upon release at 45 degrees. At this point we had basically solved the problem, though a few trivial considerations had to be taken. The first was that our arm did not launch the ball directly at its origin. When the arm was at 45 degrees, where it stopped moving and released the ball, the end of the arm was actually about 1.2 meters behind the origin of the robo-pitching bot. As such, when calculating distance we added 1.2 to the user input to account for this constant offset.

​ With this information, we could publish commands to the robot joints to reach the appropriate launch velocity. It was then necessary to program it to stop immediately upon reaching 45 degrees so that the ball would continue uninhibited. Then, it was programmed to move back down until reaching what we referred to as a ‘loading’ position where a new ball could be placed, and new user input gathered. We chose approximately 160 degrees, since it was a convenient angle for placing the ball, and allowed enough time for the arm to reach velocity before getting to 45 degrees, however a large range of other options would be equally viable.

Labnote Contribution:

Frank:

Cole: