Shop OBEX P1 Docs P2 Docs Learn Events
Urgent Help:Using visual basic GUI to interface with BS2 — Parallax Forums

Urgent Help:Using visual basic GUI to interface with BS2

legion_78legion_78 Posts: 2
edited 2005-06-22 10:38 in Learn with BlocklyProp
My project mate and I are·currently doing a school project which require us to design a graphical user interface (GUI) for the BS2. The GUI we are going to design·is similar to the GUI-bot software for the BOE-BOT kits.·We are facing great with the interface between the GUI and the BS2. Both of us are not trained in electronics and programming·thus its quite hard for us to pick up easily. What we can achieve right now is to convert the pbasic programs·to exe files and using these exe files to d/l to the BOE-BOT using visual basic. The problem is that we cannot accumulate the commands together. Example, i want my robot to travel forward, turn right and forward again. In the GU-BOT software, you can click the required movements and·the commands·will be·executed in one move. For our case we are only able to execute one command·at a time.·The drawback is·the robot·will always have to be connected to a RS232 cable.
We would appreciate if anyone can tell us how we can solve this prob, i know its a very tough and complicated matter as it requires both the knowledge of pbasic and vb programming. At least if there is any books u·guys can recomend we would not be so lost. Thank you very much.

Comments

  • IRobot2IRobot2 Posts: 164
    edited 2005-06-21 16:15
    Just to get something straight, you want to be able to click, say forward and the robot move forward, then click right and the robot more right, in real time, correct? If that is so, then I would not try reprogramming the stamp every time you click a button. Rather make one program for the stamp that will look for changes on a certain group of inputs on the stamp. Then you can output highs and lows off of your RS232 port that could be wirelessly connected via. RF. When you click “Forward” on your program, it outputs a high on the respective pin of the serial line, which sets a certain pin of the stamp high, which your stamp program would interpret as a command to go forward.
    ·
    Here are two books I used to accomplish a similar project.
    ·
    “Controlling The World with Your PC” by Paul Bergsman
    “Serial Port Complete” by Jan Axelson
    ·
    Hopefully this is what you were trying to do. If not let me know what you had in mind.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Alex Burke

    burke@ajbrobotics.com

    "The factory of the future will have only two employees, a man and a dog.· The man will be there to feed the dog.· The dog will be there to keep the man from touching the equipment."· ~Warren G. Bennis!
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-06-21 17:00
    legion78 -

    Some of what you're saying doesn't sem to make sense, unless I'm misunderstaning what you're saying. You said in your prior post:

    "What we can achieve right now is to convert the pbasic programs to exe files and using these exe files to d/l to the BOE-BOT using visual basic."

    PBASIC programs are meant to be input to the Stamp Editor, and the Editor will check the programs for proper syntax, and optionally download the necessary program codes to the Basic Stamp. Subsequently the loaded program code can be executed. EXE files don't enter the picture anywhere. Second, PBASIC and Visual BASIC are in no way compatible. There is no way to use Visual Basic on a Stamp regardless of the format (EXE or otherwise).

    Insofar as what you need to do, you need to develop your own Motion Command
    "Language" syntax which includes a command stack, in Visual Basic on a PC (or whatever language and platform you choose to employ). The command stack (to accomodate multiple commands if required) is only executed (singly and serially) if/when a (say) EXECUTE command is issued and received by the Stamp Motion Command processor via whatever input means you might choose to use.

    For testing and development, an RS-232 link (wire tether) should be fine. Later, that can be rather easily converted to a wireless system if you choose to go that route.

    Hints: Since the Stamp has no specific provision for working with strings of data, I would implement the inter-program "language" using single character alphamerics, or better yet, nothing but numerics. Using just numerics it seems pretty obvious that you will need to use at least a two digit command syntax. This really isn't an impediment, if you look ahead and pre-plan the commands based on some simple scheme. The following might be a simple scheme:

    1 X = Orient Commands 3 X = Forward Commands
    1 1 = Orient North 3 1 = Move forward slowly
    1 2 = Orient South 3 2 = Move forward normal
    1 3 = Orient East 3 3 = Move forward quickly
    1 4 = Orient West

    2 X = Turn Commands 4 X = Reverse Commands
    2 1 = Turn North 4 1 = Move reversed slowly
    2 2 = Turn South 4 3 = Move reversed normal
    2 3 = Turn East 4 4 = Move reversed quickly
    2 4 = Turn West

    8 X = Ancillary commands
    ....
    8 8 = IMMEDIATE STOP

    0 0 = Stack next commands
    0 9 = End command stack
    9 8 = Display but do not execute commands in stack
    9 9 = EXECUTE stacked commands
    . . . . ETC

    If you were to use a binary scheme the command structure could be reduced immensely.
    Just some thoughts. Good luck with your project!

    Regards,

    Bruce Bates
  • Kevin B SlaterKevin B Slater Posts: 49
    edited 2005-06-22 06:41
    Perhaps this thread might be of some help.

    Kevin
  • legion_78legion_78 Posts: 2
    edited 2005-06-22 08:37
    Dear Bruce Bates

    · If i understand correctly, are you saying that we can use visual basic·to develop a series of motion·commands for our BOE-BOT and the stamp editor does not come into the picture? Isnt the BS2·be only written·in pbasic codes? The following sample·codes you have written, are they·written in·vb format to control the robot?

    1 X = Orient Commands 3 X = Forward Commands
    1 1 = Orient North 3 1 = Move forward slowly
    1 2 = Orient South 3 2 = Move forward normal
    1 3 = Orient East 3 3 = Move forward quickly
    1 4 = Orient West
    etc
    We have decided to purchase the RF (wireless) products which you guys have also mentioned. Its worth a try and if we can get technical support from the supplier maybe we can get things done a lot quicker.

    As for the exe files,·there is an option in the stamp editor whereby you can save the pbasic codes in executable file and·we use·our GUI created in vb·to d/l it to the robot.

    Thanks for your advise.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-06-22 10:38
    legion_78 said...
    Dear Bruce Bates

    · If i understand correctly, are you saying that we can use visual basic·to develop a series of motion·commands for our BOE-BOT and the stamp editor does not come into the picture?

    >That is correct, but the choice of programming language is really up to you. It needn't be Visual Basic. I only used that as an example, since you had mentioned it. Any programming language capable of using the serial port would be acceptable.

    ·Isnt the BS2·be only written·in pbasic codes?

    >All Basic Stamp Modules are programmed using the PBASIC language. The JAVA Stamp uses a subset of·JAVA as a programming language. No other language choices are avalable.

    The following sample·codes you have written, are they·written in·vb format to control the robot?

    1 X = Orient Commands·· 3 X = Forward Commands
    1 1 = Orient North·········· 3 1 = Move forward slowly
    1 2 = Orient South·········· 3 2 = Move forward normal
    1 3 = Orient East··········· 3 3 = Move forward quickly
    1 4 = Orient West
    etc

    >That above is programming language independent. It represents the output of some user written program·running on a personal computer. Those codes would be output from the serial port and are destined for the Stamp.

    >Again, you can use any progamming language you chose to, so long as it is capable of using the serial port. VB was just an example.


    We have decided to purchase the RF (wireless) products which you guys have also mentioned. Its worth a try and if we can get technical support from the supplier maybe we can get things done a lot quicker.

    >The only thing I mentioned about wireless, is that it would be the LAST thing I'd purchase, since it's at te end of the project·and it will only·be needed if there is to be·no tether between the personal computer and the Stamp platform.

    As for the exe files,·there is an option in the stamp editor whereby you can save the pbasic codes in executable file and·we use·our GUI created in vb·to d/l it to the robot.

    >Consider the ability to create Stamp executable files an advanced option, and not something that you·need to contend with. The Stamp Editor wil download the appripriate Stamp executables directly to the Stamp. Just as a sidenote, with the proper wireless RF·equipment, even that can be done wirelessly, but I see no need to do that in this project. It just makes the project overly complex.

    Thanks for your advise.

    >Sure

    >Regards,

    >Bruce Bates

Sign In or Register to comment.