Updates from Alex for his motion chair project.
This commit is contained in:
parent
fb8baab76d
commit
fa3cbdb2f8
2 changed files with 13 additions and 11 deletions
|
@ -37,6 +37,8 @@ FGRAY::FGRAY() {
|
||||||
chair_heading = 0.0;
|
chair_heading = 0.0;
|
||||||
chair_vertical[0] = 0.0;
|
chair_vertical[0] = 0.0;
|
||||||
chair_vertical[1] = 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;
|
lin_acc = f->get_A_Y_pilot() * 0.3;
|
||||||
break;
|
break;
|
||||||
case 1: ang_pos = f->get_Theta();
|
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;
|
break;
|
||||||
case 2: ang_pos = f->get_Psi();
|
case 2: ang_pos = f->get_Psi();
|
||||||
lin_acc = grav_acc - vert_acc;
|
lin_acc = grav_acc - vert_acc;
|
||||||
|
@ -106,9 +108,11 @@ bool FGRAY::gen_message() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell interested parties what the situation is */
|
/* Tell interested parties what the situation is */
|
||||||
printf ( "RAY %s, %8.3f rad %8.3f m/s/s =>",
|
if (chair_FILE) {
|
||||||
((axis==0)?"Roll ":((axis==1)?"Pitch":"Yaw ")),
|
fprintf ( chair_FILE, "RAY %s, %8.3f rad %8.3f m/s/s =>",
|
||||||
ang_pos, lin_acc );
|
((axis==0)?"Roll ":((axis==1)?"Pitch":"Yaw ")),
|
||||||
|
ang_pos, lin_acc );
|
||||||
|
}
|
||||||
|
|
||||||
/* The upward direction and axis are special cases */
|
/* The upward direction and axis are special cases */
|
||||||
if ( axis == 2 )
|
if ( axis == 2 )
|
||||||
|
@ -153,8 +157,10 @@ bool FGRAY::gen_message() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell interested parties what we'll do */
|
/* Tell interested parties what we'll do */
|
||||||
printf ( " %8.3f deg %8.3f cm.\n",
|
if ( chair_FILE ) {
|
||||||
ang_pos * 60.0, lin_pos * 100.0 );
|
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 */
|
/* Write the resulting numbers to the command buffer */
|
||||||
/* The first pass number is linear, second pass is angle */
|
/* The first pass number is linear, second pass is angle */
|
||||||
|
@ -180,11 +186,6 @@ bool FGRAY::gen_message() {
|
||||||
/* Tell the caller what we did */
|
/* Tell the caller what we did */
|
||||||
length = 18;
|
length = 18;
|
||||||
|
|
||||||
/* Log bytes for debug */
|
|
||||||
// for ( axis = 0; axis < length; axis++ )
|
|
||||||
// printf ( "%02x ", (unsigned int) (unsigned char) buf[axis] );
|
|
||||||
// printf ( "\n" );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ class FGRAY : public FGProtocol {
|
||||||
double chair_rising;
|
double chair_rising;
|
||||||
double chair_height;
|
double chair_height;
|
||||||
double chair_vertical[2];
|
double chair_vertical[2];
|
||||||
|
FILE *chair_FILE;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue