Software!
Python
We decided to code our EV3 in micropython this year. Why? Because python is cool, of course.
There were other reason, too, though. Python is a real programming language used by professionals. Compared to the normal EV3 programming language, python is harder to learn the basics, but it is much easier to do complex stuff. In particular, we like python better because python:
Is cool and a good life skill
Is easier to understand the code itself
Is easier to document
Gives much better error messages
Can be saved on github
Can be more precise
Uses functions, which can be called over and over
Is easier to collect data form and to create graphs
The Code
We use EV3 micropython, version 1. We use variables, classes, functions, objects, and files and we reuse functions. We organize our code as shown in diagram, using different files:
main.py: This is where the code starts.
menu.py: This is where you can choose which launch to run
launches.py: This is each individual launch that you run
Robot.py: This holds our Robot class. This class has functions for letting us do things like turn motors, driving straight and spinning accurately with the gyro sensor, etc.
pyGame.py:The holds the output of our simulations.
Github!
All our code is on git hub! You can check it out by clicking the image at left or thought this link: https://github.com/RadioactiveRoboticsFLL/EV3Python2020
Innovations: Simulator
We wrote a simulator so we can test our code without needing a robot! This is super efficient and also helps if we are working remotely. Anyone can use our simulator - just download it from github!
Innovations: Going Straight
We use Proportional Programming. Its very helpful, and it gets the robot to go straight even if it gets bumped ot knocked. Is does this by taking the error from the gyrosensor (how far off from the desired angle the robot is) and multiplying it by the gain.
We experimented a lot to find the best gain value. A high gain is good as it corrects faster. But too high of a gain makes it over-correct, and go crazy. We chose 5 for the gain, as it works well for the power we use.
Innovations: Ramping the Speed
When we stop, the robot can jerk and go off course. This is a problem. We could try coasting, but then you don’t end at the exact position. So instead, we ramp our speed, slowing down more and more until we stop.