From fa3cbdb2f8c978425ad3281bb4f1ec385ea61afb Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 15 Jun 2000 22:31:40 +0000 Subject: [PATCH] Updates from Alex for his motion chair project. --- src/Network/ray.cxx | 23 ++++++++++++----------- src/Network/ray.hxx | 1 + 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Network/ray.cxx b/src/Network/ray.cxx index 749a9629b..917cd7545 100644 --- a/src/Network/ray.cxx +++ b/src/Network/ray.cxx @@ -37,6 +37,8 @@ FGRAY::FGRAY() { chair_heading = 0.0; chair_vertical[0] = 0.0; chair_vertical[1] = 0.0; +// chair_FILE = stderr; + chair_FILE = 0; } @@ -86,7 +88,7 @@ bool FGRAY::gen_message() { lin_acc = f->get_A_Y_pilot() * 0.3; break; case 1: ang_pos = f->get_Theta(); - lin_acc =-f->get_A_X_pilot() * 0.3; + lin_acc = f->get_A_X_pilot() * 0.3; break; case 2: ang_pos = f->get_Psi(); lin_acc = grav_acc - vert_acc; @@ -106,9 +108,11 @@ bool FGRAY::gen_message() { } /* Tell interested parties what the situation is */ - printf ( "RAY %s, %8.3f rad %8.3f m/s/s =>", - ((axis==0)?"Roll ":((axis==1)?"Pitch":"Yaw ")), - ang_pos, lin_acc ); + if (chair_FILE) { + fprintf ( chair_FILE, "RAY %s, %8.3f rad %8.3f m/s/s =>", + ((axis==0)?"Roll ":((axis==1)?"Pitch":"Yaw ")), + ang_pos, lin_acc ); + } /* The upward direction and axis are special cases */ if ( axis == 2 ) @@ -153,8 +157,10 @@ bool FGRAY::gen_message() { } /* Tell interested parties what we'll do */ - printf ( " %8.3f deg %8.3f cm.\n", - ang_pos * 60.0, lin_pos * 100.0 ); + if ( chair_FILE ) { + fprintf ( chair_FILE, " %8.3f deg %8.3f cm.\n", + ang_pos * 60.0, lin_pos * 100.0 ); + } /* Write the resulting numbers to the command buffer */ /* The first pass number is linear, second pass is angle */ @@ -180,11 +186,6 @@ bool FGRAY::gen_message() { /* Tell the caller what we did */ length = 18; - /* Log bytes for debug */ -// for ( axis = 0; axis < length; axis++ ) -// printf ( "%02x ", (unsigned int) (unsigned char) buf[axis] ); -// printf ( "\n" ); - return true; } diff --git a/src/Network/ray.hxx b/src/Network/ray.hxx index 1739ef022..8343b604d 100644 --- a/src/Network/ray.hxx +++ b/src/Network/ray.hxx @@ -43,6 +43,7 @@ class FGRAY : public FGProtocol { double chair_rising; double chair_height; double chair_vertical[2]; + FILE *chair_FILE; public: -- 2.39.5