Log in

View Full Version : What language do you use?


1strobotixrox
28-11-2006, 15:05
Hey, my team is new, so i was just wondering what programming language you guys use. I've heard of C, C++, EasyC, and Java. Which is best? Personally I know a little Java, but I haven't really heard good things about it on the forums.
-Thanks

Stuart
28-11-2006, 15:24
well depends on what Im doing . . robot coding I use C,
I/O programing on my PC I use C++,
any thing that I want to look "pretty" I use Java,
and I use ruby when I just want it done.

Donut
28-11-2006, 15:24
C and EasyC are the two that FIRST provides teams with, and that there is default code written for (I think there's default code for EasyC...).

I thought C was relatively easy to learn, and for what you're doing on the robots it can be done without getting horridly complicated (it can get complicated, but you can do all the basic things and alot of advanced ones without it being too hard).

If anyone ever got courageous they could program in assembly too, but I don't imagine that being all that enjoyable.

theycallhimtom
28-11-2006, 15:39
For robotics I use C.
For school I use Java.
For most other projects I use Python.

neilsonster
28-11-2006, 15:46
EasyC is great for beginners, as it is easy to understand and it shows you the code it generates as you go (so hopefully the programmer will learn along the way).

C is a very good language to use for the types of applications seen in FRC. Compared to C++ and Java, it is a very "light" language which still has all of the functionality you will need to program your robot. This is important since the IFI Robot Controller that you get with the kit of parts doesn't have too much processing power or memory in comparison to your personal computer. As far as I know, C is the standard in embedded-level programming.

As far as C++ and Java go, you will get lots of different opinions. I personally prefer C++ because there are lots of things you can't do in Java that you can get away with in C++. The downside is that it's easy to write code that breaks! I use C++ for both school and my own projects.

Java, on the other hand, sort of forces you to be a better software developer by taking care of memory management and providing plenty of built-in libraries to use. Java is also not dependent on any specific operating system, so a lot of companies use it to make their software more versatile. So far I have really only used Java for school, but at my next co-op job I'll be doing software development using Java.

fowlerm
28-11-2006, 16:37
Robot Development - C18 and ASM (to speed up interrupt handlers)
Desktop/Server Development - C# and .NET 2 or VC++ 8
Mobile Development - C# and .NET Compact Framework

EHaskins
28-11-2006, 16:52
Robot Development - C18 and ASM (to speed up interrupt handlers)
Desktop/Server Development - C# and .NET 2 or VC++ 8
Mobile Development - C# and .NET Compact Framework

Sounds like me. :D

Except ASP.net 2 for web development.

chris31
28-11-2006, 16:59
C for robotics
Java for school
Whatever i feel like messing with for all other projects

GRaduns340
28-11-2006, 17:49
Although I'm not programmer for our team, we use C for the robot.
I use Java for school and some other projects.
PHP and MySQL for most of what I do (web development)

Alexa Stott
28-11-2006, 17:56
C - robotics
Java - school
C++ and/or Java - other stuff

Pat Fairbank
28-11-2006, 18:21
I use:

For robots - C
For school - C++
For work - PHP, Delphi
For OS development - ASM

Jimmy Cao
28-11-2006, 19:40
Here's what i use various languages with.

C = robotics. It's hardly ever used anywhere else.
C++ = for fun. Since my school dosen't have a programming class, i dont use it at school. I just use it to make random stuff at home.
Java = website programming, usually. Java is often used online.

There are also various other languages out there. Many can do the same thing. As far as robotics is concerned, knowing C is enough.

Ryan M.
29-11-2006, 06:37
C++ and C# are my two main languages.

Joel J
29-11-2006, 06:46
I use C for FIRST. I don't like EasyC.

PHP -- web
C++

There are a few others, but they aren't used frequently enough.

et1337
29-11-2006, 07:45
C for FIRST
C# for fun
Did some C++ and Java once upon a time.

I think C# is basically Java, but not broken. And with no crossplatform support. And some cool features. :cool:

Beth Sweet
29-11-2006, 10:23
English and Spanish ;)

Seriously, we have found that the Easy C is fantastic. We were a team without a programming mentor last year and one of our students was able to take this software, play and troubleshoot it a little bit and came up with great code and multiple autonomous modes. The Easy C is a great resource for teams who may be a bit short on the programming knowledge

Eric W. Jones
29-11-2006, 10:31
I really only ever code in C for FIRST, since it's what MPLAB supports and is what the default code is in. EasyC is also supported, but I've never used it. I suppose it's easy to use...

JamesBrown
29-11-2006, 13:23
C for FIRST (obviously)
C++ for class and for my self.
Java for a non-first robot I am working on and any thing I need to use PostGRESQL with.
Basic for absolutly nothing, other than the first 4 weeks of programming class last year.

Jimmy Cao
29-11-2006, 22:01
I'll just offer my 2 cents about easy C. I do not mean to bash it, because I understand that many teams use it, and it is a great tool.

If it is possible to avoid using it, i recommend that you do. It is difficult to program some of the more complicated functions in it. In the end, it would most likely take me more time to program the whole robot in Easy-C than it would for me to program it in C.

C is a very powerful language, and it can be manipulated such that you can do almost anything and everything with it.

However, if no one on your team already knows C, and none of them are motivated to learn C (which is rather boring, because C/C++ are heavily syntax based), using Easy-C to program your robot would be a lifesaver.

Just my 2 cents.

Stuart
29-11-2006, 22:19
My only big problem with easyC. is that once you get to a point where you know what your doing and you know how to program your robot and you wanna do some more complicated things in pure C, you have to start all over with every thing youve build. there is no "export to C" option in easyC. in other words if you start in easyC your stuck with it.

Astronouth7303
29-11-2006, 22:59
Python, when I have a choice.

JamesBrown
29-11-2006, 23:04
If it is possible to avoid using it, i recommend that you do. It is difficult to program some of the more complicated functions in it.



This is completely untrue, complicated functions are much much easier to do in easy c, basically all easy c does is turn pseudo code into code for you. The only things in easy c that are more complicated then in C are extremely basic things (like declaring/initializing a variable) I have done all of my programming in C the last 2 years and have absolutely no trouble doing it. However this year I will be doing most of my programming in easy C just because it will save me time.

James

Kingofl337
01-12-2006, 07:44
We are working on addressing all the features more advanced programmers
are asking for. If your torn between "C" and easyC you'll love this.

easyCPRO is coming.... :D

ThienAn
01-12-2006, 17:52
seems like everyone uses C for their robotics lol. (This is same person from original post, I was just using another person's account because I hadn't activated mine yet - darn school WebSense) What I want to know is there any way to use Java? because I'm taking/have taken a class on Java, whereas I know nothing about C or anything else except a little HTML. :confused: What would you guys recommend? Plus, I heard from my teacher/mentor that there was something else people use? EasyC/C and...RoboC or something like that (he didn't know himself, told me to find out :D)

JamesBrown
01-12-2006, 18:00
You have to use C for the IFI controller, c is very similar to JAVA though, you shouldn't have much trouble moving between the two.

James

Chief Samwize
01-12-2006, 20:30
I'm new at the programming thing but Easy C for FRC is awesome. It makes everything so less complicated for beginners like me. :D

Jake M
01-12-2006, 23:31
If you've got the time needed, which isn't much, learn C. It's quite easy to learn, especially considering how much tutorial material is out there, even outside of FIRST, and it's definately the most powerful for FRC programming. Assembly is definately usable, but it'd be overkill unless you wanted to write your own versions of the FRC libraries, or the Process_Data_From_Master_uP() function, or something to that effect.

As for converting from Java to C, I've never heard of anything, and I don't see why anyone would take the time to make it. ThienAn, considering how much time we have before the build, just over a month, I'd go buy a book on C, or go find a handful of C tutorials to read on the internet (CProgramming.com is good). Even more helpful would be to take a look at last year's default, and even test it out on an old RC, with Dashboard, if you have one available. Of course, I don't know if there are any other projects you're working on before the season starts.

ThienAn
04-12-2006, 21:57
ThienAn, considering how much time we have before the build, just over a month, I'd go buy a book on C, or go find a handful of C tutorials to read on the internet (CProgramming.com is good). Even more helpful would be to take a look at last year's default, and even test it out on an old RC, with Dashboard, if you have one available. Of course, I don't know if there are any other projects you're working on before the season starts.

Thanks for the advice =). I asked one of my mentors, he said he'll get me a book (one of his) sometime, and it seems like a lot of C is similar to Java, so I think I'll do well in that regard. In regard to the robot, we have a Vexx robot or something they made last year, or hes giving me some robot to "play with" over Christmas break.

3DWolf
05-12-2006, 16:03
I'm just getting starting into C for FRC, and I know a few others such as:
Lua - A game generic language, I mainly code it for Garrys Mod
C++ - Know very little, couldn't code it for my life :(
Visual Basic - For school only, I would really rather NOT know this :(
Dark Basic - Another school language. It's a pretty cool program, Dark Basic. It's a 3D game creator with about Nintendo 64 rank graphics. :ahh:

Then there are the standard ones that most people know:
HTML
Javascript
Flash Action script

Eldarion
05-12-2006, 20:48
C for embedded systems
Verilog for FPGA development
PHP for Web
Java for...well, nothing! :)

Alexa Stott
05-12-2006, 21:07
seems like everyone uses C for their robotics lol. (This is same person from original post, I was just using another person's account because I hadn't activated mine yet - darn school WebSense) What I want to know is there any way to use Java? because I'm taking/have taken a class on Java, whereas I know nothing about C or anything else except a little HTML. :confused: What would you guys recommend? Plus, I heard from my teacher/mentor that there was something else people use? EasyC/C and...RoboC or something like that (he didn't know himself, told me to find out :D)

I wouldn't recommend you no use EasyC. You said that you know some Java and, as JamesBrown pointed out earlier, C and Java are very similar.

Kingofl337
05-12-2006, 23:18
Here are some good video's of what you can do in easyC

http://www.checkmate40.com/Video/2006/ma_sf2m1.html

http://www.checkmate40.com/Video/2006/GSR_Auto.mov

http://www.checkmate40.com/Video/2006/new_096.html

This was a 3 speed, mecanum drive robot, with 8 autonomous modes
that could run from all 3 spots and adjust the final distance
from the goal. We used an xBox360 controller rewired to the
DB15. It was 100% programmed in easyC for FRC. I don't say
this to brag but just to point out the capabilities of this tool.
After working with the kids programming I very much doubt
there is anything you can't do with easyC in a FIRST robotics
environment.

This is what it comes down to. The function of easyC its not
to replace C as language its designed to teach C. It's a tool
designed to enable rapid testing and develop programs specifically
geared towards FRC and VEX robotic platforms. easyC was
developed after team 40 and mentors from intelitek coming
to the conclusion it's way to much work to program these robots
even to do the simplest of tasks. Like a simple closed loop proportional
drive system. Add to the fact that most teams give the robot
to the programmers 3 days before ship and say, "Get to work"
that or compromise a design because they don't think they can
program it.

In the end all I'm asking is open your mind and give easyC for FRC
a shot, a dedicated attempt to program your 05 or 06 robot.
For most experienced programmers I bet you can program your
entire Operator Control in under 1/2hr. easyC is just a tool,
designed to make life a little easier for the FIRST community.

Sparks333
06-12-2006, 01:23
C and Assembly for robotics - I'm a low-level guy
C++ when I need compiled OOP capability
JAVA when I want to have portability
Ti-Basic for fun
Dabbled in a few others, few compare to C in terms of versatility and reliability. Plus, several of the major programming languages use a similar syntax to C, so knowing C inside and out has other advantages.

I didn't like Java (and don't think I'd like EasyC) because of its inherent lack of settable pointers - I know, most people think they are the devil, and it's true they can royally screw something up if done incorrectly, but passing something by address is hugely faster than by value.

Sparks

Qbranch
06-12-2006, 10:23
Robotics: C
General Purpose Embedded: C
Fast Routines: Assembly
School: Java
Calculator: TIbasic and C (yes, there is a compiler)
Quick/Dirty Interfaces and I/O: VB6 (NOT .NET), C++, or QB

-Q

gobeavs
06-12-2006, 23:17
Robotics: C
Most other things: Ruby

Learning C# though as a sort of middle-ground.

Cjmovie
30-12-2006, 04:42
Robotics: C
Simple Programs: C+ (Yes, C and C++ mixture. If you can call it that)
Complex Programs: C++
Web Development: PHP, SQL (MySQL), XHTML, CSS, Javascript
Low-Level (Such as OS-DEV): x86 ASM
School: Java (which I used to hate with a passion; not so much anymore)

Among other things...
SX Assembly for the SX52 Microcontroller (Crazy thing, 80MHz! You can write a video kernel in it - software black and white NTSC :-) )
And I've experimented with many C-based scripting languages.

Tom Bottiglieri
30-12-2006, 04:46
C#

dcbrown
30-12-2006, 14:06
MICRO32 , for low-level h/w bit pushing projects
MACRO32, for assembler level
BLISS for high level...

Of course my first "electronics" class in high school votech did involve 6.3VAC and filaments....

But seriously, any programming language can be used... it is how you use it that counts as long as the resulting run-time execution profile, code size, or data space used doesn't put you at a disadvantage over some other language or tool.

Personally, I always look at the assembler generated by the compiler to see if I'm using things correctly to match the processor architecture. If a line of C code is compiled into 30-40 instructions, then I probably didn't choose the best programming method for solving the problem. For example, in one piece of code I just finished I needed to walk an array and move all the entries up one until some end condition. Putting the code in a loop looked good in C - nice and compact - until I looked at the compiled code. It took some 196 cycles on average to do all the array indexing computations, move the data around, and do end condition check for just 2 array entries with the for loop. In contrast, unwinding the for loop across the whole array

array[0] = array[1];
array[1] = array[2];
...

takes only 64 cycles to always move the whole array even though its like 8-10x more C code. The particular chunk of code started life as a singly linked list structure, but computationally it was just too expensive in terms of compiled code size and execution time. Building a lookaside/ordered index table as a companion to the data structures was much more effecient on the current processor in this case.

The argument of using oop or this or that os is often moot - none of those run very well at all on the current architecture. Moving to a processor that does run linux, say, still doesn't begin to address the issues introduced by using a full blown os; namely no pre-emptive scheduling and very long latency issues in terms of use within a real-time system such as a robot. Yes, there are flavors and changes you can make to get linux to almost be rtos capable, but that typically means either throwing some serious h/w at it or reduction of kernel services to something that means you're really not running linux but some strangled subset there of.

The flip side is learning to program well with an architecture that is both powerful and weak at the same time.

The test of learning to program well is capitalizing on the PICs strengths while recognizing and avoiding its weaknesses as much as possible. If you can do this using some other language or interface - great! Go for it! But for now, I'll stick to C and EasyC as both put me only at a slight disadvantage over assembler if the proper programming method is found and utilized.

Bud

cjelly
30-12-2006, 14:27
For the robot I code in C. Last year, we started a dashboard in VB.NET (that was the main language that my friend and I knew) but eventually converted over to C# after discovering dashboard code that already had most of the work done on it (it was posted on ChiefDelphi somewhere).

Personally, I used .NET for a while, but I found that everything Microsoft makes for development products (that is worth using that is) is very expensive. I do like the express editions of .NET 2.0, but they are somewhat limiting, especially SQL Server Express.

For a job I was doing last year I was forced to switch over to PHP running on an Apache server with a MySQL database backend, and it was so much less restrictive than Microsoft, it was free, and it was more logical I found. I ended up switching my hosting from Microsoft Hosting (on IIS:ahh:) to Linux Hosting (on Apache).

teh_pwnerer795
31-12-2006, 13:19
C for FIRST
Turing for School:eek:
Learnt abit of Java2 overr the summer
and

im learning visual basic and possibly python before the summer:D

Eric Finn
03-01-2007, 17:41
C for the robot,
C or C++ for applications (C++ for our team's dashboard),
Perl for what I don't know how to do in C/C++,
and I'm probably going to learn C# for Microsoft's Robotics Studio.

JBotAlan
03-01-2007, 21:10
C for FIRST
PHP and MySQL for web design (not very good yet)
VB6 (yuck) for prototyping Windows apps (hey, it's my primary language and what got me interested in programming for robotics)
C++ for whatever apps I need for programming class.

That's about it. I've known a ton more, but forgotten them because they don't matter (like Not Quite C for the Lego RCX).

JBot

Jake M
03-01-2007, 21:54
Personally, I always look at the assembler generated by the compiler to see if I'm using things correctly to match the processor architecture.[/QUOTE]

Not to sound like an idiot, but how do you do this? I know assembly language quite well, but I never really found an application for it in practical programming. Is there a way to do this in FRC programming as well?

Astronouth7303
03-01-2007, 22:13
Not to sound like an idiot, but how do you do this? I know assembly language quite well, but I never really found an application for it in practical programming. Is there a way to do this in FRC programming as well?

Use the list file. It's optionally generated by the linker.

dcbrown
04-01-2007, 12:14
In MPLAB IDE, View->Disassembly Listing or View->Program Memory.

If using Program Memory view, I select the "Symbolic" tab at the bottom of the window.

For example,


void EventHandler_Remove( void )
{
unsigned char ndx;

for (ndx=0; ndx<MAX_EVENT; ndx++)
{
EV_Links[ndx] = EV_Links[ndx+1];
if (EV_Links[ndx] == 0xFF ) break;
}
return;
}

Generates 33 instruction cycles per loop plus 9 instruction cycles of overhead/setup. It could take a maximum of 537 instruction cycles to complete if the event array is full.

526: for (ndx=0; ndx<MAX_EVENT; ndx++)
6002 6ADF CLRF 0xfdf, ACCESS
6004 0E10 MOVLW 0x10
6006 5CDF SUBWF 0xfdf, W, ACCESS
6008 E21D BC 0x6044
6040 2ADF INCF 0xfdf, F, ACCESS
6042 D7E0 BRA 0x6004
527: {
528: EV_Links[ndx] = EV_Links[ndx+1];
600A 28DF INCF 0xfdf, W, ACCESS
600C 6AEA CLRF 0xfea, ACCESS
600E 0FE0 ADDLW 0xe0
6010 6EE9 MOVWF 0xfe9, ACCESS
6012 0E07 MOVLW 0x7
6014 22EA ADDWFC 0xfea, F, ACCESS
6016 50EF MOVF 0xfef, W, ACCESS
6018 6EE6 MOVWF 0xfe6, ACCESS
601A 50DF MOVF 0xfdf, W, ACCESS
601C 6AEA CLRF 0xfea, ACCESS
601E 0FE0 ADDLW 0xe0
6020 6EE9 MOVWF 0xfe9, ACCESS
6022 0E07 MOVLW 0x7
6024 22EA ADDWFC 0xfea, F, ACCESS
6026 52E5 MOVF 0xfe5, F, ACCESS
6028 50E7 MOVF 0xfe7, W, ACCESS
602A 6EEF MOVWF 0xfef, ACCESS
529: if (EV_Links[ndx] == 0xFF ) break;
602C 50DF MOVF 0xfdf, W, ACCESS
602E 6AEA CLRF 0xfea, ACCESS
6030 0FE0 ADDLW 0xe0
6032 6EE9 MOVWF 0xfe9, ACCESS
6034 0E07 MOVLW 0x7
6036 22EA ADDWFC 0xfea, F, ACCESS
6038 50EF MOVF 0xfef, W, ACCESS
603A 08FF SUBLW 0xff
603C E101 BNZ 0x6040
603E D002 BRA 0x6044
530: }
531: return;
6044 D005 BRA 0x6050

This is executed at interrupt time and looks a bit wordy. An alternative is code that does the following:

void EventHandler_Remove( void )
{
EV_Links[0] = EV_Links[1];
EV_Links[1] = EV_Links[2];
<snip>
EV_Links[15] = EV_Links[16];
return;
}


533: EV_Links[0] = EV_Links[1];
6046 C7E1 MOVFF 0x7e1, 0x7e0
6048 F7E0 NOP
534: EV_Links[1] = EV_Links[2];
604A C7E2 MOVFF 0x7e2, 0x7e1
604C F7E1 NOP




This generates 32 instruction cycles for processing the whole array. So this code has more C code but executes faster than even the minimum 1 time through the arrray using the for loop. Although I can easily read the code and what it is doing, I'm really only interested in instruction counts. If the instructions being generated for each line of C code look a bit high in count, then I usually investigate and possibly re-think what I'm doing based upon how often the code is being executed and how time critical the code is. One of the weaknesses of the PIC18F architecture is array and pointer manipulation - for example - but there are other programming methods of organizing and processing the data to avoid or mitigate those weaknesses.

Bud

something
05-01-2007, 00:52
C - Robotics
C++ - most x86/x86_64 stuff
assembly - small PIC projects
English - general human interaction :)

David

drakesword
08-01-2007, 23:19
c & asm -> FIRST
Java -> most complicated projects
Basic 6.0 -> Simple apps for testing purposes
Basic .NET -> Refigned version of above
C++ -> DirectX
LUA -> Gmod (hey its a language)

I would really like to see the Java TinyVM used on the FRC, but thats just a dream.

JYang
08-01-2007, 23:42
Our team uses C and C++.

chrisstruttmann
09-01-2007, 01:16
Robotics--> C (not good at it yet but mentor helps when needed)
Simple Windows Apps--> VB.net
Simple web apps--> ASP Classic (moving away from)
More complex web apps--> ASP.net
Pretty good at but still learning--> PHP
Database Server --> MySQL (LOVE IT! Better than MS SQL Express by exponential amounts. Regular SQL2005 would be my favorite if it wasn't so pricey.)

As far as FIRST goes, I'm still learning with that. When I started at Voltage (2005) there was NO easyC, and we haven't found a reason to start using it yet.

Most people bash vb.net, it's really not that bad once you get into it. Same with Asp.net. I like to stick with the .net stuff because I can pump things out really quickly, though being able to run my apps on Linux would be nice. Especially considering the newest addition to my room is a Sun Microsystems Ultra Enterprise 3000 (6 processors, 6GB RAM) :))

Kamikaze
09-01-2007, 02:59
For my hobby programming I use languages like haskell, objective caml, scheme, and ruby (I'm obviously a fan of functional programming languages). Right now I'm reading Simon Peyton Jones' The Implementation of Functional Programming Languages so I can write my own eventually.

brainonska
20-01-2007, 16:56
C: Robotics
C++: no
Java: When I feel like taking way longer than I need to
Perl: everything else

ScottWalls
21-01-2007, 11:58
C and Python for robotics
Python for my own projects
PHP for web stuff

matt 1923
24-01-2007, 22:03
http://i94.photobucket.com/albums/l112/199210/cdos.jpg

AustinSchuh
24-01-2007, 23:22
I use C mostly. I want to learn an interpereted language, but haven't invested the time to learn one. Ruby sounds cool from what my brother has done with it. He created a simulator that takes input from the OI dashboard to drive a robot on the screen rendered with OpenGL.
I also use GTK+ under Linux for graphics.
I have been using latex for typesetting. It is a programing language specifically designed for making nicely formated (math or english) papers which are compiled into pdf and ps files for viewing.

ace123
29-01-2007, 02:18
I would say Python all the way for an interpreted language.

The other day one of the programmers on my robotics team was asking about how to check if his joystick curve function was working. I was able to rewrite a prototype function in a python editor, stick a for-loop at the bottom the file, and run it, all in about 1-2 minutes (he was still explaining to someone about how it would or wouldn't work when I finished).

The really nice thing about Python is that it has hundreds of *useful* library functions, especially in the string and math realms. It has native BigInt support, and much else.

One problem is that it has no strict typing. This can also be a huge benefit if you are trying to use code intended for one thing for a completely different purpose.

I actually learned python as a scripting language for Vega Strike, but I'm so glad I know it now. Perl feels less "right" than python... too much syntax, and not enough sense to it.

Also, I would say C++ for best compiled language... It has a pretty nice library of functions, it's native, and it runs all C libraries with few hassles. It has some methods for garbage colleciton, and a lot of other features that make it really generous for a compiled language.

Speaking of C++, I've heard Objective-C (I've never used it however) is a nice language (though it hurts my eyes to look at it). It supposedly now has garbage collection support, yet it's compiled. I wonder how they did that...

Java and PHP are okay... but they feel messy. I used to really like PHP for web development, but I learned about Django (http://www.djangoproject.com/) which is a much more structured web development method written in Python.