Gyro Woes

So I’m trying to use a gyro to make a reliable, good autonomous but I can’t figure out the gyro. It’s so weird. I am using VCS, I’d like to be able to read the values and make accurate turns with the gyro because I am led to believe that it will highly increase consistency while pairing it up with encoders (I’ve heard a lot about PID loops but man that stuff is even more complicated, that’s a next year adventure). I’ve been reading abunch of past threads about the gyro and stuff and it’s all talking about jpearman and another jdude but when I tried one of their methods it completely locked up my program and nothing at all worked except static text appearing on my brain that was supposed to tell my gyro value. I understand that you’re supposed to start off by calibrating and then someone was talking about using analog units rather than rotationUnits and us rang12bit to maximize accuracy and then I kind of understand how to use it like

        while(Gyro.value(rotationUnits::deg) < 90){}

to do a 90 degree right turn hopefully.

If anyone can explain to me what I’m messing up or anything like just even pointing me in the right direction would be appreciated. Tomorrow is my last day to code and get my autonomous running in tip top shape for my last competition to qualify for state and I have a good chance with my new robot. Thank you all. :sunglasses: (emoji for the badge)

You’re looking to pass a positive threshold. Are you sure you’re turning in a positive direction?

Also, your brain screen’s text is static because you aren’t updating it in the loop that waits for completion. The screen will draw whatever you give it, then stay the same until you do other drawing commands. If you wanted something that you could just say “display this value here and keep it up to date”, that would require starting another thread. And if that sounds like Greek, take the simple route and put any telemetry updates you need to see into the loop that’s waiting for completion.

1 Like

no im not sure if im turning in a positive direction… this is my first time venturing in to the gyro so I have no clue how it works entirely. I just know it gives me readings for turning and stuff and I’m trying to figure out the rest.

Yeah I think the whole brain text thing was entirely set up wrong but yes I wasn’t updating it.

Thanks for your help in the community, I see you everywhere.

Well thanks for your help. I found the problem. Basically I’m stupid and didn’t have the sensor plugged in all the way because I thought it only went halfway deep because of the resistance. Sorry for wasting your time @John_TYler .

1 Like