|
Interfacing with a "buddy box"
Electrically interfacing with this is quite simple. Eriq Jaakkola has details on building a Futaba <--> TTL converter with pinouts for the training port. We use the transistor driver circuit, but don't connect it to the parallel port of our computer. Decoding the pulses is a real-time intensive activity, so we offload that to an embedded microcontroller.
Our software to do this for the ATmega163 on our Rev 1 IMU boards is available from onboard/src/joystick.c. The main loop of the routine looks like this: wait_for_sync_pulse(); while( get_pulse() != sync_pulse ) push pulse_width; print pulse_widths; According to Risto Koiva's details, the sync pulse is 10ms or longer. The data pulses are similar to the actual servo encoding format, which specifies the servo position as a PWM signal. Since the data pulses are a maximum of 2 ms, this makes detecting the sync pulse fairly easy. Currently, the system provides an interface similar to our sim/joystick.c Linux kernel interface. The source code for mapping the output of our onboard program to 'struct js_event' values is in sim/trainer.c.
The IMU board is overkill for this small application. We plan to design
and build a smaller AVR based board that will provide the same interface
to the trainer port. This stand-alone board will be useful for both
data collection flights and flying in the simulator. A preliminary
version for the ATtiny12 written in assembly is in
onboard/src/tinystick.S
and the software UART is in
onboard/src/uart.S.
|
$Id: trainer.html,v 1.8 2002/08/05 03:44:39 tramm Exp $ |