HELP: modeling projectile motion for a robot shooting into a goal

Given a the height of the robot (h_r), height of the goal (h_g), initial velocity of the launch (v_0), and distance between the robot and the goal (d), I need to solve for the initial angle of the launch θ such that the robot makes the goal. Here’s what I’ve come up with so far:

h_g = h_r + v_0 * sin(θ) * t – 1/2 * g * t^2

d = v_0 * cos(θ) * t, t = d / (v_0 * cos(θ))

so I plugged in the solved t from the second equation into the first to get:

(h_g – h_r) / d = tan(θ) – (g * d) / (2 * v_0^2) * sec^2(θ)

in this instance (h_g – h_r) / d and (g * d) / (2 * v_0^2) are constants so lets say that a = (h_g – h_r) / d and b = (g * d) / (2 * v_0^2) , which gives a simpler version of the equation of:

a = tan(θ) – b * sec^2(θ)

But I can’t figure out where to go from here, how to solve for θ. Please let me know if you guys have a different approach or if I’m just going about this all wrong. Any and all help is appreciated, thank you ahead of time.

submitted by /u/TheDissAbliss
[link] [comments]