On Fri, 7 Jul 2006 11:25:29 -0700, Padu wrote:
I'm developing a remote control panel for a mobile robot I'm developing. The
robot carries a PC that runs a C# app to control the platform. The robot's
PC has a wi-fi card. I'm not concerned with range issues now.
Now I want to create an application that will reside on my laptop that will
send commands to the robot (go forward, brake, pan, tilt, get me a gps fix,
etc) and will receive information messages (gps fix, a bitmap image, sensor
reading, etc).
I'm new to .net development, so I was about to start using direct TCP/IP
sockets when someone told me that remoting would be much easier. I'm
studying it right now.
Now I come here to ask you about what options would be best in this
environment.
..NET remoting would definitely be the best tool to use here. It will allow
to develop your application in no time and adding new commands later on if
necessary will be as easy as adding a new method to a class. Performances
should not really be an issue. You should keep in mind that .NET Remoting
is a .NET only technology though so if you'd like to be able to control
your robot via, say, a Java application or a native Linux C++ application,
then you should stick with the good old sockets.
To do what you want to do in .NET Remoting, you'll have to:
- define an interface containing the command that you want to send to your
robot. E.g GoForward(int distance), Tilt(int degrees)....
- place this interface in a DLL referenced by both the server application
(on the robot) and the client application (on your laptop)
- implement this interface in the server application then expose the
created class via .NET remoting (2 or 3 lines of code for that)
- in the client application, connect to the server, get a reference to the
remote object (2 or 3 lines of code too), then calls its methods as if it
was a normal local object
There are several tutorials on the web that will get you started. Of
course, there will be a few rough edges. To send an image, you won't be
able to simply pass a Bitmap object as a parameter as you would do with
many other types. You'll have to convert your image into a byte array
first. But there is code on the web that you can copy/paste to do that.
Sending events from your robot back to your client application also isn't
that an intuitive thing to implement but once again, there are many
examples on the web.