Hi,

Last week (maybe two) i was able to create a path for the plane to fly 
using the following code:

void AgentUAV::processWaypointsTable( string flightPathTable )
{
  double lon, lat;                              
  string query = "select NumPoints(the_geom) from " + 
  flightPathTable + " where id = 2;";
  cout << "query: " << query << endl;
  PGresult *resultSet = dbInterface->dbQuery( query.c_str() );
 
  int numPoints = atoi( PQgetvalue( resultSet, 0, 0 ) );
  int alt = 2000;
  string id;
  cout << "numPoints: " << numPoints << endl;

  FGRouteMgr *rm = (FGRouteMgr *)globals->get_subsystem("route-manager");
  SGWayPoint *wp = NULL;

  for( int point = 1; point <= numPoints; point++ )
  {
    char pointChar[256];
    sprintf(pointChar, "%d", point);
    string pointString(pointChar);
    query = "select x(PointN(the_geom,"+ pointString +
      ")), y(PointN(the_geom,"+ pointString +
      ")) from "+flightPathTable+";";
    cout << "query: " << query << endl;
    resultSet = dbInterface->dbQuery( query.c_str() );
    lon = atof( PQgetvalue( resultSet, 1, 0 ) );
    lat = atof( PQgetvalue( resultSet, 1, 1 ) );

    cout << "lon = " << lon << ", lat = " << lat << endl;
    id = flightPathTable + "_" + pointString;
    wp = new SGWayPoint( lon, lat, alt, SGWayPoint::WGS84, id );
    rm->add_waypoint( *wp );
  }
        
  fgSetString( "/autopilot/locks/heading", "true-heading-hold" );
  cout << "route size: " << rm->size() << endl;
}


Lots of the code is not important to you.  Essentially i pull the (lon, 
lat) points from the database and add them to the SGWayPoint.

Upon running my code after a cvs update the planes no longer follow the 
path but instead fly in tight circles until the plane eventually crashes.
I cant seem to find the change that has occured to cause this effect.

Has there been any changes to the autopilot or the FGWaypoint that may 
have caused this problem?

Any help is greatly appreciated,

Seamus


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to