Steps to control my own robot using RDS ( I have a delphi code to control my robot)

Answered Steps to control my own robot using RDS ( I have a delphi code to control my robot)

  • Samstag, 21. Januar 2012 09:20
     
     

    Hi 

    I have a customized simple line-following robot which was built for a course project ( that simple) . It doesn't have any sensor ( work with a webcam) . I have a Delphi code to control my robot and work perfectly . Now here is my question , how can I use RDS to control my robot ? Actually I have started to read the tutorial but at some points they get so confusing . So I really appreciate it if you can tell me the steps that I should follow to get a result . by the way, the communication between the robot and the PC happens through COM port .(RS-232 serial communication ) 

    Also I would like to know if I can use my delphi code , in any way , instead of rewriting the code in C# ?

    Thank you so much

Alle Antworten

  • Samstag, 21. Januar 2012 21:25
     
     Beantwortet

    I believe you will need to start by "breaking" your robot into various services.  (From your description, there is just the drive train.  Unless you've got encoders, you won't implement several operations in the drive service.)  The camera will probably work with the provided webcam/ipcamera services.

    Keeping your existing code sounds problematic, but is doable.  (Hey, it's only bits... mash them around a bit and they'll fit... right? ;>)  You would need to setup a line following coordination service (easiest in C#) which would receive images from the webcam and send commands to the drive.  (Lookup partner services.)  Assuming you can convert your Delphi code into a DLL that is callable by C# - call your DLL which would return the drive command.  The coordinator would then send the appropriate command to the drive service.

    Does this help?

    Ed

    • Als Antwort markiert RESTAndPeace Dienstag, 24. Januar 2012 22:01
    •  
  • Montag, 23. Januar 2012 14:03
     
     

    Hi Ed , 

    Thanks a lot! you cleared some points but I still have problem . Let's forget about the camera and line-following services . I just want to use some high-level APIs like MoveForward , Turn and so on to drive the robot . I just need to figure out how to work with RDS . Here is the thing . I am going to do some application development which means I almost have no idea about robotic hardware stuff and low-level commands ( I know about this specific robot though but in general, let's assume that I am a developer without any profound robotics knowledge and want to use some high-level APIs to develop an application for this robot). Now here is the question : Can I do this with RDS at all ? I mean using High-level APIs without knowing the low-level commands of the robot ? if so , How can I do this? what's the start point ? when and how should I write a service ( let's say drive service) ? when and how should I define the COM port ? 

    I really appreciate it if you help me more :)

    Thanks a lot

     


    r.safari
  • Montag, 23. Januar 2012 17:56
     
     Beantwortet

    The answer is maybe.  Someone has to write the interface between RDS and your robot.  This is low level.  Once that is written, you can stick with the high level operations within RDS.

    Writing an interface to a robot is not hard if you have the interface information.  Modify one of the exiting sample robot interfaces would be the easiest.  There are several that use a serial port to communicate between the PC and the controller.  (Check out the Parallax flavor.  It is already a serial port implementation.)  What robot - exactly - do you have?  Custom or some 'standard' robot?  How do you talk to your existing robot?  Could that existing interface be used to fill in the 'blanks' in the generic drive template?

    Examine the Driver interface and see if the interface looks similar to what you've got.  Remember that if you don't mind some of the operations saying "Don't know how to do that" then you don't have to implement the full interface.  (e.g. if you don't have encoders, you don't have to implement DriveDistance or DriveSpeed.  You could only implement DrivePower.)

    Short(er) answer - someone has to get to the low level and RDS interface talking.  If you don't have that information, it has not been done by someone else, you cannot layer RDS on top of the existing interface, then you are probably out of luck.  (It is really is not that hard to implement the RDS interface.)

    Ed

    • Als Antwort markiert RESTAndPeace Dienstag, 24. Januar 2012 22:01
    •  
  • Dienstag, 24. Januar 2012 19:13
     
     

    The robot is a customized one . It uses SSC-32 controller board and ATMEGA168 Microcontroller . As I said , my programing code is in delphi 7 so to send the commands to the robot I use 'comport' in delphi . for example for 'moveforward' I used this :

     

    procedure TForm1.moveforward;

    begin

    comport1.WriteAnsiString('#20 P1528 CR'+sLineBreak);

    comport1.WriteAnsiString('#7 P1465 CR'+sLineBreak);

    end;

    in which the first param is the number of the motor and  the second one is the position of the servo. 

    I was thinking that if I can have DLL of my existing code and I can call it in C# , so the problem is basically solved . Am I right ? what I need to do is to write a service to drive my robot and call the dlls to talk to the robot . right ? If so , should I  add the dlls to the 'bin' folder ?

    Thank you so much

     


    r.safari
  • Dienstag, 24. Januar 2012 21:28
     
     Beantwortet

    That sounds doable as you describe.  (You should still review the reference platforms to see if you can just change the data sent on the COM ports rather than making calls to your DLL, but either way should work.  Just a bit cleaner code.)

    For writing the service, read the tutorials.  There are also a few books out there.  I'd recommend "Professional Microsoft Developer Robotis Studio from Wrox.  It's a little bit dated, but it is pretty close to the current implementation so the samples are pretty good.  The tutorials will get you there though.

    Yes, you should copy your DLLs to the bin directory.  Visual Studio will auto-magically setup the DSS service settings to correctly put the compilation into that directory, so only your Delphi DLL should need to move there.

    Ed

    PS - If you want to get into more details, why don't we take this off-line.  My e-mail is EdHarfmann at ComCast dot Net.  (For general things and actual implementation details, you are better off in these forums than with me.)

    • Als Antwort markiert RESTAndPeace Dienstag, 24. Januar 2012 22:01
    •