C# for higher level robotics?

LINUX ADVOCATES NEED NOT APPLY

Anybody here has ever used C# (.net really) for controlling of any robot? Not talking about real time or close to real time stuff, as these are done by PICs, DSPs and ARMs.

I'm mainly concerned with vision algorithms. For that I've been using native win32 compilers (C++ and Delphi), but I'm thinking about migrating to C#.

Cheers

Padu

Reply to
Padu
Loading thread data ...

Hi Padu,

There are some really good articles on vision using c# over at CodeProject:

directshow library:-

formatting link
skin recognition:

formatting link
general image processing:

formatting link
and some great motion tracking:

formatting link

Mark

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Merl> LINUX ADVOCATES NEED NOT APPLY

Reply to
HumaniformOne

Thanks Mark, exactly what I looking for.

Reply to
Padu

I think the issue is speed, and this comes down to how you write the algorithms. C# makes it very, very easy to access GDI+ functions, and you always have the option of using unmanaged calls to standard GDI, or a third-party imaging library. It all depends on what you want to do, and how you're doing it. Mark's URLs are great, and were the ones I was going to mention.

Don't also forget to look at commercial DirectShow filters, which you can use with C# along with DirectShowLib, for motion tracking, blob counting, motion detection, etc. Often these are available at greatly reduced prices for academic work (which will apply to you). Check out Montivision and LEAD Tools for starters. The open source projects are fine, but these commercial tools have some advantages, too.

Since C# can call a flat API, don't forget Robin's vision libraries. They can be called by any program that can access a standard Windows DLL.

-- Gordon

Reply to
Gordon McComb

You can't expect that one will not be encouraged by such a line.

C# is very much like Java in that the CLR is like the Java VM. There are a lot of advocates that claim that VM languages like Java or C# can process data faster than C, I have yet to see it in practice or hear a reasonable explanation as of how.

Reply to
mlw

The only question is does it process data fast enough for the application in question? Otherwise it makes sense to use the language and OS you are expert at. There is always the option of inline assembler?

One reason I like Java is, in theory, it will run on any system that supports its VM. I guess that is not the case with c# as I suspect M$ would not support Linux :)

I see the programming language and the OS as the bottle neck for hobby robotics where the enthusiasts is not a professional programmer.

I have even spent some time learning to program Windoze from assembler which was my language of choice with DOS as it is the easiest language to learn.

However the Windoze environment is hundreds of more times complex to learn than assembler which would call its APIs.

And tutorials are rather scant to find...

formatting link
FASMCam size: 2 kilobytes This application shows how to access webcam in Windows. Written by Marcus Araujo.

-- JC

Reply to
JGCASEY

"mlw" wrote

Well, I doubt that either... it is one more layer... so I can't see how implementing the same algorithm in the two environments, how a JITted one could be faster (assuming both compilers and runtimes are making good optimizations). Although with new processor speeds and optimizations of the VM's or CLR's, my hope is that it becomes less and less of an issue.

I've been programming in Delphi for the past 10+ years of my life, and going to C# is proving to be as painless as possible, even pleasurable.

Cheers

Padu

Reply to
Padu

"JGCASEY" wrote

I don't think either, but as .NET is a "standardized" framework, it is possible that someone implements it in other platforms, well at least that was MS dream a few years ago. I'm not sure, but I've heard rumors that there is already a .net implementation for unix or linux.

You have to forget about the machine. Programming for windows is basically learning how to interface with all the different APIs and their models. Big no no for assembler. In all my years of windows development, I can count in one hand all the times I had to use assembler (within delphi) to accomplish something.

I learned programming using COBOL, REXX and Assembler for mainframes, and I've been changing languages since then, but honestly, C# caught me by surprise. IMO, it gets the best features of java, c++ and even delphi (ask Mr Hejlsberg). If it proves to be fast enough (note that fast enough faster) for robotic purposes, we may observe a good inflow of people migrating to C#.

Regarding your comment on assembler being the easiest language to learn, it may be true that it has the easiest sintax to learn, but assembler is one of those languages where if you don't know the tricks AND the hardware architecture underneath you, you don't do anything.

Cheers

Padu

Reply to
Padu

Padu wrote:

...

There are a few die hards who program Windows from Assembler although I think it is more a religion as I doubt that they are very productive in terms of actual practical applications. Although I think PowerBasic was written in assembler and does have an inline assembler as part of the package.

Very true. Without the hardware specs it is difficult to decode exactly what is going on. Unfortunately modern hardware is designed for a complex multitasking multimedia machine which requires years of study and practice to program and isn't really a hobby project for anyone who isn't an advanced software expert like yourself.

Cheers,

John

Reply to
JGCASEY

This isn't an either-or scenario. What you write your main code in, and what you write optimized algorithms in, needn't and probably shouldn't, be the same. Writing some routines that compare bits in an array needn't be a tough task, even in Assembler. Your application has only to pass the routine the array of bits.

An expert in the .NET CLR can tweak the compiled code, but it might actually be easier to write things like bit comparison routines in straight C. Compile it as a DLL, and call it from your C#, Visual Basic, or Word macro code as needed.

-- Gordon

Reply to
Gordon McComb

There are several: Mono and DotGNU support several OSs other than Windows (and also Windows). Neither are as polished as MS's .NET, but many of the core libraries are implemented.

-- Gordon

Reply to
Gordon McComb

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.