aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 787cb12..81e03ca 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Runtime.InteropServices; 31using System.Runtime.InteropServices;
32using System.Threading; 32using System.Threading;
33using System.IO;
33using Axiom.Math; 34using Axiom.Math;
34using log4net; 35using log4net;
35using Nini.Config; 36using Nini.Config;
@@ -247,6 +248,11 @@ namespace OpenSim.Region.Physics.OdePlugin
247 248
248 private IConfigSource m_config; 249 private IConfigSource m_config;
249 250
251 public bool physics_logging = false;
252 public int physics_logging_interval = 0;
253 public bool physics_logging_append_existing_logfile = false;
254
255
250 /// <summary> 256 /// <summary>
251 /// Initiailizes the scene 257 /// Initiailizes the scene
252 /// Sets many properties that ODE requires to be stable 258 /// Sets many properties that ODE requires to be stable
@@ -370,6 +376,10 @@ namespace OpenSim.Region.Physics.OdePlugin
370 avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor_win", 550000f); 376 avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor_win", 550000f);
371 bodyMotorJointMaxforceTensor = physicsconfig.GetFloat("body_motor_joint_maxforce_tensor_win", 5f); 377 bodyMotorJointMaxforceTensor = physicsconfig.GetFloat("body_motor_joint_maxforce_tensor_win", 5f);
372 } 378 }
379
380 physics_logging = physicsconfig.GetBoolean("physics_logging", false);
381 physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0);
382 physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false);
373 } 383 }
374 } 384 }
375 385
@@ -1759,7 +1769,25 @@ namespace OpenSim.Region.Physics.OdePlugin
1759 } 1769 }
1760 } 1770 }
1761 } 1771 }
1772
1773
1774 // Finished with all sim stepping. If requested, dump world state to file for debugging.
1775 // TODO: This call to the export function is already inside lock(OdeLock) - but is an extra lock needed?
1776 // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots?
1777 if(physics_logging && (physics_logging_interval>0) && (framecount % physics_logging_interval == 0) ) {
1778 string fname = "state-" + world.ToString() + ".DIF"; // give each physics world a separate filename
1779 string prefix = "world" + world.ToString(); // prefix for variable names in exported .DIF file
1780
1781 if(physics_logging_append_existing_logfile) {
1782 string header = "-------------- START OF PHYSICS FRAME " + framecount.ToString() + " --------------";
1783 TextWriter fwriter = File.AppendText(fname);
1784 fwriter.WriteLine(header);
1785 fwriter.Close();
1786 }
1787 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
1788 }
1762 } 1789 }
1790
1763 return fps; 1791 return fps;
1764 } 1792 }
1765 1793