Society of Robots - Robot Forum

Software => Software => Topic started by: matteo0151 on August 28, 2008, 10:24:16 AM

Title: C#
Post by: matteo0151 on August 28, 2008, 10:24:16 AM
I am just starting with robotics. I am a c# developer.
Does anyboy know if:
1) Is it possible to use C# to program a small robot?
2)Is necessary to have on the robot the .NET framework?
Thank you
Title: Re: C#
Post by: Penth on August 28, 2008, 10:34:46 AM
You could set up a communications link from a pc with .net and control the robot that way. all the robot would need is a communications  interface(bluetooth,ir,wifi) and a microcontroller to interpret commands. Then you could just run your robot  from your pc.
Title: Re: C#
Post by: Terarius on August 28, 2008, 10:48:07 AM
Size of the robot doesnt matter when choosing programming language, the microcontroller that youre going to program is.

I think most basic microcontrollers can be programmed in C/C++. But when finding electronics like basic stamp, you should look what the reccomended/needed programming language should be/is.
Title: Re: C#
Post by: sotu on August 28, 2008, 10:49:43 AM
True. Your planning to have your to your computer at all times, or to be saving and reading the code by it self?
Title: Re: C#
Post by: matteo0151 on August 28, 2008, 12:25:18 PM
You could set up a communications link from a PC with .net and control the robot that way. all the robot would need is a communications  interface(bluetooth,ir,wifi) and a microcontroller to interpret commands. Then you could just run your robot  from your pc.

Ok, but the robot cannot run without the pc.  :-\
I wanted to know if the code could be on the robot.
If I understood right is it possible if the language is c or c++, what about c#?
Can the memory of a microcontroller contain the .net framework? ???
Title: Re: C#
Post by: Penth on August 28, 2008, 12:41:26 PM
You would need a pretty nice(read: expensive) microcontroller or minipc to run it. What size are you looking for? If you know c#, there is no reason you probably can't pick up c or c++ quickly.h
Title: Re: C#
Post by: sotu on August 28, 2008, 03:29:14 PM
If your plan is to example have a servo controller and a USB serial to adapter on your robot, so it can only read the code sent from the computer to the robot, while connected, there is no possible way (as i know) to save your code on the servo controller.
(Check out my tutorial in my signature to see how i built mine - remember 2 vote :P)

Ok, but the robot cannot run without the pc.  :-\

If i understand correct, the same way as i built my robot, is the way you are looking for. Now it will be connected to your computer at all times to be used, and will be compiled and run at your controller ONCE if you do not reset it/replay it. This is because the code cannot be saved on the servo controller.

Regarding where to choose the C# language, im not the right guy to ask :P

I may have understood your question wrong tough..
Title: Re: C#
Post by: Maltaeron on August 29, 2008, 09:57:32 PM
I would recommend you just use c instead, as it is so much more commonly used, and you shouldn't need c# or the .net framework for a 'small robot'
Title: Re: C#
Post by: MarkBrown on August 29, 2008, 10:05:37 PM
Matteo,

I too come from a .Net background and use it for my work, although I first learned C/C++.  I looked into using C# with robotics, and although Microsoft does have a Robotics Studio, I believe it requires having the Compact .Net Framework installed on whatever device you want to use it with.  I am currently using the Axon and 64k memory isn't enough space for most C# applications, let alone the framework.  There is a possible solution though.  You always could try writing your C# code for a PDA and then use BlueTooth or some other fashion with UART to control, or send commands/strings to the robots chip.  Unfortunately, you will have to write C++ for the chip as well.  I suggest hitting the Robotics Studio site to see if they recommend any chips/controllers that will work.  If you find a way to make it work with an AVR chip, please let me know as I would really be interested.

Mark
Title: Re: C#
Post by: RobD on August 30, 2008, 12:11:29 AM
.NET programmer here too! 

IMHO...

It's a personal preference and how much of your microcontroller's memory you can spare.   I've attempted 16 bit math algorithms on the old 16F microcontrollers using both C and asm for comparison.  When finished compiling, the asm programs won hands down in terms of speed.

I'm not saying that learning asm is necessary, just pointing out that sometimes inside the compiler, a simple calculation can take many steps...the compiler seems to be the weakest link with microcontrollers.

I prefer using blank microcontrollers and asm because I feel I have full control over my end product.