PSAS/ DevelopmentEnvironmentForLv2

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.

Standard PSAS Development Platform

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

The shell script will open two xterms:

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 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
./ <serial-device>

The shell script will open four xterms:

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.