LV2 Development Environment
Hey everyone, please put info on the development environment here. Finally, I'd like to see sub-pages linked from here for scripts.
- See OrinocoWirelessSetup for some rocket-compatible wireless card settings.
Standard PSAS Development Platform
- Debian GNU/Linux for x86
- The testing version (currently known as etch)
- See http://www.debian.org/
- GLIBC 2.3.2 or later
- A 2.4.X kernel, with pcmcia drivers and wireless-tools, if you want to have any hope of talking to the Flight or Launch Tower Computers via wireless. The packages presently are:
- kernel-image-2.4-686 (or -586tsc if you have a pentium MMX or older, or -k6 for AMD, or...)
- kernel-pcmcia-modules-2.4.20-3-686 (or -586tsc, etc.)
- wireless-tools
- Cross-compiled for 486 (for Flight & Launch Tower Computer anyway)
- To work on the Linux CAN driver, you must install
kernel-headers-2.4.18
. This is no longer generally available, but you can copypsas.pdx.edu:/usr/src/rocket-2.4.18/include
from the PSAS server.
- To work on the Linux CAN driver, you must install
- Java 2 Blackdown SDK v. 1.3. This is Debian package
j2sdk1.3
- gotten by adding this to your
/etc/apt/sources.list
file: deb ftp://metalab.unc.edu/pub/linux/devel/lang/java/blackdown.org/debian testing main non-free
- Then do
apt-get update
followed byapt-get install j2sdk1.3
- gotten by adding this to your
- Ant (used rather than 'make' to build the Java source).
apt-get install ant
should do the trick, then set up your~/.antrc
as explained in thepsas/java/Read.me
file.
- gcc 3.3
- this is now standard with Debian testing. We've been using 2.95 but we really ought to upgrade.
- GNU readline library
apt-get install libreadline5-dev
Other Platforms
Windows users might be able to use Cygwin and a Windows version of SVN. However, we do not recommend that people doing flight computer/launch tower development work use a non-standard platform for development work. Java folks can probably get away with non-standard platforms like Windows or MacOS.
Building the software
First, check out the "java" and "c" modules from the PSAS SVN repository. Then, build the C code (flight computer, rocket simulators, etc.) and java code (RocketView/LaunchControl).
Simulating the FC
For development purposes, it is important to be able to test the flight computer software without any special hardware. Simulating the CAN bus requires some special software, but the details have been encapsulated into a shell script. If you have a CANtalope hardware node and other CAN nodes that you want to test with, this script can connect those to the simulated CAN bus as well.
In either case, you must once run these commands as root:
ln -s /tmp/can0 /dev/can0
ln -s /tmp /var/log/psas
The flight computer expects to find its interface to the CAN bus at /dev/can0, and the flight computer log will be written into the directory /var/log/psas. The above commands redirect those to /tmp, where non-root users can create files. Note that you should not create /tmp/can0 yourself; the simulator will create an appropriate file every time it runs.
You also need to install a program called "socat", available in a Debian package by the same name. (Previous versions of these instructions referred to the "pity" program in our CVS. socat is a much better implementation of the basic ideas of "pity".)
I've only tested the simulation in X. I coded some stuff that was supposed to let you do the same things in a "screen" session or on a virtual terminal, but these are untested and probably don't work. Unless you're prepared to debug my shell script, please run it from an xterm or equivalent.
-- ?JameySharp - 19 Aug 2004
One final note: receipt of messages from any of the sources in the simulation (UDP or CAN) can only be done by one process at a time. However, the UDP broadcasts will be sent out on a real network as well, where all other attached computers could listen to them. If you really want to monitor UDP output with several programs at once, you might consider using several networked computers. Otherwise, understand that you will get errors if you try to use CANtalope in read mode, TestNetRecv, or other tools more than once. As many processes as you want may be writing messages simulataneously, though.
Running the simulation
Run these commands:
cd <psasroot>/c/tools
./fc-sim.sh
The shell script will open two xterms:
- "FC via UDP", for messages across a simulated network
- "FC via CAN", for messages across a simulated CAN bus
The flight computer software itself will run in the window that you started the script from. Typing ctrl-c in that window will kill all processes in the simulation.
Running the simulation software without root privileges
If you would like to run the simulation on a machine where you do not have root privleges, you can do so by setting the DEBUG environment variable to a non-zero value before running fc-sim.sh. This will point the LOGDIR, CAN_DEVICE, and IMU_CAN_DEVICE environment variables to $TMP (which will default to /tmp unless it is set). As a result, no links will need to be created in /dev.
Simulation plus hardware
If you have a CANtalope node, note which serial device it is attached to (perhaps /dev/ttyS0 or /dev/ttyUSB0). Then run:
cd <psasroot>/c/tools
./fc-sim.sh <serial-device>
The shell script will open four xterms:
- "FC via UDP", for messages across a simulated network
- "monitor: < to hardware; > to FC", to watch messages sent between the CANtalope node and the flight computer
"to FC", to send messages via the simulated CAN bus to the flight computer
"to hardware", to send messages via the simulated CAN bus to the CANtalope node
The flight computer software itself will run in the window that you started the script from. Typing ctrl-c in that window will kill all processes in the simulation.
Watching the simulation
To run rocketview and watch your simulation, type:
cd <psasroot>/java
java -jar dist/rocketview.jar
This will bring up RocketView, which watches on a UDP port for rocket messages -- it can remain on between simulator runs, or be started after a simulator run starts, without problems. To add the launch control to it, append any argument you want after "dist/rocketview.jar". Note that you will likely have to edit the main.conf from /src/launchcontrol/main.conf and have it in your local directory.