f = ¤t_aircraft.flight;
c = ¤t_aircraft.controls;
- printf("Pos = (%.2f,%.2f,%.2f) Dir = %.2f Mach = %.2f\n",
+ printf("Pos = (%.2f,%.2f,%.2f) (Phi,Theta,Psi)=(%.2f,%.2f,%.2f)\n",
FG_RAD_2_DEG(FG_Longitude) * 3600.0,
FG_RAD_2_DEG(FG_Latitude) * 3600.0,
- FG_Altitude, FG_Psi, FG_Mach_number);
- printf("Elev = %.2f, Aileron = %.2f, Rudder = %.2f\n",
- c->elev, c->aileron, c->rudder);
+ FG_Altitude, FG_Phi, FG_Theta, FG_Psi);
+ printf("Mach = %.2f Elev = %.2f, Aileron = %.2f, Rudder = %.2f\n",
+ FG_Mach_number, c->elev, c->aileron, c->rudder);
}
/* $Log$
-/* Revision 1.4 1997/05/30 03:54:11 curt
-/* Made a bit more progress towards integrating the LaRCsim flight model.
+/* Revision 1.5 1997/05/30 19:30:14 curt
+/* The LaRCsim flight model is starting to look like it is working.
/*
+ * Revision 1.4 1997/05/30 03:54:11 curt
+ * Made a bit more progress towards integrating the LaRCsim flight model.
+ *
* Revision 1.3 1997/05/29 22:39:56 curt
* Working on incorporating the LaRCsim flight model.
*
int ls_cockpit() {
sim_control_.paused = 0;
- Throttle_pct = 0.99;
+ Throttle_pct = 0.95;
/* printf("Mach = %.2f ", Mach_number);
printf("%.4f,%.4f,%.2f ", Latitude, Longitude, Altitude);
/* Flight Gear Modification Log
*
* $Log$
+ * Revision 1.4 1997/05/30 19:30:15 curt
+ * The LaRCsim flight model is starting to look like it is working.
+ *
* Revision 1.3 1997/05/30 03:54:12 curt
* Made a bit more progress towards integrating the LaRCsim flight model.
*
#include "../aircraft/aircraft.h"
#include "../scenery/scenery.h"
+#include "../mat3/mat3.h"
+
#define FG_RAD_2_DEG(RAD) ((RAD) * 180.0 / M_PI)
#define FG_DEG_2_RAD(DEG) ((DEG) * M_PI / 180.0)
static void fgUpdateViewParams() {
double pos_x, pos_y, pos_z;
struct flight_params *f;
+ MAT3mat R, tmp;
+ MAT3vec vec, forward, up;
f = ¤t_aircraft.flight;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
+ /* calculate position in arc seconds */
pos_x = FG_RAD_2_DEG(FG_Longitude) * 3600.0;
pos_y = FG_RAD_2_DEG(FG_Latitude) * 3600.0;
pos_z = FG_Altitude * 0.01; /* (Convert feet to aproximate arcsecs) */
- glRotatef(FG_Phi, 1.0, 0.0, 0.0);
- glRotatef(FG_Theta, 0.0, 1.0, 0.0);
- glRotatef(FG_Psi, 0.0, 0.0, 1.0);
+ /* build current rotation matrix */
+ MAT3_SET_VEC(vec, 1.0, 0.0, 0.0);
+ MAT3rotate(R, vec, FG_Phi);
+ /* printf("Roll matrix\n"); */
+ /* MAT3print(R, stdout); */
+
+ MAT3_SET_VEC(vec, 0.0, -1.0, 0.0);
+ MAT3rotate(tmp, vec, FG_Theta);
+ /* printf("Pitch matrix\n"); */
+ /* MAT3print(tmp, stdout); */
+ MAT3mult(R, R, tmp);
+
+ MAT3_SET_VEC(vec, 0.0, 0.0, -1.0);
+ MAT3rotate(tmp, vec, M_PI + M_PI_2 + FG_Psi );
+ /* printf("Yaw matrix\n");
+ MAT3print(tmp, stdout); */
+ MAT3mult(R, R, tmp);
+
+ /* MAT3print(R, stdout); */
+
+ /* generate the current forward and up vectors */
+ MAT3_SET_VEC(vec, 1.0, 0.0, 0.0);
+ MAT3mult_vec(forward, vec, R);
+ printf("Forward vector is (%.2f,%.2f,%.2f)\n", forward[0], forward[1],
+ forward[2]);
+ MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
+ MAT3mult_vec(up, vec, R);
gluLookAt(pos_x, pos_y, pos_z,
- pos_x + 1.0, pos_y, pos_z,
- 0.0, 0.0, 1.0);
+ pos_x + forward[0], pos_y + forward[1], pos_z + forward[2],
+ up[0], up[1], up[2]);
}
/* Initial Orientation */
FG_Phi = -2.658474E-06;
FG_Theta = 7.401790E-03;
- FG_Psi = 4.38;
+ FG_Psi = 2.14 /* 4.38 */;
/* Initial Angular B rates */
FG_P_body = 7.206685E-05;
/* $Log$
-/* Revision 1.8 1997/05/30 03:54:10 curt
-/* Made a bit more progress towards integrating the LaRCsim flight model.
+/* Revision 1.9 1997/05/30 19:27:01 curt
+/* The LaRCsim flight model is starting to look like it is working.
/*
+ * Revision 1.8 1997/05/30 03:54:10 curt
+ * Made a bit more progress towards integrating the LaRCsim flight model.
+ *
* Revision 1.7 1997/05/29 22:39:49 curt
* Working on incorporating the LaRCsim flight model.
*
CFILES = GLmain.c $(INTERFACE_FILES) mesh2GL.c
OFILES = $(CFILES:.c=.o)
-AFILES = ../flight/libflight.a ../flight/slew/libslew.a \
- ../flight/LaRCsim/libLaRCsim.a ../aircraft/libaircraft.a \
- ../scenery/libscenery.a
-
+AFILES = ../aircraft/libaircraft.a ../flight/libflight.a \
+ ../flight/LaRCsim/libLaRCsim.a ../flight/slew/libslew.a \
+ ../mat3/libmat3.a ../scenery/libscenery.a
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
# $Log$
+# Revision 1.8 1997/05/30 19:27:02 curt
+# The LaRCsim flight model is starting to look like it is working.
+#
# Revision 1.7 1997/05/29 22:39:50 curt
# Working on incorporating the LaRCsim flight model.
#
#endif
#include "../scenery/mesh.h"
-#include "mat3.h"
-
-
-/* Sets the first vector to be the cross-product of the last two
- vectors. */
-static void mat3_cross_product(float result_vec[3], register float vec1[3],
- register float vec2[3]) {
- float tempvec[3];
- register float *temp = tempvec;
-
- temp[0] = vec1[1] * vec2[2] - vec1[2] * vec2[1];
- temp[1] = vec1[2] * vec2[0] - vec1[0] * vec2[2];
- temp[2] = vec1[0] * vec2[1] - vec1[1] * vec2[0];
-
- MAT3_COPY_VEC(result_vec, temp);
-}
+#include "../mat3/mat3.h"
/* walk through mesh and make ogl calls */
GLint mesh;
float x1, y1, x2, y2, z11, z12, z21, z22;
- float v1[3], v2[3], normal[3];
+ MAT3vec v1, v2, normal;
int i, j, istep, jstep, iend, jend;
float temp;
- istep = jstep = 25; /* Detail level 1 -- 1200 ... */
+ istep = jstep = 10; /* Detail level 1 -- 1200 ... */
mesh = glGenLists(1);
glNewList(mesh, GL_COMPILE);
v1[0] = x2 - x1; v1[1] = 0; v1[2] = z21 - z11;
v2[0] = 0; v2[1] = y2 - y1; v2[2] = z12 - z11;
- mat3_cross_product(normal, v1, v2);
+ MAT3cross_product(normal, v1, v2);
MAT3_NORMALIZE_VEC(normal,temp);
- glNormal3fv(normal);
+ glNormal3d(normal[0], normal[1], normal[2]);
if ( j == 0 ) {
/* first time through */
- glVertex3f(x1, y1, z11);
- glVertex3f(x1, y2, z12);
+ glVertex3f(x1, y1, z11-45);
+ glVertex3f(x1, y2, z12-45);
}
- glVertex3f(x2, y1, z21);
+ glVertex3f(x2, y1, z21-45);
v1[0] = x2 - x1; v1[1] = y1 - y2; v1[2] = z21 - z12;
v2[0] = x2 - x1; v2[1] = 0; v2[2] = z22 - z12;
- mat3_cross_product(normal, v1, v2);
+ MAT3cross_product(normal, v1, v2);
MAT3_NORMALIZE_VEC(normal,temp);
- glNormal3fv(normal);
- glVertex3f(x2, y2, z22);
+ glNormal3d(normal[0], normal[1], normal[2]);
+ glVertex3f(x2, y2, z22-45);
x1 = x2;
x2 = x1 + (m->row_step * jstep);
/* $Log$
-/* Revision 1.10 1997/05/30 03:54:11 curt
-/* Made a bit more progress towards integrating the LaRCsim flight model.
+/* Revision 1.11 1997/05/30 19:27:02 curt
+/* The LaRCsim flight model is starting to look like it is working.
/*
+ * Revision 1.10 1997/05/30 03:54:11 curt
+ * Made a bit more progress towards integrating the LaRCsim flight model.
+ *
* Revision 1.9 1997/05/29 22:39:51 curt
* Working on incorporating the LaRCsim flight model.
*
$dem_x1 =~ s/D/E/; $dem_x1 += 0.0;
$dem_y1 =~ s/D/E/; $dem_y1 += 0.0;
print " // This mesh is rooted at the following coordinates (in arc seconds)\n";
- print " origin_lat = $dem_x1\n";
- print " origin_lon = $dem_y1\n";
+ print " origin_lon = $dem_x1\n";
+ print " origin_lat = $dem_y1\n";
print "\n";
print " // Number of rows and columns (needed by the parser so it can create\n";
#---------------------------------------------------------------------------
# $Log$
+# Revision 1.2 1997/05/30 19:30:16 curt
+# The LaRCsim flight model is starting to look like it is working.
+#
# Revision 1.1 1997/05/27 21:56:02 curt
# Initial revision (with data skipping support)
#
void mesh_set_option_value(struct mesh *m, char *value) {
printf("Setting %s to %s\n", m->option_name, value);
- if ( strcmp(m->option_name, "origin_lat") == 0 ) {
+ if ( strcmp(m->option_name, "origin_lon") == 0 ) {
m->originx = atof(value);
- } else if ( strcmp(m->option_name, "origin_lon") == 0 ) {
+ } else if ( strcmp(m->option_name, "origin_lat") == 0 ) {
m->originy = atof(value);
} else if ( strcmp(m->option_name, "rows") == 0 ) {
m->rows = atoi(value);
/* $Log$
-/* Revision 1.3 1997/05/23 15:40:41 curt
-/* Added GNU copyright headers.
+/* Revision 1.4 1997/05/30 19:30:17 curt
+/* The LaRCsim flight model is starting to look like it is working.
/*
+ * Revision 1.3 1997/05/23 15:40:41 curt
+ * Added GNU copyright headers.
+ *
* Revision 1.2 1997/05/19 18:20:50 curt
* Slight change to origin key words.
*
SUBSUBDIRS = flight/LaRCsim flight/slew
-SUBDIRS = aircraft controls flight scenery
+SUBDIRS = aircraft controls flight mat3 scenery
MAIN = OpenGL
#---------------------------------------------------------------------------
# $Log$
+# Revision 1.5 1997/05/30 19:26:56 curt
+# The LaRCsim flight model is starting to look like it is working.
+#
# Revision 1.4 1997/05/29 02:31:43 curt
# Update subdirectory structure.
#