diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 787cb12eff..81e03ca0a8 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Reflection; using System.Runtime.InteropServices; using System.Threading; +using System.IO; using Axiom.Math; using log4net; using Nini.Config; @@ -247,6 +248,11 @@ namespace OpenSim.Region.Physics.OdePlugin private IConfigSource m_config; + public bool physics_logging = false; + public int physics_logging_interval = 0; + public bool physics_logging_append_existing_logfile = false; + + /// /// Initiailizes the scene /// Sets many properties that ODE requires to be stable @@ -370,6 +376,10 @@ namespace OpenSim.Region.Physics.OdePlugin avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor_win", 550000f); bodyMotorJointMaxforceTensor = physicsconfig.GetFloat("body_motor_joint_maxforce_tensor_win", 5f); } + + physics_logging = physicsconfig.GetBoolean("physics_logging", false); + physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); + physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false); } } @@ -1759,7 +1769,25 @@ namespace OpenSim.Region.Physics.OdePlugin } } } + + + // Finished with all sim stepping. If requested, dump world state to file for debugging. + // TODO: This call to the export function is already inside lock(OdeLock) - but is an extra lock needed? + // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots? + if(physics_logging && (physics_logging_interval>0) && (framecount % physics_logging_interval == 0) ) { + string fname = "state-" + world.ToString() + ".DIF"; // give each physics world a separate filename + string prefix = "world" + world.ToString(); // prefix for variable names in exported .DIF file + + if(physics_logging_append_existing_logfile) { + string header = "-------------- START OF PHYSICS FRAME " + framecount.ToString() + " --------------"; + TextWriter fwriter = File.AppendText(fname); + fwriter.WriteLine(header); + fwriter.Close(); + } + d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); + } } + return fps; } diff --git a/bin/Ode.NET.dll b/bin/Ode.NET.dll index 8826b5ed89..5b296ebe14 100644 Binary files a/bin/Ode.NET.dll and b/bin/Ode.NET.dll differ diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index d61eef0d61..eb52e6b35f 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -309,6 +309,15 @@ mesh_lod = 32 ; number^2 physical level of detail of the sculpt texture. 16x16 - 256 verticies mesh_physical_lod = 16 +; ## +; ## Physics logging settings - logfiles are saved to *.DIF files +; ## + +;physics_logging = true +;; every n simulation iterations, the physics snapshot file is updated +;physics_logging_interval = 50 +;; append to existing physics logfile, or overwrite existing logfiles? +;physics_logging_append_existing_logfile = true [RemoteAdmin] enabled = false @@ -617,4 +626,4 @@ EventLimit = 30 ; If a script overruns it's event limit, kill the script? KillTimedOutScripts = false ; Allow OS console command functionality (VERY DANGEROUS!!) -AllowosConsoleCommand = false \ No newline at end of file +AllowosConsoleCommand = false diff --git a/bin/libode.so b/bin/libode.so index b614780aa6..fccdf5b639 100644 Binary files a/bin/libode.so and b/bin/libode.so differ diff --git a/bin/ode.dll b/bin/ode.dll index 6fd9f1e06b..7ac31ade5b 100644 Binary files a/bin/ode.dll and b/bin/ode.dll differ