locked
Configure a serial port RRS feed

  • Question

  • Hi to all,
    I need to know how to send simulated robot position through serial port..Can someone help me to configure a serial port? Is possible to have the code to manage a serial port?
    Please help me..

    Alba
    Saturday, July 25, 2009 9:43 AM

Answers

  • Please have a look at the sample Serial Port service available here:

    http://www.promrds.com/Downloads/SerialPort.zip

    There is a ReadMe.txt in the ZIP file that gives a brief overview of the service and some VPL diagrams that show how it works. You will obviously need to have two COM ports, or two computers with a COM port, in order to test the service.

    NOTE: You must run DssProjectMigration on the source code before you try to compile it!

    Trevor


    Monday, August 10, 2009 6:36 AM

All replies

  • I will try to post something over the coming weekend. However, I am a little confused about what you are trying to do. You say that you want to send a simulated robot's position. Do you already have the necessary code to get the robot's position? Obviously you need this before you send it, but it is a completely different problem.

    Trevor
    Saturday, August 8, 2009 2:08 AM
  • Please have a look at the sample Serial Port service available here:

    http://www.promrds.com/Downloads/SerialPort.zip

    There is a ReadMe.txt in the ZIP file that gives a brief overview of the service and some VPL diagrams that show how it works. You will obviously need to have two COM ports, or two computers with a COM port, in order to test the service.

    NOTE: You must run DssProjectMigration on the source code before you try to compile it!

    Trevor


    Monday, August 10, 2009 6:36 AM
  • Hi Trevor,
    thanks for the answer..and sorry for my late!
    I tried to use the VPL\EchoSynch and ASynch but I didn't understand how it works.
    I use two COM as you wrote. Maybe I made some mistakes but I don't know where. The service run but I can't see any results of the diagram (the port is open). What do I have to do to see something?
    Anyway, my problem is:
    I have a simulated robot and it moves in the virtual environment. I have to send robot position through serial port. Do you know how can I know extract robot position in VPL? Can you send me some example if you something similar?
    Thank you a lot again,

    Alba
    Tuesday, August 25, 2009 1:41 PM
  • The Echo samples just send back whatever you type. So you set up the two COM ports with a Null Modem cable between them. Then you run the program in VPL on one COM port and a terminal emulator on the other COM port and start typing in the terminal emulator. You should see what you type come back to you.

    As for your problem, I assume that you want to output the position of the virtual robot to a real serial port. To get the position of the simulated robot in VPL is not easy. You will need to work on the simulated robot service so that it sends notifications periodically. Then VPL can pick up the notifications. In the service, it can query the Simulator to find the position of the robot. I think there might be a sample that shows you how to do this, or look at my modified version of the Simulated Differential Drive in the book samples.

    Trevor
    Tuesday, August 25, 2009 11:02 PM
  • Trevor,
    the problem with the serial port was solved.
    For the other problem, instead, I still have some problem to understand.
    I had an earlier version with MRDS that worked (the sample was SimulationTutorial5), it showed the virtual robot position (pioneer moved with dashboard)..and it was great! But..now, with the new version of MRDS (Release 2) that example there isn't..so I have some problem to run it in the new version. Do you have some advise to give me or something similar to the old sample "SimulationTutorial5"?
    Thank you in advance,

    Alba
    Wednesday, August 26, 2009 7:38 AM
  • Trevor,
    now it works again..
    I have a service of a robot that moves in an environment and I know robot position. I would like to send these informations to your service (VPL Serial Port). How can I do?
    I hope you can undestand my problem..
    Wednesday, August 26, 2009 3:35 PM
  • I often use VPL for testing and to explore the available operations/notifications for a service. Set up a simple diagram that sends some data to the serial port. If this works, then you can look at the particular request and the fields you needed to fill in.

    Now open your C# code and add the Serial Port service as a partner. (You probably have some partners specified near the top of the code anyway, so you have a pattern to work from). At the appropriate point in your code, send the same request that you figured out using VPL, but with the robot's position data.

    You might need to modify the manifest for your C# service, but you can do this in the Manifest Editor. In particular, the Serial Port service will need a config file to specify the COM port number and baud rate. There should be a suitable config file in the folder with your VPL diagram, otherwise the VPL program would not work!

    Trevor
    Wednesday, August 26, 2009 4:48 PM
  • I'm not able to work with VPL. Do you have some samples where I can see how two servire can communicate one each other?
    For example: two simple service (two blocks) tha communicate together..
    I don't have idea how to send the robot position to the serial port. I know what you say: "Now open your C# code and add the Serial Port service as a partner."(isn't possibile to do it in VPL directy, drag two blocks- environment and serial port and doing something that allow the block to communicate?) but I don't know ho to send robot position...
    Wednesday, August 26, 2009 5:07 PM
  • OK, if you have a service that knows the robot's position, then it can send notifications periodically and VPL can listen for the notifications. Or you can add an operation to your service so that you can request the current position of the robot from VPL. Or, even easier, you can add the robot's position to the State of the service, and then just use a Get on the service to find the position. (The service will have to update the State on periodically).

    Regardless of which approach you take, you will need to modify the service so that VPL can take advantage of it.

    Once you have the position in VPL as a set of coordinates you will have to construct a message and then send it to the serial port.

    Trevor
    Wednesday, August 26, 2009 5:33 PM
  • Thanks a lot Trevor,
    I will try to do it and I will let you know..
    I need just some time!!

    See you soon,
    Alba
    Thursday, August 27, 2009 2:33 PM
  • hi Alba

    i am more curious to know that did you suceed in your project of serialprot mentiond above.....as i am trying to do the similar project
    hope  the information can be very useful
    Saturday, March 13, 2010 8:54 AM