Senior Programmer: advice on training new recruits

Hey all,

This is Jeff Rice of team 1359, and I am currently the only programmer, but we have some new recruits who are interested. I would like some advice as how to best train them and prepare them for next season when I will be just a mentor (or maybe a metnor, nodding at snesors and sesnors). Don’t chastise me too badly if there is another thread like this as I have searched and was unable to find it.

Thanks,
Jeff

It depends on how much previous programming experience they’ve had. Do they know C already and actually used it before? Do they know any other programming languages? Depending on how much they know already, you can give them control of actually doing the writing and have them turn in all code to you for review before it becomes an ‘official’ part of the robot’s code. After you look over the code, you could tell them what could be improved, where the logic errors are, etc. You can also help to lead them in figuring out exactly what they’re going to try to do in the code.

That assumes they have at least some basic knowledge of C and general logical thinking and it also cuts you out of a lot of the programming, but it will definetly help them to learn for the future.

As Ryan said, do they know C? If they do, give them a little test to see if they’re good at it, teach them more if needed on a Windows/Linux environment. Then introduce them to programming micro controllers, its a whole new programming environment for them. Give them documents from IFI and Microchip if you can, or at least links to them. Microchips documents are a bit advanced so they’re better off with IFIs. And then its Teach, practice, teach, practice, teach, practice, teach, real run.

I put together some materials this year because our school offers no programming courses and our kids don’t have any idea how to start. It’s a set of basic concepts, and exercises. A few slides, then some things to try, and back to some slides.

I used some of our alumni’s college materials as a start, and tried to stick to only those things I thought neccessary for robotics. At the same time, from reading some of the forums, our code tends to be a bit simplier then some. We practice the K.I.S.S. principle.

If you want to see the material or want any information, let me know.

George Marchant
Team 87

Yes, absolutely. I’m leading a team of guys, one of whom has done a little C, but the others’ experience is limited to html “programming” at most. So I’m starting from scratch. I walked them through “hello, world”, and that was a big step.

On the other hand, I did all the programming last year, so I am pretty familiar with the PIC compiler, etc. I’d like to see how you approach teaching programming.

Thanks!

This is the second year we’ve attempted to teach C to some students with absolutely no programming experience so I can offer a bit of advice.

Last year we tried the textbook method and started with programming basics by giving them examples on the board of expressions, assignment, conditionals, loops, etc. We then moved on to an overview of variable types, arrays, and other fun stuff. I’m not exactly sure what we did next but it doesn’t matter since that approach was an absolute failure. The students were bored so they didn’t pay attention, and the material they learned in one class they forgot by the next. The mistake we made was we tried to give all the details and explain the theory behind everything we tought. What a disaster.

This year we tried the complete opposite. From the start we did a bunch of hand-waving over the details and told them that we’d explain it all later. We wanted to get them writing code on day one. We explained the very basics of C: you write some code in a text file, the laptop converts it to code the RC can understand, then you download it to the RC. We showed them a C file, then we broke up into small groups and tackled some pre-planned exercises. Wildstang is fortunate to have many mentors who write software for a living so we had four groups each with one mentor and two students. The exercises used two joysticks, the LEDs on the RC, and 4 servos. We tried to base them on concepts we will use when we start programming the robot in January. We started with easy exercises and increased the difficulity as we progressed: direct map of a joystick to a pwm, proportional map, direct map with a cap on the output, direct and inverse map of joystick button to LED, LED toggle when button is pressed, add to & subtract from pwm when buttons are pressed, change pwm direction when button is pressed. As the groups wrote code they would download it to the RC and test it. The groups worked the exercises as a team and the mentors explained the concepts of assignment, expressions, and contitionals as the group encountered exercises that required it. We found this method worked extremely well; the students were excited because they got to write a few lines of code and immediately test it, if a student didn’t get a concept the mentor with that group was able to spend more time explaining it until it made sense, and the students got to see how exciting programming is :).

Our goal this year is to keep the students excited and engaged. If we have to gloss over the in depth details in order to teach the basics we’ll do it. Once they get the basics and start asking questions we’ll teach them as much as they can grasp. Once they get that we’ll go deeper. I can’t ask a bunch of students who have no programming experience to write a PID loop from scratch, but I can hand-wave the theory of a PID loop and have them write a few lines that set the PWM value, then have them write a few lines that calculate the ‘P’, then a few more, and by the end they’ve written a PID loop. Then I can explain the details & the theory. Hopefully this method works.

Teaching software to complete newbies is not an easy task because it involves thinking in a way that they’re not used to. You’ll have to work one-on-one with each student to make sure they’re getting all the concepts. Don’t walk them through anything, have them do the typing. Have them write some code as soon as possible, they’ll learn it better and be more excited than if you just explained it on the board.

If you want me to upload the code we used for the exercises, just ask.

I would like anything any of you guys have or any advise because I have no programming experience really, but I am learning basic C

So far I have programmed 2 servos with someones help on here, but I still don’t know much

I am 1 of only 2 or 3 programmers on my team. Any help or advise would be greatly appreciated.

an idea that i like that has been done before with the teams I have been on is have the new students program the old robot…do not show them the old code from the previous year, but see if they can match the functionality as the previous year…have them start out with the default code and see what they can do and for the things they cannot is what you can help them understand.

doyler-

Here are the exercises we worked through with our students. Start with the 2004 default code and replace user_routines.c with the attached file. Hook up joysticks to ports 1 & 2 and servos up to pwm 1-4. To run the different labs you’ll have to change ‘labNum’ to the desired lab number.

To simplify everything for my students I created some new analog input & output variables ws_p1_y, ws_pwm01, etc that are signed integers. The range on these variables is the more intuitive -127 to 127 instead of 0 to 255. I also took care of overflow on the outputs so you can assign ws_pwm0x a value greater than 127 and it will get capped at 127.

Try to work through these exercises on your own and ask for help if you need any.

user_routines.c.txt (10.2 KB)


user_routines.c.txt (10.2 KB)

this is all i have done so far with a lot of help from someone on cd


/*******************************************************************************
* FUNCTION NAME: Process_Data_From_Master_uP
* PURPOSE:       Executes every 17ms when it gets new data from the master 
*                microprocessor.
* CALLED FROM:   main.c
* ARGUMENTS:     none
* RETURNS:       void
*******************************************************************************/
void Process_Data_From_Master_uP(void)
{
static unsigned char servo1=0;
static unsigned char servo2=0;
static unsigned char counter=0;
static unsigned char counter2=0;
Getdata(&rxdata); /* Get fresh data from the master microprocessor. */
 
Default_Routine(); /* Optional. See below. */
 
/* Add your own code here. */

 
/*BEGIN SERVO 1 IN PWM 1*/
/*
if (counter < 59)
*/
/*
(counter < n) is the time between each distinct movement of the servo. Where n/59 = the time seconds. For example, 
n= 59 is 1 second, 
n=118 is 2 seconds, 
n=30 = ½ second
*/
/*
counter++; 
else
{
counter = 0;
if (servo1 < 254)
	servo1++; // servo1 will slowly step through each of it’s positions //servo1++; will make it move slower, but it is default
*/
/*
servo1 += y) is how large a movement the servo will make each time (according to the above). For example, y=1 position and is the smallest movement the servo can make, y=5 moves 5 servo positions and because of this will appear to be 5 times as fast.
You’ll have to change the limit check “if (servo1 < 254)” to match whatever number you use, to make sure servo1 will never end up greater than 255. For instance, 
if y=5 the check should become “if (servo1 < 250)”
if y=10 the check should become “if (servo1 < 240)”
*/
/*
else
	 servo1 = 0; // servo1 will quickly reset to the zero position
}
pwm01 = servo1;
*/

/*SERVO 1 FAST*/
if (counter < 59) // About a second
	counter++;
else
{
	 counter = 0;
	 if (servo1 == 0)
	 servo1 = 255;
	 else
	 servo1 = 0;
}
pwm01 = servo1;

/*BEGIN SERVO 2 IN PWM 8*/
if (counter2 < 59)
counter2+=58; 
else
{
counter2 = 0;
if (servo2 < 254)
	servo2+=253; 
else
	 servo2 = 0;
}
pwm08 = servo2;

printf("PWM OUT 1 = %d, PWM OUT 8 = %d
",(int)pwm01, (int)pwm08); /*printf EXAMPLE (edited by me to fill my needs)*/

Putdata(&txdata); /* DO NOT CHANGE! */
}

and i understand it somewhat, but im still struggling and i do not understand yours