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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Hi Padu,
There are some really good articles on vision using c# over at CodeProject:
directshow library:-
http://www.codeproject.com/cs/media/directshownet.asp
skin recognition:
http://www.codeproject.com/useritems/Skin_RecC_.asp
general image processing:
http://www.codeproject.com/cs/media/Image_Processing_Lab.asp
and some great motion tracking:
http://www.codeproject.com/cs/media/Motion_Detection.asp
Mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Merlin Robotics - http://www.merlinrobotics.co.uk Merlin Systems Corp. http://www.merlinsystemscorp.co.uk Merlin Bluetooth http://www.merlinbluetooth.co.uk Merlin Research http://www.merlinsystemscorp.co.uk/merlin_wiki/index.php/Main_Page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Padu wrote:

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Mark wrote:

Thanks Mark, exactly what I looking for.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Padu wrote:

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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Padu wrote:

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.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
mlw wrote:

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...
http://flatassembler.net/examples.php
FASMCam size: 2 kilobytes This application shows how to access webcam in Windows. Written by Marcus Araujo.
-- JC
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
"JGCASEY" wrote <snip>

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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Padu wrote:

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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
JGCASEY wrote:

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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Padu wrote:

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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
"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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.