Starting programming...

Over the past couple of years, I have really been interested in getting started with programming, but I was usually too busy with some other extracurricular activities or school. Then, this year, I joined my school’s FRC team, and I am really into robotics. This year, I was in charge of the layout and execution of the wiring on the robot. Next year, I want to help program.

With this goal in mind, I was wondering: what do you think would be the best way to get started into programming in general? I have had minor, minor experienced with C++* and a little bit more with LabVIEW** (which is what we use). However, I really want to take part of this summer to really get my fingers into programming, with the intent of being a help on the programming side to the team next year.

I don’t really know where to start. I’ve looked through some of the official FRC documentation on LabVIEW, and that’s about it. I’m sure you guys get asked this question a lot, so what should I do to start out?

*Wrote a program to randomly generate an integer using randl;, then user guesses the number and the program outputs how close you are (within 5, 10, 20, or outside 20).

**Wrote same program as above except using LEDs and indicators in LabVIEW, plus I hung out with our main programmer as much as possible so I picked up a couple of things.

I have a suggestion, go learn C++ from books, thats how I did it, and I ended up fine. May be they don’t teach you how to program, but they teach you the basics. You just need to practice, practice programming text based games or something. Robots are different, I had trouble in the beginning with robots, since its different mindset, but just learn to program. Programming is how you think, not code on the computer screen. If you understand what I mean. The syntax is not the programming part, but the logic.

That’s what I’ve heard a lot from our main programmer - it’s about the logic behind it. My impression from using LabVIEW is that it is more about the logic then the syntax, while CLI languages you have to focus more on the syntax and the logic is more hidden. I’ve been looking at a couple of C++ books at my local library - that was what I thought I’d start out with first. Then, I’d like to mess around with a fun little cRIO control-system bot the team is building to really get the logic.

Along with what davidthefat said, maybe your coach/mentor will give you a copy of LabView so you can play with that at home. Thinking like a programer might be the hardest part. I picked up on LabView, and other languages, very easily because I already thought like a programer, I just didn’t know it. Have your programer show you some code and explain what it does and soon after you understand how that works try to decode some code without having the programer explain it. I worked with one of you programers at Kettering when we had issues with our watchdog, he knew a lot about LabView and he would be a good person to talk to. How did he pick up LabView?

Luckily, I managed to grab a copy of LabVIEW for my laptop at home. You probably talked to another one of our programmers, who knew C++ and Java already if I remember correctly, so he just spent the '09 season messing around with LabVIEW and picking it up.

I’ll definitely try trying to figure out code, probably from the examples included with LabVIEW (I can’t have access to the competition code we used right away).

The real thing I want to do is learn more about “real” programming - CLI - than transition over to LabVIEW. I also have a question: Would it be better to learn C first, or C++? C is a good basic language, I hear, but C++ is more commonly used.

I’d recommend against learning C++ as your first language. You should start with Java as you will encounter much fewer headaches and debugging code is a lot easier.

Eh, C is more for Robots since more robots are programmed in C, but I will have to say the mind set is different. C is procedural and C++ is object oriented. I started with C++ like I previously mentioned, its just C with more (hence the ++) so if you learn C++, you basically learn C plus more, but not really, the mind set is different. But surprisingly, when I first started, I started programming procedurally more than object oriented. Eh IDK you might want to start with C++.

edit: LOL at what Chris said, thats why I have an F in my AP Computer Class, it was so easy that I just slacked off… BAD IDEA… well good thing there is a project thats 70% of my grade, and its about the autonomous robot challenge

I learned VB a long time ago. Thats why I didn’t do any software stuff for a few years afterwards.

Then I learned C++ basics, like functions, variables, and cout/cin.

Then I joined my middle school’s FLL team my 8th grade year. I quickly learned Mindstorms and actually hit the maximum potential of the language (that is not hard to do in Mindstorms). It was fun, and prepared me to think like a programmer more then I did previously. Freshman year on the Killer Bees, I learned LabVIEW, and although my code actually looked like spaghetti and had many issues, and was poorly organized, it worked. I wrote the crab steering code on our 09 robot, and it was later integrated into the rest of the code written by Jim (and probably re-written, I don’t actually know what the final code looked like).

This year I made a much larger effort to organize my code, I wrote some software in the off-season to simulate arms and crab steering, and was the software lead (well, the only programmer).

Being a fairly high-level programmer, I was more interested in the algorithms, logic, and design of the code then the implementation. I am still good at writing it, but spend some time before writing it on organization and partitioning modules. I actually never used C for anything useful until 2009 OCCRA, on the VEX processor in Microchip C. And I learned a lot more then I want to know about pointers on that little VEX processor.

It depends on if you prefer higher level or lower level programming. If you already think like a programmer and focus on the logic, not the implementation, then LabVIEW is probably for you. If you prefer writing syntax and debugging lines of code, then C++ is probably best (better start with C-like code that dosen’t use pointers or classes first, then work up to classes/namespaces and pointers).

Dang it, I need to read up on namespaces more, I think I am missing out on some cool stuff… ::rtm::

Perhaps a year ago, someone mentioned the Project Euler site. This is similar to how I learned to program. Pick a language and take a crack at a few problems. Once you have your bearings, may I suggest trying one of the other languages, and perhaps even the third. Given a problem to apply your programming to, try out different tools – video tutorials, written tutorials, examples, reference books, etc.

If math isn’t your thing, obviously there are other good ways to learn how to program, but coming to grips with what is commonly referred to as scientific programming, or numerical programming is, I think, similar to much of what you’ll see on the robot. Of course the robot will introduce you to many other concepts as well, but if you are good at the numerical stuff, I think you’ll find the rest easy to pick up.

Greg McKaskle

Emphasis should be put on “not really.” C++ is not just C with classes. They are completely different beasts.

To be honest, I don’t really know what is high level vs. low level programming. And, what I’d like to do, is be able to do CLI languages like C++ or Java in my free time, and then be able to switch over to LabVIEW for robotics. I think I’m going to just go with learning C++ out of a book while experimenting with LabVIEW at the robotics team meetings, and then move on to different languages.

I’d recommend against learning C++ as your first language. You should start with Java as you will encounter much fewer headaches and debugging code is a lot easier.

The thing is that I already know some C++ - std::cin and cout and if-then statements, and I feel I already have a grasp of the language. Then, maybe I’ll move onto C and Java.

Which is easily less than 1% of what there is to know about C++. Besides most of what you know now will transfer over to Java as C,C++, and Java share similar syntax. I’m just telling you from experience that C++ can quickly become a world of hurt.

To be honest with you, I never really understood the “::” until like a year ago:eek:

Last year is when I started programing. I had never done any programing before that and our entire robot was programed by me last year. I learned Visual Basic at school and LabView at robotics that was as much knowledge I knew about programing. I would take all my robotics work home with me. That is how I learned. I think I learned as being a last resort but in the end found out I enjoyed it. So, I don’t think it matter what language you learn first as long as you learn the basics of programing. I would suggest learning more about C++ if you feel you have a little knowledge about that. It may lead you into LabView.

This sounds like a great site. Thanks a lot! It seems like a lot of the programming on the robot is numerical-related, I can see that could help me a lot.

I don’t understand what you mean by that.

Here is what I don’t get, once you learn C++ why would you want to move to LabView? :confused: Makes 0% sense to me… Its like getting a Lambo then trading it for a Civic in my view… If you understand, why restrict yourself while you have almost full control with C++ then putting on training wheels?

I’m saying you won’t have a head start in learning C++ over Java given that you know how to use if statements.

If that is what the team uses then I would learn it. Would you rather have a group of guys that can program in LabView or have one guy that can program in C++. I also don’t see why C++ is any more powerful than LabView. I have written code more advanced than what one of our mentors did in C++ with LabView. I will say LabView is a little…silly? but I do the like how easy it is to debug and get live feedback. My question is why not learn both?

OK, well, thanks. However, I find that C++ is more widely used and would be more worthwhile. However, a “world of hurt” sounds like a good problem to solve!

Yep, that’s what I’m thinking.