Differences between revisions 5 and 6
Revision 5 as of 2010-02-21 12:33:16
Size: 6516
Editor: BobAdamson
Comment:
Revision 6 as of 2010-02-21 12:51:56
Size: 5379
Editor: LyndonWhite
Comment: created page
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#format wiki
#language en
==LURC Front End Software==
Line 4: Line 3:
= 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.

== 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/
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:
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

It 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 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.
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 it's stderr has been redirected to you screen.

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"

== pyserial ==
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.

=== formatted string containing value expressions ===
==formatted string containing value expressions==
Line 96: Line 37:
=== Software required: ===
===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/
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:
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

It 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 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.
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 it's stderr has been redirected to you screen.

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"



===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:===
Line 108: Line 97:
=== gen1.5 ===
===gen1.5===
Line 112: Line 102:
=== gen2 ===
===gen2===
Line 117: Line 108:
=== gen3 === ===gen3===

==LURC Front End Software==

==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 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.

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 there 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). 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

the code for this is normally in str2num.c[pp] (pipedream has it in its main (only file), bade coding practice I know)

===Minicom + PipeDream=== ====software req:====

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: 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

It 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 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. 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 it's stderr has been redirected to you screen.

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"

===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