Log in

View Full Version : Do we have to program our robot in C++?


Alaina
24-09-2004, 14:35
Hi,

The new programmer on my team was wondering, can we switch back to visual basic or do we have to use c++?

Max Lobovsky
24-09-2004, 14:51
Let me start by giving you a bit of information. Prior to 2004, PBASIC (similar to Visual Basic) was used as the programming language. In 2004, and as far as I know, 2005, the chip will be programmed in C (someone who knows C++ knows C, but they are not the same).

If your programmer knows BASIC, C should not be a very large step. If he starts learning now (practicing with the 2004 equipment) he should be perfectly capable by 2005.

Joe Ross
24-09-2004, 14:56
Well, the robots have never been programmed in either Visual Basic or C++.

In the past, the robots were programmed in PBASIC, which is a dialect of BASIC that only runs on Basic Stamp microprocessors, which were what controlled the robot until last year.

Last year, and presumably this year, the robots are programmed in C for a Microchip PIC processor.

Even if your programmer knew Visual Basic, PBASIC is quite a bit different. C++ and C are quite a bit closer, but there is still a huge difference between programming a full computer, and an embedded control system.

You should suggest that they register on chiefdelphi because I'm sure there will be many more questions.

Alaina
24-09-2004, 17:21
Okay, thanks guys. Sorry for being so oblivious. =P

Ryan M.
24-09-2004, 17:23
No problem. "Oblivious" people asking questions are what gives us an excuse to sit around on CD. ;)

Robot Dude 0101
24-09-2004, 21:42
Im new to this FIRST stuff and I was wondering why these robots have to use these processors? We could use more powerful processors like the HandyBoard, Motorolla processors, or K-Team processors. That would make everything more challenging.

Billfred
24-09-2004, 22:20
Im new to this FIRST stuff and I was wondering why these robots have to use these processors? We could use more powerful processors like the HandyBoard, Motorolla processors, or K-Team processors. That would make everything more challenging.
That's the thing--some folks have enough fun (ahem) trying to program the robots as they are. Adding in more powerful/complex processors only makes it harder for us (and rookies, don't forget the rookies) to learn.

Now, if by that you meant being able to use any processor, then there's another issue--as it stands, FIRST teams use pretty common things (mainly since they're in the kit of parts). If 1000 different teams use 1000 different processors, then it's going to be very hard for a programmer to walk to the rookie team next door and offer help, since their setup may be completely foreign to him/her/it.

Greg McCoy
24-09-2004, 22:22
Im new to this FIRST stuff and I was wondering why these robots have to use these processors? We could use more powerful processors like the HandyBoard, Motorolla processors, or K-Team processors. That would make everything more challenging.

Programming is, for many teams, one of the aspects of making their machine they find most difficult. In recent years, FIRST has worked hard to make building a robot easier, but at the same time providing the headroom for more experienced teams to innovate. The new control system provides a pretty good balance. I think Microchip PIC Processors are used a lot in industry, so this also may be part of their choice.

(Also, if I'm not mistaken, the PIC uses a Motorola processor...)

Robot Dude 0101
25-09-2004, 11:51
That's the thing--some folks have enough fun (ahem) trying to program the robots as they are. Adding in more powerful/complex processors only makes it harder for us (and rookies, don't forget the rookies) to learn.

Now, if by that you meant being able to use any processor, then there's another issue--as it stands, FIRST teams use pretty common things (mainly since they're in the kit of parts). If 1000 different teams use 1000 different processors, then it's going to be very hard for a programmer to walk to the rookie team next door and offer help, since their setup may be completely foreign to him/her/it.

Even though it would be hard for teams to help each other, it would be an interesting idea to let teams use whatever processors they want. But this would only be useful if there was no $300 sensor limit. Since there is, I agree with you that the same processor is a good idea.

Mike Martus
26-09-2004, 09:03
FIRST will publish the "Official Rules" at the kick-off. I am sure there will be restrictions, as in the past, regarding the controller, specifically the software. There is great effort at making all teams even in many respects as well as constraining the technical issues FIRST tech support will have to deal with.

In the past you were NOT allowed to modify the OI or RC in any way other than programming. In addition, usage of additional electronics is specifically controlled each year.

I am sure the controller will not operate on any other language other than "C".

Read the "Official Rules" when they are published by FIRST.

Ask here if you need additional information. The community of Chief Delphi will respond.

Tristan Lall
26-09-2004, 11:23
I am sure the controller will not operate on any other language other than "C".It should be possible to program the RC in a different language, like PIC assembler (because it's the job of the compiler to write a .hex file, which contains generic PIC instructions, rather than C code or some other language). However, there's absolutely no support for this, and it would be a miracle if someone got a re-coded version of the firmware to actually work with itself, much less the field controllers.

suneel112
26-09-2004, 12:16
We should use Java....not! It will take forever for the virtual machine to load ("it's 45 seconds left and the robot is standing still") and for the navigation system, "Java.lang.Math is loading...." I guess C is a good alternative (even though I am terrible at C programming). Java has great uses as a dash program, though.

Dekker Avesque
29-09-2004, 21:59
C++ and C are quite a bit closer, but there is still a huge difference between programming a full computer, and an embedded control system.

You make it sound as if C++ is for programming on a PC and C is only for embedded control systems, when this is not the case. C and C++ were both originally for PC programming; C is merely the predecessor language to C++. C and C++ are nearly identical; C++ is C with object orientation. (C++ was originally described as "C++: Object Oriented C".)

I believe the C used in the Innovation FIRST chips that we run our robots with is a simplified version of the language, specifically suited for said chips.

Just making sure there is no confusion... C was not designed for operating robots, however a compiler was released for FIRST allows us to use the C language to operate robots.

Robot Dude 0101
02-10-2004, 22:03
Does anyone know of any good books that would teach you how to program C for robotics?

av11d
02-10-2004, 22:41
You make it sound as if C++ is for programming on a PC and C is only for embedded control systems, when this is not the case. C and C++ were both originally for PC programming; C is merely the predecessor language to C++. C and C++ are nearly identical; C++ is C with object orientation. (C++ was originally described as "C++: Object Oriented C".)

I believe the C used in the Innovation FIRST chips that we run our robots with is a simplified version of the language, specifically suited for said chips.

Just making sure there is no confusion... C was not designed for operating robots, however a compiler was released for FIRST allows us to use the C language to operate robots.

Almost. C with an object-oriented extension is ObjectiveC. ObjC is what NeXTStep and Mac OS X use as the default programming language. C++ is rather a completely rewritten programming language that originates from C. I still like Java :)

Anyway, if you want specific information on using C with the standard FIRST controller, check out: http://www.innovationfirst.com/FIRSTRobotics/documentation.htm

Best of Luck!

IMDWalrus
03-10-2004, 09:46
It should be possible to program the RC in a different language, like PIC assembler (because it's the job of the compiler to write a .hex file, which contains generic PIC instructions, rather than C code or some other language). However, there's absolutely no support for this, and it would be a miracle if someone got a re-coded version of the firmware to actually work with itself, much less the field controllers.
This sounds like a brilliant way to use last year's robot... :D

Wetzel
03-10-2004, 10:51
Im new to this FIRST stuff and I was wondering why these robots have to use these processors? We could use more powerful processors like the HandyBoard, Motorolla processors, or K-Team processors. That would make everything more challenging.

It would make it more challenging for some teams, but some teams would eat this up and be even crazier then they were before. :ahh:

The bigger issue I see is the headache at events for FIRST. Right now, there is the same controller/radio setup on every robot. Even with everyone using the same RC setup, teams still botch it in many creative ways. :rolleyes: FIRST knows the current setup so they can help debug it when the match was suppost to start 2 minutes ago. If teams were allowed to use any controller, they wouldn't be able to help, and I think the number of teams having comms problems would increase with a decrease in the quality of help available.


Wetzel

Testament-Doom
04-10-2004, 16:55
Is there a rule saying we can't use any type of controller? What if someone can modify an N64 controller and use that? Would that be against the rules?

Billfred
04-10-2004, 16:59
I think you've got joysticks and controllers mixed up.

Innovation First makes the control system that tells the robot to do stuff. Yes, you have to use it.

Joysticks (and anything else that connects to the operator interface, for that matter) have been functionally wide open. Go wild on that, if you prefer. And if you get an N64 controller to work with it, we want pictures. :D

(note, however, that everything is subject to change without notice or reason)

Wetzel
04-10-2004, 17:04
I think you've got joysticks and controllers mixed up.

Innovation First makes the control system that tells the robot to do stuff. Yes, you have to use it.

Joysticks (and anything else that connects to the operator interface, for that matter) are functionally wide open. Go wild on that, if you prefer. And if you get an N64 controller to work with it, we want pictures. :D

The rules are subject to change.

Wetzel

wun
04-10-2004, 19:39
Does anyone know of any good books that would teach you how to program C for robotics?
If you know C, you know C. The only differences between programming a computer with C and programming a robot are the functions you call and the libraries you include.
There are a whole load of great pages out there for learning C.
A couple good ones:
http://www.eskimo.com/~scs/cclass/
http://www.cprogramming.com/
And, of coarse, here!
If you are like me thou, and prefer a book (I actually posted a thread (http://www.chiefdelphi.com/forums/showthread.php?t=28842) about this a while ago), a very good one is "The C Programming Language" by Brian W. Kernighan and Dennis M. Ritchie. If you are totally new to programming, you may find it goes a little fast, but it is still a very good read.

Robot Dude 0101
04-10-2004, 19:47
If you know C, you know C. The only differences between programming a computer with C and programming a robot are the functions you call and the libraries you include.
There are a whole load of great pages out there for learning C.
A couple good ones:
http://www.eskimo.com/~scs/cclass/
http://www.cprogramming.com/
And, of coarse, here!
If you are like me thou, and prefer a book (I actually posted a thread (http://www.chiefdelphi.com/forums/showthread.php?t=28842) about this a while ago), a very good one is "The C Programming Language" by Brian W. Kernighan and Dennis M. Ritchie. If you are totally new to programming, you may find it goes a little fast, but it is still a very good read.
Thanks for the links, but once I skimmed over the material, I saw that I already knew it from C++.

I was just wondering what the difference was between ANSI C and C that is used for Microsoft Visual Studio?

wun
04-10-2004, 20:02
Thanks for the links, but once I skimmed over the material, I saw that I already knew it from C++.

I was just wondering what the difference was between ANSI C and C that is used for Microsoft Visual Studio?
I have been using M$ VS for a about three days now (at the place I'm doing co-op at) and it looks to be pretty similar (there are small differences like wsprintf in M$ is sprintf in ANSI). Nothing a quick bit of googling cant fix.
If you already have some background in programming you shouldn't have much of a problem with the robot. The first time I ever touched C was a week before the competition, and I had no problem with the robot.