Go to Post Success to me is a feeling that is associated with achieving something you truly worked hard for; something that you can look at and say "That's my best work." - OneAngryDaisy [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-05-2012, 16:37
connor.worley's Avatar
connor.worley connor.worley is offline
Registered User
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Berkeley/San Diego
Posts: 601
connor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond repute
Teaching C++

Hi CD,

This year I was my team's Only Student Programmer, and it looks like things are going to be that way next year too. I want to teach some other team members C++. WPILib is nice and makes development very easy, but I think it will pose a challenge for zero experience programmers who aren't ready to jump into OOP, indirection, memory management, etc. We will be using VEX in the preseason, and the EasyC API is even easier than WPILib, so I plan on starting with C. Before I think any further, do you have any advice on teaching programming? Teaching in general? The timeframe required to really know C?

Thanks.
__________________
Team 973 (2016-???)
Team 5499 (2015-2016)
Team 254 (2014-2015)

Team 1538 (2011-2014)
2014 Driver (25W 17L 1T)
日本語でOK
Reply With Quote
  #2   Spotlight this post!  
Unread 26-05-2012, 23:11
gixxy's Avatar
gixxy gixxy is offline
Programming and Arduino Mentor
AKA: Gustave Michel III
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Ruston, LA
Posts: 207
gixxy is on a distinguished road
Re: Teaching C++

Honestly for anyone with even a little programming experience around a month-1.5months to REALLY know it. For anyone with next to nothing but a very logical mind 2-2.5 months. and Anyone else 3-6months. To know it enough to program a robot. (basiclly to just know the Libraries, how to use them, and basic syntax).

(This is based more on Java and C++ than C.)
__________________
Programmer - A creature known for converting Caffeine into Code.
Studying Computer Science @ Louisiana Tech University
Associate Consultant @ Fenway Group

2012-13: 3946 - Head of Programming, Electrical and Web
2014 - 3468 - Programming Mentor
2015 - Present - Lurker
Reply With Quote
  #3   Spotlight this post!  
Unread 29-05-2012, 03:28
ItzWarty ItzWarty is offline
Registered User
FRC #1072 (Harker Robotics)
Team Role: Leadership
 
Join Date: Jan 2012
Rookie Year: 2010
Location: California
Posts: 15
ItzWarty is an unknown quantity at this point
Re: Teaching C++

Quote:
Originally Posted by gixxy View Post
Honestly for anyone with even a little programming experience around a month-1.5months to REALLY know it. For anyone with next to nothing but a very logical mind 2-2.5 months. and Anyone else 3-6months. To know it enough to program a robot. (basiclly to just know the Libraries, how to use them, and basic syntax).

(This is based more on Java and C++ than C.)
For writing barebones teleop, that's definitely something you can do in a month or two.

In terms of really knowing C/C++, I'd consider that to be an optimistic timeframe, though this definitely depends on how much time you, the teacher, and your students are willing to commit towards the end goal of teaching whatever, what projects you'll have them go through, as well as their prior experiences.
__________________
Leader of Team 1072. Software developer of RAF Manager.
Follow me on Twitter: Twitter.com/ItzWarty/
Reply With Quote
  #4   Spotlight this post!  
Unread 29-05-2012, 12:13
aeniug2's Avatar
aeniug2 aeniug2 is offline
Registered User
AKA: Joseph
FRC #2879 ("Orange Thunder")
Team Role: Mentor
 
Join Date: Apr 2010
Rookie Year: 2010
Location: St. Louis park
Posts: 150
aeniug2 will become famous soon enoughaeniug2 will become famous soon enough
Re: Teaching C++

Quote:
Originally Posted by ItzWarty View Post
For writing barebones teleop, that's definitely something you can do in a month or two.

In terms of really knowing C/C++, I'd consider that to be an optimistic timeframe, though this definitely depends on how much time you, the teacher, and your students are willing to commit towards the end goal of teaching whatever, what projects you'll have them go through, as well as their prior experiences.

I can attest to this. I started learning C++ at the beginning of this year in order to program the robot, due to the lack of any other programmers. I have had experience with various languages throughout my life, but never really stuck with one.

I quickly learned enough to program our drive train and all, and I feel confident that I have the ability to program most anything my team could need. But I still find myself frustrated by the fact that I don't really KNOW C++. I use C++ to control the robot, but I don't fully understand how C++ works, and would likely find myself unable to write any kind of non-robot program without the assistance of google.
__________________
Reply With Quote
  #5   Spotlight this post!  
Unread 29-05-2012, 17:55
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 669
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Teaching C++

From year to year, our team always have this problem. If we are lucky, we will have one or two students who already have some backgrounds on programming. Depending on when they join the team, we are luck if we have 2 to 3 years of their service. Then they graduate. Ideally, while they are in service, we would train less experience programming students to take over after they graduate. In reality, this doesn't always work out. Our school is a very small school with only a few hundred students. We are lucky if the FRC team has over 20 members. This year we have 18 and only a handful are interested in programming. A lot of them have very little or no background on programming. Even if we train some of them, some students may decide to quit robotics after a year or so. In order to make this work, we need a way to rapidly train students. A few years ago, their robot code was monolithic. Everything was written from scratch year after year. The code was hard to understand so it is hard to learn from reading it. One of the ways we use in recent years is to preserve knowledge continuity by developing a robotics library. This library is written as generic as possible so that it can re-used year after year. For less experience programmers, they would learn how to use this library. Reading past code that used this library is a simple way to start. It is a lot faster on-boarding than teaching them how to write the entire code from scratch. For more advanced programmers, they will learn the internals of the library and may even contribute to debugging, maintaining and extending the library year after year. This past summer, we even built a smaller form factor practice bot. It is basically a 24" x 24" running base. Small enough for students to take it home if they need to gain some experience in coding and debugging for it. All of these are more focused on teaching robotics programming, not necessarily just teaching C++. For teaching C++, we supplement it by recommending students to learn the basic language from some internet sites. It is generally difficult to teach a bunch of students who have different levels of programming skill. When you teach something too basic, intermediate or advanced programmers will lose focus. When you teach something more advanced, you will lose the beginners. So each individual student must bring themselves to a more uniform level. We usually start with doing an introduction to the C/C++ language session for really beginners. Then point them to some internet sites for more detail information. Then we start to teach how to program the robot using the library, showing code from past years and explaining the design and structure of the code. Then for whoever are interested and can handle it, we will talk about more advanced topics and how each library module works. In between all these, the small form factor robot is available for demoing concepts and hands-on experiments.
__________________

Last edited by mikets : 29-05-2012 at 18:08.
Reply With Quote
  #6   Spotlight this post!  
Unread 29-05-2012, 18:27
Alexa Stott's Avatar
Alexa Stott Alexa Stott is offline
All I do is twin.
AKA: elixir
FRC #0025 (Raider Robotix)
Team Role: College Student
 
Join Date: Oct 2005
Rookie Year: 2006
Location: No. Bruns., NJ/College Park, MD
Posts: 781
Alexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond repute
Send a message via AIM to Alexa Stott
Re: Teaching C++

It depends how in-depth you really want to get. We don't go too much into detail with our students because it's not really necessary to just get the robot running. This is more or less what we cover with our students:
  • What an integer is
  • What an object is
  • How to declare, set/initialize, etc. both of the above
  • if/else statements
  • What functions/methods are
  • How to declare/write, call, use, etc. a function or method
  • An overview of what WPILib is and how to use it (i.e. how to figure out what functions you can/should call with the different objects)
  • Some of the most commonly used classes, like Victor, Joystick, Solenoid etc.
  • How to declare a pointer and how it changes how to call its functions (using the -> instead of .), though we don't really go into what the difference is unless someone really wants to know
  • How to read inputs from sensors (analog and digital from both the DS and the robot itself) and use those values
  • Where to put the different parts of the code (i.e. what should go in our Shooter class vs. our DriveBase class and where to put autonomous stuff vs. teleop stuff)

This year, we ran two Saturday workshops for 25 and 103 to go over programming stuff. The first session was for programming basics, so just how to write simple code in general. The second session focused on WPILib and how we use it to write code for the robot.

To help drive it all home, we work with the students have them rewrite the code for the previous robot. In our case, we had each student assigned to a different system on the robot, so one student was responsible for getting drives and brakes to work while another did the pneumatic things. They'll ask us questions and we lead them in the right direction (like "Remember when we talked about the Joystick class and the different functions it has? Try looking for something to help you in there.") but we won't do any of the work for them.
__________________
|Email:alexastott[at]gmail.com|Facebook|@zelixir|Google+|
[University of Maryland Computer Science, Psychology]
[Brunswick Eruption]
Reply With Quote
  #7   Spotlight this post!  
Unread 29-05-2012, 18:35
aeniug2's Avatar
aeniug2 aeniug2 is offline
Registered User
AKA: Joseph
FRC #2879 ("Orange Thunder")
Team Role: Mentor
 
Join Date: Apr 2010
Rookie Year: 2010
Location: St. Louis park
Posts: 150
aeniug2 will become famous soon enoughaeniug2 will become famous soon enough
Re: Teaching C++

I find that a constant roadblock in my learning C++ on my own is the IDE...
I have numerous books on C++, and have looked over several comprehensive online tutorials. The problem is that I always have trouble with the IDE, either it wont stay installed, I can't figure it out, it doesn't work well; and in the end I always forget anything I had learned.

This year I will be trying to teach younger members about programming at the same time as teaching them some basics about electronics.

We will be using arduinos, and doing activities with them that involve controlling motors and reading / interpreting sensor data. I feel that attaching the programming knowledge to a small scale physical demonstration might help them remember it better. Now, the arduino's programming language isn't exactly C++, but it is similar enough that they can go on from the arduino activity and start reading over our 2012 robot code, while me and the other existing programmer help them relate things in it to the concepts they learned on the arduinos. We will then re-write the robot code (almost) from scratch, having them offer suggestions for improvement. This should give them a decent understanding of the structure/organization of code for FRC robots, as well as a basic understanding of how various physical electronic components that will be controlled by the code will work, such as jaguars, victors, servos, gyroscopes, ultrasonic rangefinders, etc.
__________________
Reply With Quote
  #8   Spotlight this post!  
Unread 31-05-2012, 01:16
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: Teaching C++

Quote:
Originally Posted by aeniug2 View Post
Now, the arduino's programming language isn't exactly C++
yes, it is. It's compiled with gcc. Do you mean programming an arduino uses a different library than programming a cRIO?

I agree with you about the IDE -- I don't like IDEs at all. I prefer to use vim and make. Learning a different IDE every few months just isn't appealing to me.
Reply With Quote
  #9   Spotlight this post!  
Unread 31-05-2012, 18:12
aeniug2's Avatar
aeniug2 aeniug2 is offline
Registered User
AKA: Joseph
FRC #2879 ("Orange Thunder")
Team Role: Mentor
 
Join Date: Apr 2010
Rookie Year: 2010
Location: St. Louis park
Posts: 150
aeniug2 will become famous soon enoughaeniug2 will become famous soon enough
Re: Teaching C++

Quote:
Originally Posted by WizenedEE View Post
yes, it is. It's compiled with gcc. Do you mean programming an arduino uses a different library than programming a cRIO?
Ohh... Derp. I just remember reading that the arduino language was something "based on Wiring", but digging a tad deeper I see where it says that it's implemented in C/C++. I suppose this just further proves that I don't really 'know' C++, I just dabble in so many languages that I retain enough knowledge to learn any language very quickly, but usually only for a specific purpose / project.

I didn't mean to say that it uses a different library (well, at least I think I didn't) but I suppose it does. But I think it should still be useful in teaching some of the basics of programming the robot, at least in terms of how sensors and other hardware can be interacted with through programming.
__________________
Reply With Quote
  #10   Spotlight this post!  
Unread 31-05-2012, 21:29
mega900997's Avatar
mega900997 mega900997 is offline
Registered User
FRC #0263 (Sachem Aftershock)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2008
Location: Ronkonkoma
Posts: 58
mega900997 is on a distinguished road
Re: Teaching C++

We teach C++ by giving members websites and software like Visual studio. We encourage being able to learn things on your own and offer help and explanations whenever needed. So far, our programming team is the captain, the apprentice, and a past member of the team who helps us substantially. I'm hoping to get a couple more people in the programming department. The school also has a C++ class and any member of the team is welcome to take it. We don't discourage anyone from learning programming.
__________________
2015
Suffield Shakedown Winners & Most Points Scored
South Florida Regional 6th Seed, #5 Alliance Captains, Regional Winners w/ 2383 & 386, Innovation in Control Award
NY Tech Valley Regional 5th Seed, QF, Excellence in Engineering Award
SBPLI Long Island Regional 4th Seed, Finalists

Hopper Division 14th Seed, QF
Reply With Quote
  #11   Spotlight this post!  
Unread 08-06-2012, 23:51
kwojcik kwojcik is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Sep 2008
Rookie Year: 2009
Location: California
Posts: 24
kwojcik is a splendid one to beholdkwojcik is a splendid one to beholdkwojcik is a splendid one to beholdkwojcik is a splendid one to beholdkwojcik is a splendid one to beholdkwojcik is a splendid one to behold
Re: Teaching C++

C/C++ can be used to do some very very complex things, mastering them can take many years. There are a lot of things that you don't even realize you don't know until you understand compilers and language runtimes and processor/memory/bus/etc architecture. Every time I work on a project I learn something new about C (usually pointers and memory layout and optimization).

That being said, you really don't need to know all that much to program a FRC robot to do some basic stuff. You don't really even need to know much of C++, just the C-style syntax and pointers. This list is a great start. Once you have the syntax and variable basics down, I would say spend time understanding object oriented programming and how you can combine WPIlib classes with your own custom code to make very powerful classes. Also, you MUST understand the difference between when things are on the stack and when they are on the heap.
Quote:
Originally Posted by Alexa Stott View Post
It depends how in-depth you really
  • What an integer is
  • What an object is
  • How to declare, set/initialize, etc. both of the above
  • if/else statements
  • What functions/methods are
  • How to declare/write, call, use, etc. a function or method
  • An overview of what WPILib is and how to use it (i.e. how to figure out what functions you can/should call with the different objects)
  • Some of the most commonly used classes, like Victor, Joystick, Solenoid etc.
  • How to declare a pointer and how it changes how to call its functions (using the -> instead of .), though we don't really go into what the difference is unless someone really wants to know
  • How to read inputs from sensors (analog and digital from both the DS and the robot itself) and use those values
  • Where to put the different parts of the code (i.e. what should go in our Shooter class vs. our DriveBase class and where to put autonomous stuff vs. teleop stuff)
Most importantly, program a robot. Get a minimal set of code, say your robot.cpp that extends IterativeRobot. Write the few lines of code to get a tank drive going. Then get arcade drive. Make some buttons trigger solenoids (no fancy state machines yet). Hook up a potentiometer and code up an Analog channel and do a printf of the getVoltage and getValue() * 5/1024 (notice they are different! very important). Then hookup an encoder and print those values. Being able to use sensors and drive a tank drive in a few hours work (for a beginner) is so rewarding!

Start programming things ASAP. After mentoring for years, its amazing how much you think you taught someone via lecture-style learning and then you see them fail miserably in doing the most basic task. Most importantly, don't let someone struggle with something syntactic or basic forever, it is very demoralizing and you are wasting both of your time. Help them out and they will understand.
Reply With Quote
  #12   Spotlight this post!  
Unread 11-06-2012, 15:03
DavisC DavisC is offline
Registered User
FRC #0539 (Titans)
Team Role: College Student
 
Join Date: Jul 2011
Rookie Year: 2010
Location: Virginia
Posts: 200
DavisC is just really niceDavisC is just really niceDavisC is just really niceDavisC is just really nice
Re: Teaching C++

I learned the programming for the robot by starting on labview (3 yrs ago, 8th grade) and then took the school's programming class (2 yrs ago and has basically only seniors) and then explored plenty more on my own.

The school's class (taught by the AP Calc teacher who know a tad of programming) starts using Microsoft Studios like 2006 or something (C++). Then the second half of the semester class, he gets students doing some projects with Just BASIC which uses BASIC instead of C++.

Now this past year I have become quite profficient with programming and I needed to teach someone else. One of the things I've started was Video tutorials cause our mentor (AP Physics teacher) had started doing that and really likes it. But the person I was teaching had never done programming before and I didn't have time to go through the whole Microsoft Studios 2006 thing. So instead I took him straight into Just BASIC to teach him the ideas of integers and mathematical operation and for loops and while loops. Then took him to the WindRiver compiler to relate it to the robotics code.

Now that I have done more projects with the Arduino, I might start with that instead but I'm not sure. Also I helped teach a few sessions of the C++ programming class and got them to work on a project to try and make the robot autonomously go around the room without sensors.. Almost made it, but we did make enough dents in the walls.

BTW that robot was ~1 ft wide by 2 ft and the frame consisted of a sheet plastic cutting board. It was a double decker and had banebot motors for the drive.
__________________
FRC Team 539
Student Member: 2010 Breakaway - 2014 Aerial Assist
Mentor: 2015 Recycle Rush - present
Reply With Quote
  #13   Spotlight this post!  
Unread 13-06-2012, 19:14
mjcoss mjcoss is offline
Registered User
FRC #0303
 
Join Date: Jan 2009
Location: Bridgewater,NJ
Posts: 70
mjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the rough
Re: Teaching C++

I take a slightly different approach. I run a class on C programming before build season starts. I start out by just teaching the language semantics and syntax. Then I work on logic, flow control, how to break down a problem into smaller steps, etc. I feel that it is more important for students to learn how to program than the specific language. C has a fairly simple syntax.

As people have mentioned you're filling in a framework, which is basically C syntax within a C++ function.

As we get closer to the start of build season, I walk students through the framework - we use the IterativeRobot class, and show how to use the various sensors, and other objects required to get the robot up and running. As they become more familiar with the various constructs, we talk about processes, memory management, timing, PID control loops, etc. but only with the students that show real interest. Some times it's only one or two students. This year we had two freshmen that really did a great job, and a hand full of others students who mostly watched them work.
Reply With Quote
  #14   Spotlight this post!  
Unread 20-06-2012, 17:59
aeniug2's Avatar
aeniug2 aeniug2 is offline
Registered User
AKA: Joseph
FRC #2879 ("Orange Thunder")
Team Role: Mentor
 
Join Date: Apr 2010
Rookie Year: 2010
Location: St. Louis park
Posts: 150
aeniug2 will become famous soon enoughaeniug2 will become famous soon enough
Re: Teaching C++

Quote:
Originally Posted by mjcoss View Post
As they become more familiar with the various constructs, we talk about processes, memory management, timing, PID control loops, etc.
Now there's where I get hung up. I really don't have a very good understanding of any of the real technical aspects of the language, but I still have to teach the language to new team members. I suppose I could try to learn these things from online tutorials and the like, but I feel like they are the kind of thing that's better to learn by being taught...

While I'm typing, I might as well ask. Can you recommend any online tutorials that do a good job of explaining the parts of the language that go beyond syntax? (which, at this point, is the only thing that I really know well).
__________________
Reply With Quote
  #15   Spotlight this post!  
Unread 20-06-2012, 20:34
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: Teaching C++

Quote:
Originally Posted by aeniug2 View Post
Now there's where I get hung up. I really don't have a very good understanding of any of the real technical aspects of the language, but I still have to teach the language to new team members. I suppose I could try to learn these things from online tutorials and the like, but I feel like they are the kind of thing that's better to learn by being taught...

While I'm typing, I might as well ask. Can you recommend any online tutorials that do a good job of explaining the parts of the language that go beyond syntax? (which, at this point, is the only thing that I really know well).
I enjoy reading these books:

http://mindview.net/Books/TICPP/ThinkingInCPP2e.html

They're free online but you can buy hard copies also. They're pretty old but understanding the first book will give you a deep understanding of C++. The second one talks mostly about the STL so isn't really relevant to FRC.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 14:18.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi