jpearman's programming challenge

After 39 months of involvement with vex forum, this post will cause the odometer to trip the 3000 post mark. I generally don’t pay much attention to this sort of thing but have decided that I’ve at least earned to right to indulge my ego a little.

So to mark this occasion I’m going to hold the

“jpearman programming challenge”

Competitions sponsored by mentors have not been particularly well supported in the past. However, I’m going to throw this out on the forum and see what happens, if successful perhaps it can become an annual event.

So I challenge all of the would be programmers out in VEX land to impress me with your coolest, smartest and most interesting piece of robotics software. This is supposed to be a fun competition for the programmers, the code doesn’t have to control a robot but should at least be related to robotics.

Some suggestions to get you thinking.

Implement the dual PID control scheme I wrote about recently.
A robotic clock, motors drive the hour, minute and second hands.
Find the walls of a room and calculate the dimensions.
Driving straight (apparently this is difficult) using ultrasonic or other sensors.
An effective “rerun” program.
A scripting language to simplify creating autonomous programs.

The Rules.

  1. The challenge is open to students of all ages, middle school, high school and college. Mentors, this is not for you!

  2. The program should be related to robotics and run on the VEX cortex. It can be designed to communicate with other devices or sensors; I will deal with that situation on a case-by-case basis. Only the VEX portion of the program will constitute an entry, in other words, you can write 10000 lines of supporting arduino code but I’m not going to consider it as part of the entry.

  3. The program can be written in any of the environments supporting the C programming language. This includes ROBOTC, EasyC, PROS or ConVEX (which are both based on gcc). The program should be compatible with the current version of the environment used (ROBOTC could be 3.63 or 4.10) and should be able to be compiled without error. I’m excluding flowol because I don’t have a license, I’m excluding the online Python environment as the code is not stand alone and has some licensing issues.

  4. The program needs to contain a permissive license, either GPL, Apache, MIT or something similar. The authors should expect that code will be released on vexforum for all to see. This will be at my discretion and may include programs that do not win the contest but contain material of interest to the whole community. The authors will retain copyright of their entries. Programs that do not contain a suitable license cannot be accepted; I will post some examples nearer the entry deadline.

  5. This should be a new unique piece of software. I don’t want to see the clever code you wrote for gateway, however, we all know that many programs are built on previous work so it’s ok to incorporate library code you have written in the past and refactor it for this contest.

  6. The rules are my rules; the choice of winner is solely my decision and is final. I reserve the right to add or modify the rules as necessary just like Karthik does (just kidding).

  7. This contest is not in any way associated with VEX or the RECF.

Program evaluation

Each entry will be evaluated in several ways, I will try and give critical feedback on all of them.

a. Does the program succeeded in it’s design goal, in other words does the program work.

b. Correct and appropriate use of the C language.

c. Programming style, is the style consistent, is the code suitably formatted. Is the program commented and documented correctly. I suggest you “detab” code so as to maintain formatting.

d. Does the program implement something useful. I’m not sure that a cortex solving a Rubik’s cube is useful, but then again perhaps it is :slight_smile:

e. Is the program a significant work, there’s no minimum program size but I’m not handing out prizes for 20 line snippets of code.

f. Many other intangible areas that only I know about.

The prize.

I have a ROBOTC V4.0 perpetual TEAM license (6 seats).

I have an EasyC v4 for Cortex 10-seat license.

Winner gets to choose one of the two.

If enough entries are received I may give out other prizes.

Contest entry deadline.

Entries should be received by 9am PST September 29 2014. I’m letting this run for about 10 weeks so school can start here in the US. I will post details about how to submit entries later on.

Questions should be asked in this thread.

4 Likes

The publishing of the code makes this a very interesting challenge. Most teams do robot reveals but its rare for the little coding tricks people use to be fully revealed.

We might be seeing a few Team BNS submissions because we are all used to programming and could really use those 6 seats.

Thanks for giving all of us without parts and finished CADs something to do.

1 Like

Very nice. Are multiple entries allowed by students/teams?

Hmm, thought this may come up.

There is no limit on the number of entries per team (with the exception of the limit on individuals), each entry should come from an individual student but can be the work of several programmers. If you want to work on this as a team then list everyone as an author of the code but have one person make the submission.

I’ve decided to limit the number of entries from any one individual to three, however, you will probably gain no competitive advantage from submitting multiple entries as I would expect your programming expertise and style to be similar in all of them.

I’m hoping the competition will stimulate the programmers to come up with some interesting code but I’m looking for quality, not quantity.

I updated the prize information in post #1.

1 Like

Sounds like a good idea to motivate peoples creativity and maybe share ideas with the community. Are you going to share the projects after the challenge is over or will it be up to the people competing?

1 Like

Can’t wait to see the code from everybody. It’s always interesting to see the different styles people have in the way they write code.

1 Like

Yes I would like to share the projects.

Software is the one area that tends to be kept private. We all see the robots, we see the skill in driving and some great autonomous runs which are the result of dedicated programming. I understand the desire to keep the software within the teams, but what I have found after making hundreds of lines of code public, is that it doesn’t affect your competitive advantage much at all as almost no one can use the code verbatim.

An entry for this competition does not have to be the code for a robot, it just needs to be related to robotics and run on the cortex.

I don’t expect to be posting everything, it depends on the number and quality of the entries. Those that I do post will be explained in detail to the community.

1 Like

I like this concept. Programming is a very underrated component of VEX robotics that needs the attention it deserves. I will definitely push my students to participate, then look over these code entries to learn from them.

Delta

Could this be creating interactive methods that make programming into blocks. For example drive(FORWARD, 100) //100 Inches

Or would we have to utilize a scripting language such as lua or python to generate these routes.

My suggestions were just ideas to get you all thinking. There are several ways to simplify creating autonomous code. One way would be the creation of a library with functions as you describe, another would be the ability to parse “english” style instructions so you perhaps tell the robot to “drive forwards 50 cm”. Both of these approaches would be related to robotics and, as long as the program was primarily for the cortex, would be acceptable.

1 Like

As a mentor for several teams I believe this is a great idea. Thanks for the challenge.

To juice this up a little I will throw in $75 in cash to the person that is selected as the winner by jpearman.

This is being done for two reasons - I am a programmer myself and I believe we can produce great programmers from these types of challenges and I (and my students) have been the recipient of jpearman’s generosity over the years and I want to help out a little.

NOTE TO JPEARMAN: please PM me if this is OK. With that correspondence we can handle the exchange of the prize money for you to deal with.

Thanks for all your help in the past!

1 Like

I’m very interested in this competition and I would love to participate. In your post you mentioned “Correct and appropriate use of the C language” as an evaluation point. Does this mean that we are barred from using C++ even though it is supported by the GCC compiler in PROS and ConVEX?

You can use C++.

Awesome, thanks!


Just to elaborate on this a little.

What I’m looking for here is appropriate use of the language within the context of the code being written, some examples.

A single main function/task with 2000 lines of code.
BAD

A well structured program with code split into functional units.
GOOD

An if-then-else sequence testing the same variable 50 times.
BAD

Use of a switch statement to replace multiple if-then-else statements.
GOOD

Every variable has a small non-descriptive name, eg. a1, a2, a3.
Not so good

Variables and constants that describe their use. eg. liftMotorPower
Better

Over use of global variables.
Not so good

Functions that are thread safe
Better

I’m not going to throw code out because of these things but I want to encourage you to think about how to improve the code beyond just saying “but it works”.

1 Like

Four weeks left until the entry deadline for this competition.

Here are the details on how to submit.

  1. Source code should be archived (compressed into .zip or similar format) and emailed as an attachment to vexcode @ iCloud.com (without the spaces). If submitting an EasyC program the whole project folder should be zipped and sent. The email should contain the following information;

a) The name of the author (ie. who is submitting the entry)

b) vex forum user name

c) The VEX team number, location, and whether Middle school, High school or College.

d) A brief synopsis of the code, that is, what does the code do, what was your inspiration for writing it. Other information you feel I would need to evaluate your entry.

e) Your preferred prize if you win, that is, would you like the ROBOTC or EasyC team license.


I will try and acknowledge receipt of all entries, remember the deadline is 9am Pacific time on September 29 (a Monday morning).

Once I have all entries I will indicate an approximate date that the winner will be announced. I have no idea of how many entries to expect, it could be zero :frowning: in which case I will donate the team license to someone of my own choosing that I think deserves it. It could be 100, if this happens (and it is quite unlikely) it’s going to take me sometime to read and test everything. I will contact the winner by PM and/or email and then post in this thread shortly after.

  1. All source code should contain “boiler plate” for a permissive license in the header, this should appear in every .h or .c file. As this is more difficult to do in EasyC, I will also allow this to be in the “ReadMe.txt” file that accompanies an EasyC project.

I would suggest the license either be GPL3 or Apache, although others such as BSD and MIT are also perfectly acceptable. The difference between the licenses will determine how your code can be used in the future. GPL3 is known as a CopyLeft license, what that means in simple terms is that any derivative work must also be released as GPL3, you have released your code as free software and any works based on it must also be released as free software. Apache does not impose these limitations, derivative works can be closed source as long as the original author receives credit.

I released ConVEX mostly under GPL3, if anyone was to create firmware that used my code (even commercial software) they must release that as open source under GPL3 as well. I did allow an exception to this, you can read about that in the ConVEX source if interested. Example code and projects (including those released with ConVEX) I usually release under the Apache license, I’m allowing you to do pretty much whatever you want with that code as long as you keep my copyright notice in the source and acknowledge that I wrote the code. You also need to document any modifications you made in your version of the source, in other words, I’m not expecting credit for improvements or additions you may have made.

Below is what I put (or something similar, this was from ConVEX and has specific language) in my source code when using GPL .

You can read the official guidelines here.
How to use GNU licenses for your own software )

/*-----------------------------------------------------------------------------*/
/*                                                                             */
/*    This file is part of ConVEX.                                             */
/*                                                                             */
/*    The author is supplying this software for use with the VEX cortex        */
/*    control system. ConVEX is free software; you can redistribute it         */
/*    and/or modify it under the terms of the GNU General Public License       */
/*    as published by the Free Software Foundation; either version 3 of        */
/*    the License, or (at your option) any later version.                      */
/*                                                                             */
/*    ConVEX is distributed in the hope that it will be useful,                */
/*    but WITHOUT ANY WARRANTY; without even the implied warranty of           */
/*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            */
/*    GNU General Public License for more details.                             */
/*                                                                             */
/*    You should have received a copy of the GNU General Public License        */
/*    along with this program.  If not, see <http://www.gnu.org/licenses/>.    */
/*                                                                             */
/*    A special exception to the GPL can be applied should you wish to         */
/*    distribute a combined work that includes ConVEX, without being obliged   */
/*    to provide the source code for any proprietary components.               */
/*    See the file exception.txt for full details of how and when the          */
/*    exception can be applied.                                                */
/*                                                                             */
/*    The author can be contacted on the vex forums as jpearman                */
/*    or electronic mail using jbpearman_at_mac_dot_com                        */
/*    Mentor for team 8888 RoboLancers, Pasadena CA.                           */
/*                                                                             */
/*-----------------------------------------------------------------------------*/

and this is what I use when licensing under Apache (again, official instructions here

/*-----------------------------------------------------------------------------*/
/*                                                                             */
/*    The author is supplying this software for use with the VEX cortex        */
/*    control system. This file can be freely distributed and teams are        */
/*    authorized to freely use this program , however, it is requested that    */
/*    improvements or additions be shared with the Vex community via the vex   */
/*    forum.  Please acknowledge the work of the authors when appropriate.     */
/*    Thanks.                                                                  */
/*                                                                             */
/*    Licensed under the Apache License, Version 2.0 (the "License");          */
/*    you may not use this file except in compliance with the License.         */
/*    You may obtain a copy of the License at                                  */
/*                                                                             */
/*      http://www.apache.org/licenses/LICENSE-2.0                             */
/*                                                                             */
/*    Unless required by applicable law or agreed to in writing, software      */
/*    distributed under the License is distributed on an "AS IS" BASIS,        */
/*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/*    See the License for the specific language governing permissions and      */
/*    limitations under the License.                                           */
/*                                                                             */
/*    The author can be contacted on the vex forums as jpearman                */
/*    or electronic mail using jbpearman_at_mac_dot_com                        */
/*    Mentor for team 8888 RoboLancers, Pasadena CA.                           */
/*                                                                             */
/*-----------------------------------------------------------------------------*/

There are other permissive licenses, you can read about them here if interested.
http://en.wikipedia.org/wiki/Comparison_of_free_and_open-source_software_licenses

1 Like

14 days left to submit entries…

1 Like

Have you gotten any yet?

The response so far has certainly not exceeded expectations.

1 Like

Well your example of a clock made me as a personal challenge CAD an entire clock out of vex parts. The gearing is all included and all 3 hands spin along the same axle.
It doesn’t count for the competition but it was definitely a challenge to get it to work how I wanted it to. :slight_smile:

1 Like