I was wondering if anyone who has experience with programming a turret could help me. Specifically, with how to calculate what to set the turret angle and hood angle. Also, do you have to take into account the magnus effect or is that negligible? Is there anything else that you need to have an accurate turreted shooter? I know that this is probably overkill, I was just curious. Any help is appreciated.

For turret angle, all youâ€™re doing is turning to some specific position, so you can set a position setpoint for your motor controller and then just tune your control. We used the SparkMaxâ€™s SmartMotion control mode, with 1 NEO550. We got the turret moving with a really small P value and a bit of feedforward. As for what to set the angle to, if you are getting the relative angle from camera data you can use that info to find your setpoint; you can also try using odometry to update that target angle as well.

If you are looking to adjust your hood angle based on camera values I would reccomend taking the simplest approach and use empirical data from different places you wish to shoot from recording what distance(could be found from Y pixel or Area) and what angle is best for that distance and then entering all of those values into excel to generate a function of best fit. That is what we have done in 2017 for shooter rpm and in 2020 for rpm and hood angle.

It depends. Weâ€™re running 2x Neos on a 1:2 upduction and the balls noticeably curve up at max RPM. Weâ€™re never running up near 10k RPM, but it does make somewhat of a difference depending on your setup.

Iâ€™m in physics. I did the kinematics math to try to calculate hood angles and such and you canâ€™t realistically replicate FRC applications like shooters when youâ€™re guessing for a few different values. Drag is most definitely not negligible and you have some insanely high speed loss depending on friction against your shooter wheel. Thereâ€™s too many variables at play.

TL;DR: Just do testing.

**Design with math; Tune emprically.**

**Design with math:** It will tell you things like â€śthe height of the goal (in pixels) will be inversely proportional to the distance, independent of the azimuth,â€ť so use that as your starting function. For things like whatâ€™s the best speed of shooter and hood angle at what range, any calculations based on incomplete knowledge will likely be suitable for the blooper reel, not the reveal video, but theyâ€™re somewhere to start.

**Tune empirically:** Even with the simple distance calculation I showed above, if you do the math using manufacturerâ€™s specs for field of view, youâ€™ll almost always be a bit off. Measure the goal height at several locations on the field to find that ratio - and also look to see if thereâ€™s some unanticipated bias you need to correct. And OBTW, you may not even want to worry about the range in your code, and just go straight from goal height to speed and hood angle.

Could you tell me where to find the kinematics as a starting point?

You can start with the fundamental equations of kinematics in physics.

Using these, you can split the ballâ€™s motion into X and Y components, using trigonometry (sin, cos) of the release angle to determine the perfectly ideal path of the ball. Note that these equations neglect any drag forces, which can have some significant effect on the output. Using these equations, you can model the motion of the ball. DM me if you have any questions!

Ok, Thank you!

If you want to model it properly with physics, then yes you would need to take drag and magnus effect into account, especially given the speeds power cells were being launched at this year. But these equations cannot be solved in a nice closed form equation, so youâ€™d still need some sort of estimation. However, as said before, you should definitely be tuning empirically. At some point thereâ€™s just too much to consider. For example, youâ€™d have to consider efficiency of your shooter - how much energy from the shooter is going into kinetic energy for the ball? Thereâ€™s no easy way to calculate that, especially if your shooter is not just a wheel. Our team also had constant force springs that would help push out the ball, and we adjusted their angle to adjust the launch angle. But thatâ€™s very nonlinear and hard to model. We ended up calculating turret angle just by offset from our vision, but for the hood angle we just measured some distances and trial-and-errorâ€™d the correct launch angle, then interpolated between those data points with a spline.

If youâ€™re interested in the physics, this thread has a lot of great information about it

Thank You!

I donâ€™t want to detail the thread too much, but could you please elaborate on that? Do you have a picture of those springs?

Sure, this picture is a bit outdated since weâ€™ve added a hood. Excuse my hardware illiteracy but the â€śthingyâ€ť holding the end of the spring closest to the shooter can now be rotated to add more compression and change the angle of release

Are you using the CF springs as a hood? If so, I would very much recommend switching to something more rigid and durable. CF springs are sharp on the edges and Iâ€™m not sure what other functions the springs have, if any other than serving as a backboard.

We have the springs as an adjustable hood, on pivoting arm. They have worked very well, and donâ€™t cut the power cells

Ah, this makes more sense. We did a constant angle shooter with variable RPM.

Here is a video of the shooter doing itâ€™s thing in slow motion so that you can see how the springs deform, this was before we added some reinforcement and tuning so it is vibrating more than I think it did on the final robot. https://photos.app.goo.gl/spXxd9CdzXLLM8ot9

And here is a video of the robot shooting

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.