Motors twitching while aiming

Hello, I am trying to setup our teams aiming with limelight, but I do not like how the motors twitch when aiming. I’ve tried to use limelight’s minimim_command from their setup examples, but no avail. Here is my build
I am trying to make it so if the value is less than a certain amount, it will just not run, but my attempt is commented out cause it didn’t work. And might as well, here is a video of the motors for a clearer description of what is happening. Audio Warning.

It looks to me like a deadband for tx would solve your problem entirely. WPILib has a class (edu.wpi.first.math.MathUtil) containing applyDeadband(). I would put everything to the right of your equals sign here as the input value for applyDeadband(). That way, your code would read something like this:

tx = applyDeadband(double what you calculate to be tx currently, double your deadband);

Let me know how it goes!

Yeah that sounds great. Never would have known that existed, thank you. Gonna be a couple more hours before I can get into the shop so I’ll test it then and post the results here.

1 Like

Finally got into the shop and experimented with that deadband function. I tried it on the tx = like you said but it still freaked out a bit. So I started adding the deadband to the different parts, such as on the m_moveValue itself and such with similar results. It did help, but looks like I will need to tune all my values a bit till it gives me the results I want. What value of the deadband would you reccommend me try? I’ve maining stuck to .05 and .1 for it.

I Also updated the github with everything so the link above should have my implementation.

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