Does anyone have any guidance on using the color sensor(s) to follow a path on the VEX IQ Challenge Field? Our students are a bit stuck.
[LEFT]PID control would be the smoothest and although the coding is fairly easy, figuring out the three K constants requires a bit of time consuming trial and error.[/LEFT]
[LEFT] Full PID Control Theory: [/LEFT][LEFT]https://www.youtube.com/watch?v=0vqWyramGy8[/LEFT]
[LEFT] Full PID Control on EV3[/LEFT][LEFT]: [/LEFT][LEFT]https://www.youtube.com/watch?v=AMBWV_HGYj4[/LEFT]
[LEFT]Here’s code for a more simple, but not as smooth Line Tracking algorithm using one sensor: [/LEFT][LEFT]http://www.robotc.net/forums/viewtopic.php?t=6770&p=26191[/LEFT]
[LEFT]Using 2 sensors makes it more robust (, but still not smooth: [/LEFT][LEFT]http://www.robotc.net/forums/viewtopic.php?f=45&t=3148[/LEFT]
@jsambuca what language are you using, RobotC, Modkit, etc…?
The last two examples are in RobotC, but I didn’t create them. Since Python and C/C++ are the common languages of the robotics community (e.g. those are the only two languages that are recognized within the Robot Operating System (ROS) framework) and Python is way easier to learn than C or C++, I am gearing our students to learn Python by way of Blockly Python.
Robot Mesh has an excellent ecosystem to CAD a robot, program it in either Blockly Python or text Python and then actually test out your CAD robot in a virtual playing field before downloading the code to the physical robot. Empowers every student to have their own virtual robot to design with. And to top it off, it’s all free!
The students are currently using Modkit this year, with plans to do RobotC next year.
First, thanks for the kind words.
Second, we have a line following robot in our curriculum. It uses a simpler if-then approach to line following, but it works. I also have some PID code around here that has been tested, but I can’t say it is optimized. Go to the Robot Mesh Studio projects page (https://www.robotmesh.com/studio) and click on the “Featured” tab. Once you have the project open, you can see the Python code in the “Generated Code” tab. Once you have played with it and made it better, can I suggest that you make your project public and publish the link here?
We are currently using ModKit, but plan to use RobotC next year.
So would your code, as well as what we can find on the internet, be considered Open Source so our students would be able to incorporate into their autonomy code without having to fully understand it enough to have been able to code it from scratch themselves? As coaches, we are struggling with the balance of enabling them the functions they have personally described they wanted, but may not know how to fully program from scratch on their own without examples of actual or pseudo code.
I think anyone writing PID code is going to use an Internet sample. I know I did. It’s pretty complex stuff and I’m not sure an 11-year-old is ever going to be able to write it from scratch from first principles. To the extent that I created the code structure from an online example, it was open source to start with.
Kids certainly may have issues with the D portion of the PID, from an understanding approach, but we have had good luck explaining the P portion, having them write and execute code, then adding the I to that and explaining it as summation. Since it is very simple algebra most 6-8th graders get it if they have any familiarity with an equation like y=mx+b