Okay now my robot turns too much.
I got 40 in auto, but now it just turns weirdly so I can’t really get many points.
Are they really that helpful? I’ve always found them to be pretty inconsistent.
I’ve never found them to be particularly reliable in terms of getting the right turns every time. Using encoder wheels or even the integrated encoders IMO is a better method of getting precise turns.
Well you have to use it correctly in your code. In my opinein it is very great
My program still doesn’t work. I’m nervous. My tournament is tomorrow. I only got 38pts., 39, and 40 once in autonomous.
Idk man, maybe @jpearman could help.
I don’t know if this will help you (I don’t do IQ or Blocks), but at least you can try it and see if it will help.
1 – Flags
Try adding “flags” or pieces of code that print a number to the controller, brain screen, or computer if you can get it to do that. This will help you isolate the issue (by going to the section of code marked with that number) and identify patterns that lead to the dysfunction of the code.
2 – Restarting the bot
Try restarting the bot, program editor, or even your computer or device you use to program. This may help solve some problems.
3 – Hand-trace your code
Hand-tracing is a method used by programmers to execute their code without actually running the program. Basically, it is just running through your code, line by line, thinking through each step (you could even print a map and trace the path your robot will take) until you have either identified the issue or run through your code in its entirety.
Prevent issues in the future
And to prevent last-minute, night-before-comp issues in the future, I highly, highly recommend creating a GitHub account, setting up a repository for your code, and using a git gui client (such as Fork or GitKraken) to organise and save all previous versions of your code.
I hope that helps! Best of luck at your tournament!
Oh no… please… nooo
I needed to sign up for github education to use gitkraken.
IT TOOK A WHOLE MONTH
Thanks. That advice helped me. I also erased the user data program, and it helped with the program, except I had some building issues so I could only get 3 points.
Now my robot just spins in circles. I erased the user data program and redownloaded it twice, but it still just spins. It can do the drive straight commands correctly.
Now my advise is Just redo it
I just delete the code and remake it?
Ya, easist thing to do
I ran the code you sent me yesterday on a “Frankenrobot” (ie. all the non drive motors were just sitting on top and not doing anything). The code runs correctly, the robot was doing the turns as you had programmed them, so it’s hard to tell what may be wrong with yours, but here are a few suggestions to check.
- make sure everything is plugged into the correct ports.
- make sure you are not moving the robot right after you run the program, the gyro will be calibrating during the 2 seconds after you run the code (it is displaying “gyro calibrating” on the brain).
- make sure the battery is good, if there is a lot of friction in your drive, that can cause battery voltage to drop, especially if the battery is old, the voltage drop can sometimes cause the gyro to reset. If you notice the led on the brain going red when you run the code, even with a fresh battery, I would be concerned about that.
- Do you have a 1:1 gear ratio between your drive motors and the wheels ? That would affect how far the robot would drive when you ask it to drive forwards (it would not directly impact turns), that may be something to check and fix in robot configuration.
- Try a simpler program (ie. make a new program) that just focuses on the drive and turning, perhaps disconnect some of the other motors to reduce stress on the battery. Once this is working, then slowly add back in some of the arm and claw motor code. If you find this works before adding all the motors, but starts to fail when they are added, then my conclusion might be back to point 3, the gyro can be quite susceptible to battery condition and/or voltage drops.
Thanks. I just realized that the wheels can move a lot without the whole shaft moving. I’ll fix that and see if the program works.
I changed the gear ratio 10 4:3, because I didn’t know anything about gear ratios before, and now it works fine. I was able to get 39 in the tournament.
I also made the gyro sensor not part of the drivetrain, and a block at the beginning that says to calibrate for 4 seconds, and I also added a block that says set heading to 0 degrees, and now it works really well.
If you calibrate the gyro for a longer time, would it be more accurate?
If you calibrate the gyro for 8 seconds, will it be more accurate?