Software zur Erkennung von "Spam" auf dem Rechner

    postrobot.de

hat die eingegangene E-mail als mögliche "Spam"-Nachricht identifiziert.
Die ursprüngliche Nachricht wurde an diesen Bericht angehängt, so dass
Sie sie anschauen können (falls es doch eine legitime E-Mail ist) oder
ähnliche unerwünschte Nachrichten in Zukunft markieren können.
Bei Fragen zu diesem Vorgang wenden Sie sich bitte an

    [EMAIL PROTECTED]

Vorschau: Hello list, attached is a patch for the osg-branch,
  which will introduce a new pseudo FDM for ground vehicles and (large)
  ships. The FDM isn't perfect, but good enough to allow driving vehicles.
  The other archieve contains a dataset for such a vehicle named Nimitz.
  Untar it to $(FG_ROOT)/Aircraft [...] 

Inhaltsanalyse im Detail:   (-1.1 Punkte, 5.0 benötigt)

Pkte Regelname              Beschreibung
---- ---------------------- --------------------------------------------------
-1.4 ALL_TRUSTED            Nachricht wurde nur über vertrauenswürdige Rechner
                            weitergeleitet
 0.4 AWL                    AWL: From: address is in the auto white-list



--- Begin Message ---
Hello list,

attached is a patch for the osg-branch, which will introduce a new pseudo FDM 
for ground vehicles and (large) ships. The FDM isn't perfect, but good enough 
to allow driving vehicles.
The other archieve contains a dataset for such a vehicle named Nimitz. Untar 
it to $(FG_ROOT)/Aircraft

After patching, a user is able to "drive" the nimitz: fgfs --aircraft=Nimitz

The patch includes my latest patch for the multiplayer part. Since it wasn't 
commited yet, I think it's ok to include it.

I'm not sure if I should proveide a patch for the plib-branch?

Feel free to send me any comments on this. Once the patch is commited, I want 
to start making the Nimitz MP-ready. So users can land and take-off from it.

Please commit it to cvs.

regards,
Oliver
? mp_bugfix.diff
? vehicle-fdm.patch
Index: src/FDM/Makefile.am
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/Makefile.am,v
retrieving revision 1.7
diff -u -r1.7 Makefile.am
--- src/FDM/Makefile.am	22 Nov 2004 10:10:33 -0000	1.7
+++ src/FDM/Makefile.am	19 Jun 2007 10:51:28 -0000
@@ -12,6 +12,7 @@
 libFlight_a_SOURCES = \
 	Balloon.cxx Balloon.h \
 	flight.cxx flight.hxx \
+	Vehicle.cxx Vehicle.hxx \
 	groundcache.cxx groundcache.hxx \
 	MagicCarpet.cxx MagicCarpet.hxx \
 	UFO.cxx UFO.hxx \
Index: src/FDM/Vehicle.cxx
===================================================================
RCS file: src/FDM/Vehicle.cxx
diff -N src/FDM/Vehicle.cxx
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/FDM/Vehicle.cxx	19 Jun 2007 10:51:29 -0000
@@ -0,0 +1,272 @@
+// Vehicle.cxx -- interface to the "Vehicle" pseudo flight model
+//
+// Written by Oliver Schroeder, started June 2007.
+//
+// Copyright (C) 2007  Oliver Schroeder
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+//
+// $Id:$
+
+//
+// This is a pseudo flight model for ground vehicles and ships.
+// It honors some simple values in the config file, which are:
+// max_accel : acceleration in m/(s^2)
+// max_speed : maximum speed in knots
+// type      : only "ship" is currently honored
+// bow_thrust: boolean, defines wether the vehicle (ship) has a bow
+//             thruster
+//
+// To define a vehicle, put something like:
+//
+//  <vehicle>
+//    <max_accel type="double">0.1158</max_accel>
+//    <max_speed type="double">35.0</max_speed>
+//    <type type="string">ship</type>
+//    <bow_thrust type="bool">true</bow_thrust>
+//  </vehicle>
+//
+//  in your vehicle-set.xml
+//
+
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <simgear/math/sg_geodesy.hxx>
+#include <simgear/math/point3d.hxx>
+#include <simgear/math/polar3d.hxx>
+
+#include <Aircraft/controls.hxx>
+#include <Scenery/scenery.hxx>
+#include <Main/globals.hxx>
+#include <Main/fg_props.hxx>
+
+#include "Vehicle.hxx"
+
+//////////////////////////////////////////////////////////////////////
+//
+// construct a vehicle
+//
+//////////////////////////////////////////////////////////////////////
+FGVehicle::FGVehicle( double dt ) {
+    m_speed         = 0.0;
+    m_last_throttle = 0.0;
+    m_accel_factor  = 1.0;
+    //
+    // get values from the property tree/environment
+    //
+    m_max_accel = fgGetDouble ("/vehicle/max_accel");
+    m_max_speed = fgGetDouble ("/vehicle/max_speed");
+    m_max_rpm   = fgGetDouble ("/vehicle/max_rpm");
+    m_min_rpm   = fgGetDouble ("/vehicle/min_rpm");
+    m_bow_thrust= fgGetBool   ("/vehicle/bow_thrust");
+    m_absolute_braking = fgGetDouble ("/vehicle/absolute_braking");
+    m_roll_resistance  = fgGetDouble ("/vehicle/roll_resistance");
+    m_vehicle_is_ship =
+      (strcmp (fgGetString ("/vehicle/type"), "ship") == 0);
+} // FGVehicle::FGVehicle()
+//////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////
+//
+//  standard destructor, nothing to do here
+//
+//////////////////////////////////////////////////////////////////////
+FGVehicle::~FGVehicle() {
+} // FGVehicle::~FGVehicle()
+//////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////
+//
+//  initialise the base class
+//
+//////////////////////////////////////////////////////////////////////
+void FGVehicle::init() {
+    common_init();
+} // FGVehicle::init()
+//////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////
+//
+// copy data from the property tree to member variables
+//
+//////////////////////////////////////////////////////////////////////
+void FGVehicle::property_to_fdm () {
+    m_throttle  = globals->get_controls()->get_throttle( 0 );
+    m_rudder    = globals->get_controls()->get_aileron();
+} // FGVehicle::property_to_fdm ()
+//////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////
+//
+// copy data from member variables to the property tree
+//
+//////////////////////////////////////////////////////////////////////
+void FGVehicle::fdm_to_property () {
+    double rpm = (m_throttle * m_max_rpm); // + m_min_rpm;
+    if (m_accel_factor == -1.0)
+        rpm = m_min_rpm;
+    cout << "rpm: " << rpm << " ";
+    if (rpm < m_min_rpm)
+        rpm = m_min_rpm;
+    if (rpm > m_max_rpm - 0.1)
+        rpm = m_max_rpm;
+    cout << "rpm: " << rpm << " " << m_throttle << endl;
+    fgSetDouble ("/engines/engine/rpm", rpm);
+} // FGVehicle::fdm_to_property ()
+
+//////////////////////////////////////////////////////////////////////
+//
+// do the equations of motion
+//
+//////////////////////////////////////////////////////////////////////
+void FGVehicle::EOM ( double dt ) {
+    if (is_suspended())
+        return;
+
+    //
+    // determine if we brake or use the bow thruster
+    //
+    bool brake = false;
+    int  bow_thrust = 0; // 0: nothing, -1: left, 1: right
+    if (globals->get_controls()->get_brake_left()  > 0.0) {
+        if (globals->get_controls()->get_brake_right() > 0.0) {
+            brake = true;
+            bow_thrust = 0;
+        } else {
+            bow_thrust = -1;
+        }
+    }
+    if (globals->get_controls()->get_brake_right()  > 0.0) {
+        if (globals->get_controls()->get_brake_left() > 0.0) {
+            brake = true;
+            bow_thrust = 0;
+        } else {
+            bow_thrust = 1;
+        }
+    }
+    //
+    // determine if we accelerate or deaccelerate
+    //
+    if ( brake
+    ||   m_last_throttle > m_throttle
+    ||   m_speed > m_throttle * m_max_speed ) {
+        m_accel_factor = -1.0;
+    } else {
+        m_accel_factor = 1.0;
+    }
+    //
+    // for none-ships honor brake and de-accelerate to speed of 0
+    //
+    if (brake && (! m_vehicle_is_ship)) {
+        if (m_speed <= 0.0) {
+            m_throttle = 0.0; // vehicles break until they stop fully
+            m_speed    = 0.0;
+        } else {
+            m_throttle = m_absolute_braking;
+        }
+    }
+    if ((m_throttle == 0.0) && (m_speed != 0.0)) {
+        if (m_speed > 0)
+            m_accel_factor = -1.0;
+        else
+            m_accel_factor = 1.0;
+        m_throttle = m_roll_resistance;
+    }
+    m_last_throttle = m_throttle;
+    //
+    // calculate speeed
+    //
+    m_speed += m_accel_factor * (dt * m_throttle * m_max_accel);
+    double dist = m_speed * dt;
+    double kts = (m_speed * SG_METER_TO_NM * 3600.0) / 1.93;
+    _set_V_equiv_kts (kts);
+    _set_V_calibrated_kts (kts);
+    _set_V_ground_speed (kts);
+    //
+    // angle of turn in radians/sec
+    // rudder -1: left, 0: nothing, 1: right
+    //
+    double rudder_factor = (m_speed / m_max_speed);
+    if (m_vehicle_is_ship) {
+        if ((bow_thrust == 0) || (m_speed > 10))
+            rudder_factor /= 10;
+        else {
+            // activate bow thrust
+            if (m_speed <= 0.5)
+                rudder_factor = (0.5 / m_max_speed);
+            if (m_rudder <= 0.5)
+                m_rudder = bow_thrust;
+        }
+    }
+    double turn = m_rudder * SGD_PI_4 * dt * rudder_factor;
+    //
+    // update euler angles
+    //
+    _set_Euler_Angles (get_Phi(), get_Theta(),
+                       fmod(get_Psi() + turn, SGD_2PI));
+    _set_Euler_Rates (0, 0, 0);
+    //
+    // update (lon/lat) position
+    //
+    double lat2, lon2, az2;
+    if ( fabs (m_speed) > SG_EPSILON ) {
+        geo_direct_wgs_84 ( get_Altitude(),
+                            get_Latitude() * SGD_RADIANS_TO_DEGREES,
+                            get_Longitude() * SGD_RADIANS_TO_DEGREES,
+                            get_Psi() * SGD_RADIANS_TO_DEGREES,
+                            dist, &lat2, &lon2, &az2 );
+        _set_Longitude ( lon2 * SGD_DEGREES_TO_RADIANS );
+        _set_Latitude  ( lat2 * SGD_DEGREES_TO_RADIANS );
+    }
+    double sl_radius, lat_geoc;
+    sgGeodToGeoc( get_Latitude(), get_Altitude(), &sl_radius, &lat_geoc );
+    //
+    // Set Altitude to ground level
+    //
+    double pos[3], contact[3], normal[3], vel[3], agl, ref_time;
+    int    type;
+    pos[0] = get_Latitude() * SGD_RADIANS_TO_DEGREES;
+    pos[1] = get_Longitude() * SGD_RADIANS_TO_DEGREES;
+    pos[2] = 20000; // get_Altitude();
+    ref_time = dt;
+    //
+    // determine ground material => type
+    //
+//    get_agl_m (dt, pos, 0.0,  contact, normal, vel, &type, 0, &agl);
+//    _update_ground_elev_at_pos ();
+    globals->get_scenery()->get_elevation_m(pos[0], pos[1],
+              20000.0, agl, 0);
+    set_Altitude(agl);
+    //
+    // TODO: set Orientation to reflect the ground
+    //
+} // FGVehicle::EOM ()
+//////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////
+//
+// Run an iteration of the EOM (equations of motion)
+//
+//////////////////////////////////////////////////////////////////////
+void FGVehicle::update( double dt ) {
+    property_to_fdm ();
+    EOM (dt);
+    fdm_to_property ();
+} // FGVehicle::update()
+//////////////////////////////////////////////////////////////////////
+
Index: src/FDM/Vehicle.hxx
===================================================================
RCS file: src/FDM/Vehicle.hxx
diff -N src/FDM/Vehicle.hxx
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/FDM/Vehicle.hxx	19 Jun 2007 10:51:29 -0000
@@ -0,0 +1,62 @@
+// Vehicle.hxx -- interface to the "Vehicle" pseudo flight model
+//
+// Written by Oliver Schroeder, started June 2007.
+//
+// Copyright (C) 2007 Oliver Schroeder
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+//
+// $Id:$
+
+
+#ifndef _VEHICLE_HXX
+#define _VEHICLE_HXX
+
+#include "flight.hxx"
+
+class FGVehicle: public FGInterface {
+
+public:
+    FGVehicle( double dt );
+    ~FGVehicle();
+    // reset flight params to a specific position 
+    void init();
+    // update position based on inputs, positions, velocities, etc.
+    void update( double dt );
+    // copy data from the property tree to member variables
+    void property_to_fdm ();
+    // copy data from member variables to the property tree
+    void fdm_to_property ();
+    // do the equations of motion
+    void EOM ( double dt );
+
+private:
+    double  m_speed;
+    double  m_throttle;
+    double  m_rudder;
+    double  m_last_throttle;
+    double  m_accel_factor;
+    double  m_max_accel;
+    double  m_max_rpm;
+    double  m_min_rpm;
+    double  m_max_speed;
+    double  m_absolute_braking;
+    double  m_roll_resistance;
+    bool    m_bow_thrust;
+    bool    m_vehicle_is_ship;
+};
+
+#endif // _VEHICLE_HXX
+
Index: src/Main/fg_init.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Main/fg_init.cxx,v
retrieving revision 1.185
diff -u -r1.185 fg_init.cxx
--- src/Main/fg_init.cxx	17 Jun 2007 08:14:02 -0000	1.185
+++ src/Main/fg_init.cxx	19 Jun 2007 10:51:34 -0000
@@ -89,6 +89,7 @@
 #include <FDM/LaRCsim/LaRCsim.hxx>
 #include <FDM/MagicCarpet.hxx>
 #include <FDM/UFO.hxx>
+#include <FDM/Vehicle.hxx>
 #include <FDM/NullFDM.hxx>
 #include <FDM/YASim/YASim.hxx>
 #include <GUI/new_gui.hxx>
@@ -1349,6 +1350,8 @@
         cur_fdm_state = new FGMagicCarpet( dt );
     } else if ( model == "ufo" ) {
         cur_fdm_state = new FGUFO( dt );
+    } else if ( model == "vehicle" ) {
+        cur_fdm_state = new FGVehicle( dt );
     } else if ( model == "external" ) {
         // external is a synonym for "--fdm=null" and is
         // maintained here for backwards compatibility
Index: src/MultiPlayer/multiplaymgr.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/MultiPlayer/multiplaymgr.cxx,v
retrieving revision 1.14
diff -u -r1.14 multiplaymgr.cxx
--- src/MultiPlayer/multiplaymgr.cxx	17 Jan 2007 22:29:20 -0000	1.14
+++ src/MultiPlayer/multiplaymgr.cxx	19 Jun 2007 10:51:35 -0000
@@ -191,21 +191,29 @@
   //  Set members from property values
   //////////////////////////////////////////////////
   short rxPort = fgGetInt("/sim/multiplay/rxport");
-  if (rxPort <= 0)
-    rxPort = 5000;
-  mCallsign = fgGetString("/sim/multiplay/callsign");
-  if (mCallsign.empty())
-    // FIXME: use getpwuid
-    mCallsign = "JohnDoe"; 
   string rxAddress = fgGetString("/sim/multiplay/rxhost");
-  if (rxAddress.empty())
-    rxAddress = "127.0.0.1";
   short txPort = fgGetInt("/sim/multiplay/txport");
   string txAddress = fgGetString("/sim/multiplay/txhost");
+  mCallsign = fgGetString("/sim/multiplay/callsign");
   if (txPort > 0 && !txAddress.empty()) {
-    mHaveServer = true;
     mServer.set(txAddress.c_str(), txPort);
+    if (strncmp (mServer.getHost(), "0.0.0.0", 8) == 0) {
+      mHaveServer = false;
+      SG_LOG(SG_NETWORK, SG_ALERT,
+        "FGMultiplayMgr - could not resolve '"
+        << txAddress << "', Multiplayermode disabled");
+    } else {
+      mHaveServer = true;
+    }
+    rxPort = txPort;
+  }
+  if (rxPort <= 0) {
+    SG_LOG(SG_NETWORK, SG_ALERT,
+      "FGMultiplayMgr - No receiver port, Multiplayermode disabled");
+    return (false);
   }
+  if (mCallsign.empty())
+    mCallsign = "JohnDoe"; // FIXME: use getpwuid
   SG_LOG(SG_NETWORK,SG_INFO,"FGMultiplayMgr::init-txaddress= "<<txAddress);
   SG_LOG(SG_NETWORK,SG_INFO,"FGMultiplayMgr::init-txport= "<<txPort );
   SG_LOG(SG_NETWORK,SG_INFO,"FGMultiplayMgr::init-rxaddress="<<rxAddress );
@@ -257,13 +265,10 @@
 void
 FGMultiplayMgr::SendMyPosition(const FGExternalMotionData& motionInfo)
 {
-  if ((! mInitialised) || (! mHaveServer)) {
-    if (! mInitialised)
-      SG_LOG( SG_NETWORK, SG_ALERT,
-              "FGMultiplayMgr::SendMyPosition - not initialised" );
-    if (! mHaveServer)
-      SG_LOG( SG_NETWORK, SG_ALERT,
-              "FGMultiplayMgr::SendMyPosition - no server" );
+  if ((! mInitialised) || (! mHaveServer))
+        return;
+  if (! mHaveServer) {
+    SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayMgr::SendMyPosition - no server");
     return;
   }
 
@@ -709,8 +714,8 @@
   MsgBuf[MsgHdr->MsgLen - sizeof(T_MsgHdr) - 1] = '\0';
   
   T_ChatMsg* ChatMsg = (T_ChatMsg *)(Msg + sizeof(T_MsgHdr));
-  SG_LOG ( SG_NETWORK, SG_ALERT, "Chat [" << MsgHdr->Callsign << "]"
-           << " " << MsgBuf << endl);
+  SG_LOG (SG_NETWORK, SG_ALERT, "Chat [" << MsgHdr->Callsign << "]"
+           << " " << MsgBuf);
 
   delete [] MsgBuf;
 } // FGMultiplayMgr::ProcessChatMsg ()

Attachment: Nimitz.tgz
Description: application/tgz


--- End Message ---
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to