5379
Comment: created page
|
7579
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
==LURC Front End Software== | #format wiki #language en |
Line 3: | Line 4: |
==formatted string containing value expressions== | = Controlling the LURC = The first version of the 'front end' is basically a serial program running on the bifferboard, controlled over ssh. There are a few things we can use to send hex values from the linux command line. The first is minicom, which is hard to learn and was designed more for modems than byte banging. Minicom also requires you to do some fancy piping to make it output hex. The second option, which is simple and works, is python serial. As python has a command line interpreter, it's very quick and easy to do (example is below). The third option is a program written in by LyndonWhite called gen1 which uses c++ libserial. This also works, but hasn't been extensively tested. The source for gen1 is in the project repo on the main page. Instructions and some documentation is also below. == A Note about Licenses== Any Code found in the svn.ucc.asn.au:8080/oxinabox/ is note release for public or public use, or veiwing. All Rights Reserved Lyndon "Frames" White, including the right to reliscense. Liscense for release is Pending. All Files in that Repository are Property of Lyndon "Frames" White and or BobTech ==== formatted string containing value expressions ==== |
Line 7: | Line 18: |
the "formatted string containing value expressions" is at the core of doing low level transmission. we know the decimal 65, hex 41, binary 0100 0001, and the ascii character 'A' all have the same binary representation. |
The ''formatted string containing value expressions'' is at the core of doing low level transmission. We know the decimal 65, hex 41, binary 0100 0001, and the ascii character 'A' all have the same binary representation, so to tell which we are using we have a series of deliminators - numbers preceded by: <<BR>> # are decimal <<BR>> $ are Hex <<BR>> @ are binary <<BR>> No deliminator, then ascii. <<BR>> |
Line 10: | Line 25: |
so to tell which we are using we have a series of deliminators, numbers preceded by a # are decimal $ are Hex @ are binary no deliminator, then ascii. Putting a sign indicator after the deliminator is optional. it is required if you want to send a negative number. |
Putting a sign indicator after the deliminator is optional. It is required if you want to send a negative number. |
Line 23: | Line 30: |
all values in a "formatted string containing value expressions", must be in the range -128 to 255 (inclusive) as they must fit in 8bytes. (other values will cause an error) negative numbers have the compliment of 2 representation for there binary form. |
All values in a ''formatted string containing value expressions'' must be in the range -128 to 255 (inclusive) as they must fit in 8bytes (other values will cause an error). Negative numbers have the compliment of 2 representation for their binary form. |
Line 27: | Line 32: |
There are some problems with ascii - characters that can't be sent (in future versions this will be fixed by giving ascii a delineator and some more code to make that deliminator work, I think). character that can't be sent, the delineator characters:$#@. numbers written immediately after a value that could have contained those digits: 0,1,2,3,4,5,6,7,8,9 for decimal 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,A,B,C,D,E,F for hex 0,1 for binary |
There are some problems with ascii - characters that can't be sent (in future versions this will be fixed by giving ascii a delineator and some more code to make that deliminator work, I think). <<BR>> Characters that can't be sent: * The delineator characters: $#@ * Numbers written immediately after a value that could have contained those digits: * 0,1,2,3,4,5,6,7,8,9 for decimal * 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,A,B,C,D,E,F for hex * 0,1 for binary The code for this is normally in str2num.c[pp] (pipedream has it in its main (only file), bad coding practice I know) |
Line 35: | Line 43: |
the code for this is normally in str2num.c[pp] (pipedream has it in its main (only file), bade coding practice I know) | '''Note: the Python (pySerial) Method uses a differnt way of deliminating various values, please see the Python Documentation for details the ''formatted string containing value expressions'' is only for PipeDream/Gen1''' |
Line 37: | Line 46: |
===Minicom + PipeDream=== ====software req:==== *minicom (or picocom or microcom, but these instructions are fro minicom) *pipedream: http://svn.ucc.asn.au:8080/oxinabox/LURC/gen1/examplesAndTestCode/Pipedream/ |
== Minicom + PipeDream == === Software Requirements === * minicom (or picocom or microcom, but these instructions are for minicom) * pipedream: http://svn.ucc.asn.au:8080/oxinabox/LURC/gen1/examplesAndTestCode/Pipedream/ |
Line 44: | Line 52: |
====About Pipedream=== Pipedream is a direct derivative of str2Num.c[pp] (a twig , branching from a twig). it's basically str2Num made into a program. As such it may refers to itself as str2num inside the source files (which you should read, they have some documentation in them) |
=== About Pipedream === Pipedream is a direct derivative of str2Num.c[pp] (a twig , branching from a twig). It's basically str2Num made into a program. As such, it may refers to itself as str2num inside the source files (which you should read, they have some documentation in them) |
Line 49: | Line 56: |
====How Pipedream works/how to use pipedream==== Pipedream is a command line app, that takes two parameters: first: a filename which is to be ignored (this is to get around minicom's desire to send files, using protocols) second: a formatted string containing value expressions (See above). if this parameter has a hash (#) in it you will need to put the whole string in quotes (" "), otherwise zsh will treat everything after the # as a comment, and won't pass it as a patented. similar for spaces, if there's a space in you parameter put the whole parameter in quotes |
=== How Pipedream works/how to use pipedream === Pipedream is a command line app that takes two parameters: 1. A filename which is to be ignored (this is to get around minicom's desire to send files, using protocols) 2. A ''formatted string containing value expressions'' (see above). If this parameter has a hash (#) in it you will need to put the whole string in quotes (" "), otherwise zsh will treat everything after the # as a comment, and won't pass it as a parameter. Similarly for spaces, if there's a space in the parameter, put the whole parameter in quotes |
Line 55: | Line 62: |
It converts that string into its values, and then writes them to stdout. any errors are written to stderr, and the program terminates. |
Pipedream converts that string into its values, and then writes them to stdout. Any errors are written to stderr, and the program terminates. |
Line 58: | Line 64: |
====Using Pipedream with minicom==== |
=== Using Pipedream with minicom === |
Line 61: | Line 66: |
check the settings are ok: port: /dev/ttyS0, Baud: 19200bps, 8N1 now we need to set up minicom to use pipedream as an protocol. Press Ctrl-a, Z to bring up menu, then O to access configure minicom. (you could immediately press Ctrl-a, O) (you can also check the port settings while you are here) then go down the protocols. add it as a protocol, match the settings used for the ascii protocol already there, except the name will be pipedream, and the path is the path to the pipedream executable (if your started minicom in the pipedream folder then this is ./pipedream) While still in this "window", change the setting "use window for file selection" to No. |
Check the settings are ok: port: /dev/ttyS0, Baud: 19200bps, 8N1. Now we need to set up minicom to use pipedream as a protocol. Press Ctrl-a, z to bring up the menu, then O to access configure minicom. (you could immediately press Ctrl-a, O). You can also check the port settings while you are here. Then go down to protocols and add it as a protocol - match the settings used for the ascii protocol already there, except the name will be pipedream, and the path is the path to the pipedream executable (if your started minicom in the pipedream folder then this is ./pipedream). While still in this "window", change the setting "use window for file selection" to No. |
Line 71: | Line 71: |
Now pipedream has been set as a protocol for sending. this means that it's stdout has been redirected to the serial port. and that it's stderr has been redirected to you screen. |
Now pipedream has been set as a protocol for sending. This means that it's stdout has been redirected to the serial port, and that its stderr has been redirected to your screen. |
Line 74: | Line 73: |
so to send something with pipedream: press Ctrl-A, S. and select the pipedream protocol. Now you are asked for a file, give the path to any file, (I suggest making on in the folder you are in before you start minicom). then put a space, and type the other parameter, the "formatted string containing value expressions" |
Now send something with pipedream: Press Ctrl-A, S and select the pipedream protocol. Now you are asked for a file, give the path to any file, (I suggest making one in the folder you are in before you start minicom). Then put a space, and type the other parameter, the ''formatted string containing value expressions'' (see above) == Python Serial == Fire up python from command line and type the following (note you have to have python serial installed): {{{#!python import serial ser = serial.Serial('/dev/ttyS0', 19200) ser.write('\xd2\x80') }}} The final write command will send 0xd2 then 0x80, which in our case is used to turn the motor on. == Gen1 == gen1 is the first program built expressly for communicating with the AVR SerialComms (the so called "Oxinabox Lightweight Serial Protocol for Long-Range University of Western Australia Computer Club Cars). It doesn't do anything special, just sends the values of ''formatted strings containing value expressions'' out a serial port. === Software required: === gen1: [[http://svn.ucc.asn.au:8080/oxinabox/LURC/gen1/gen1Source/]]. You may need to build it - just use the make command. Start it with sudo ./gen1 <<BR>> It takes 1 parameter, the device name for the port you want to transmit on. Once it gets started, you can type in ''formatted strings containing value expressions'' and then press enter and it will send them, and then be ready to go again. === Gen1.5 === Gen1.5 will also recognise Commands as detailed in cmdTable.h, but that's a future release. === Gen2 === The first release that does not run directly on the bifferboard. May have an ssh built into it, to communicate with gen1.5, on the bifferboard. Has a GUI, and the webcam diplay built in. === Gen3 === The Goal release, probably an upgrade of gen2. It supports the steering wheel and foot pedals. |
Line 81: | Line 106: |
===gen1=== gen1 is the first program built expressly for communicating with the AVR SerialComms (the so called "Oxinabox Lightweight Serial Protocol for Long-Range University of Western Australia Computer Club Cars). It doesn't do anything special, just sends the values of "formatted strings containing value expressions" out a serial port. ====Software required:=== gen1: http://svn.ucc.asn.au:8080/oxinabox/LURC/gen1/gen1Source/ you may need to build it - just use the make command. start it with sudo ./gen1 it takes 1 parameter, the device name for the port you want to transmit on. once it gets started, you can type in "formatted strings containing value expressions" and then press enter and it will send them, and then be ready to go again ===gen1.5=== Gen1.5 will also recognise Commands as detailed in cmdTable.h but that's future release ===gen2=== the first release that does not run directly on the bifferboard. may have an ssh built into it, to communicate with gen1.5, on the bifferboard. Has a GUI, and the webcam diplay built in ===gen3=== the Goal release, Probably an upgrade of gen2. It supports the steering wheel and foot pedals |
== A Note about Licenses == Any Code found in the svn.ucc.asn.au:8080/oxinabox/ repository is not release for public or public use, or veiwing. These Links are for internal use of BobTech only. All Rights Reserved Lyndon "Frames" White, including the right to reliscense. Liscense for release is Pending. All Files in that Repository are the Sole Property of Lyndon "Frames" White and or BobTech |
Controlling the LURC
The first version of the 'front end' is basically a serial program running on the bifferboard, controlled over ssh. There are a few things we can use to send hex values from the linux command line. The first is minicom, which is hard to learn and was designed more for modems than byte banging. Minicom also requires you to do some fancy piping to make it output hex. The second option, which is simple and works, is python serial. As python has a command line interpreter, it's very quick and easy to do (example is below). The third option is a program written in by LyndonWhite called gen1 which uses c++ libserial. This also works, but hasn't been extensively tested. The source for gen1 is in the project repo on the main page. Instructions and some documentation is also below.
== A Note about Licenses== Any Code found in the svn.ucc.asn.au:8080/oxinabox/ is note release for public or public use, or veiwing. All Rights Reserved Lyndon "Frames" White, including the right to reliscense. Liscense for release is Pending. All Files in that Repository are Property of Lyndon "Frames" White and or BobTech
formatted string containing value expressions
Before I start on actual programs an explanation of: "formatted string containing value expressions" and how to encode values in them.
The formatted string containing value expressions is at the core of doing low level transmission. We know the decimal 65, hex 41, binary 0100 0001, and the ascii character 'A' all have the same binary representation, so to tell which we are using we have a series of deliminators - numbers preceded by:
# are decimal
$ are Hex
@ are binary
No deliminator, then ascii.
Putting a sign indicator after the deliminator is optional. It is required if you want to send a negative number.
You may put muliple values in the same string. eg: "a#21@1001111$-0F"
All values in a formatted string containing value expressions must be in the range -128 to 255 (inclusive) as they must fit in 8bytes (other values will cause an error). Negative numbers have the compliment of 2 representation for their binary form.
There are some problems with ascii - characters that can't be sent (in future versions this will be fixed by giving ascii a delineator and some more code to make that deliminator work, I think).
Characters that can't be sent:
- The delineator characters: $#@
- Numbers written immediately after a value that could have contained those digits:
- 0,1,2,3,4,5,6,7,8,9 for decimal
- 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,A,B,C,D,E,F for hex
- 0,1 for binary
The code for this is normally in str2num.c[pp] (pipedream has it in its main (only file), bad coding practice I know)
Note: the Python (pySerial) Method uses a differnt way of deliminating various values, please see the Python Documentation for details the formatted string containing value expressions is only for PipeDream/Gen1
Minicom + PipeDream
Software Requirements
- minicom (or picocom or microcom, but these instructions are for minicom)
pipedream: http://svn.ucc.asn.au:8080/oxinabox/LURC/gen1/examplesAndTestCode/Pipedream/
you may need to compile pipedream: g++ -o pipedream pipedream.cpp
About Pipedream
Pipedream is a direct derivative of str2Num.c[pp] (a twig , branching from a twig). It's basically str2Num made into a program. As such, it may refers to itself as str2num inside the source files (which you should read, they have some documentation in them)
How Pipedream works/how to use pipedream
Pipedream is a command line app that takes two parameters:
- A filename which is to be ignored (this is to get around minicom's desire to send files, using protocols)
A formatted string containing value expressions (see above). If this parameter has a hash (#) in it you will need to put the whole string in quotes (" "), otherwise zsh will treat everything after the # as a comment, and won't pass it as a parameter.
Similarly for spaces, if there's a space in the parameter, put the whole parameter in quotes
Pipedream converts that string into its values, and then writes them to stdout. Any errors are written to stderr, and the program terminates.
Using Pipedream with minicom
First start minicom: minicom -o Check the settings are ok: port: /dev/ttyS0, Baud: 19200bps, 8N1. Now we need to set up minicom to use pipedream as a protocol. Press Ctrl-a, z to bring up the menu, then O to access configure minicom. (you could immediately press Ctrl-a, O). You can also check the port settings while you are here. Then go down to protocols and add it as a protocol - match the settings used for the ascii protocol already there, except the name will be pipedream, and the path is the path to the pipedream executable (if your started minicom in the pipedream folder then this is ./pipedream). While still in this "window", change the setting "use window for file selection" to No. Exit all menus.
Now pipedream has been set as a protocol for sending. This means that it's stdout has been redirected to the serial port, and that its stderr has been redirected to your screen.
Now send something with pipedream: Press Ctrl-A, S and select the pipedream protocol. Now you are asked for a file, give the path to any file, (I suggest making one in the folder you are in before you start minicom). Then put a space, and type the other parameter, the formatted string containing value expressions (see above)
Python Serial
Fire up python from command line and type the following (note you have to have python serial installed):
The final write command will send 0xd2 then 0x80, which in our case is used to turn the motor on.
Gen1
gen1 is the first program built expressly for communicating with the AVR SerialComms (the so called "Oxinabox Lightweight Serial Protocol for Long-Range University of Western Australia Computer Club Cars). It doesn't do anything special, just sends the values of formatted strings containing value expressions out a serial port.
Software required:
gen1: http://svn.ucc.asn.au:8080/oxinabox/LURC/gen1/gen1Source/. You may need to build it - just use the make command.
Start it with sudo ./gen1
It takes 1 parameter, the device name for the port you want to transmit on. Once it gets started, you can type in formatted strings containing value expressions and then press enter and it will send them, and then be ready to go again.
Gen1.5
Gen1.5 will also recognise Commands as detailed in cmdTable.h, but that's a future release.
Gen2
The first release that does not run directly on the bifferboard. May have an ssh built into it, to communicate with gen1.5, on the bifferboard. Has a GUI, and the webcam diplay built in.
Gen3
The Goal release, probably an upgrade of gen2. It supports the steering wheel and foot pedals.
A Note about Licenses
Any Code found in the svn.ucc.asn.au:8080/oxinabox/ repository is not release for public or public use, or veiwing. These Links are for internal use of BobTech only. All Rights Reserved Lyndon "Frames" White, including the right to reliscense. Liscense for release is Pending. All Files in that Repository are the Sole Property of Lyndon "Frames" White and or BobTech