#!/bin/sh
-WINDOW=YES
+if [ $1 = "--full" ]; then
+ echo "Running full screen ..."
+ shift
+ WINDOW=NO
+else
+ echo "Running in a window, use --full to run full screen."
+ WINDOW=YES
+fi
+echo
if [ $WINDOW = "YES" ]; then
# in a window (slow hack)
// get roll and pitch, convert to degrees
double roll_deg = f->get_Phi() * RAD_TO_DEG;
- while ( roll_deg < 0.0 ) {
+ while ( roll_deg < -180.0 ) {
roll_deg += 360.0;
}
- while ( roll_deg > 360.0 ) {
+ while ( roll_deg > 180.0 ) {
roll_deg -= 360.0;
}
double pitch_deg = f->get_Theta() * RAD_TO_DEG;
- while ( pitch_deg < 0.0 ) {
+ while ( pitch_deg < -180.0 ) {
pitch_deg += 360.0;
}
- while ( pitch_deg > 360.0 ) {
+ while ( pitch_deg > 180.0 ) {
pitch_deg -= 360.0;
}
// scale roll and pitch to output format (1 - 255)
- int roll = (int)(roll_deg * 254.0 / 359.0) + 1;
- int pitch = (int)(pitch_deg * 254.0 / 359.0) + 1;
+ // straight && level == (128, 128)
+
+ int roll = (int)( (roll_deg+180.0) * 255.0 / 360.0) + 1;
+ int pitch = (int)( (pitch_deg+180.0) * 255.0 / 360.0) + 1;
sprintf( rul, "p%c%c\n", roll, pitch);
- FG_LOG( FG_SERIAL, FG_DEBUG, "p " << roll << " " << pitch );
+ FG_LOG( FG_SERIAL, FG_INFO, "p " << roll << " " << pitch );
string rul_sentence = rul;
p->port.write_port(rul_sentence);
REM @ECHO OFF\r
\r
-REM Skip ahead to RUN1 if %FG_ROOT%\BIN\FGFS.EXE exists\r
-IF EXIST %FG_ROOT%\BIN\FGFS.EXE GOTO RUN1\r
+REM Skip ahead to CONT1 if FG_ROOT has a value\r
+IF NOT %FG_ROOT%.==. GOTO CONT1\r
\r
-REM %FG_ROOT% wasn't set right so let's try "."\r
SET FG_ROOT=.\r
-IF EXIST %FG_ROOT%\BIN\FGFS.EXE GOTO RUN1\r
\r
-REM %FG_ROOT% wasn't set right so let's try ".."\r
-SET FG_ROOT=..\r
-IF EXIST %FG_ROOT%\BIN\FGFS.EXE GOTO RUN1\r
+:CONT1\r
\r
-REM %FG_ROOT% wasn't set right so let's try "@prefix@"\r
-SET FG_ROOT=@prefix@\r
-IF EXIST %FG_ROOT%\BIN\FGFS.EXE GOTO RUN1\r
+REM Check for the existance of the executable\r
+IF NOT EXIST %FG_ROOT%\BIN\FGFS.EXE GOTO ERROR1\r
\r
-ECHO Cannot find %FG_ROOT%\BIN\FGFS.EXE\r
-GOTO END\r
-\r
-:RUN1\r
REM Now that FG_ROOT has been set, run the program\r
ECHO FG_ROOT = %FG_ROOT%\r
%FG_ROOT%\BIN\FGFS.EXE %1 %2 %3 %4 %5 %6 %7 %8 %9\r
\r
GOTO END\r
\r
+:ERROR1\r
+ECHO Cannot find %FG_ROOT%\BIN\FGFS.EXE\r
+GOTO END\r
+\r
:END\r