diff -urdN ../Tekkotsu_2.2/Behaviors/BehaviorBase.cc ./Behaviors/BehaviorBase.cc
--- ../Tekkotsu_2.2/Behaviors/BehaviorBase.cc	Wed Dec 31 19:00:00 1969
+++ ./Behaviors/BehaviorBase.cc	Thu Nov 11 15:34:59 2004
@@ -0,0 +1,69 @@
+#include "BehaviorBase.h"
+
+std::set<BehaviorBase*> BehaviorBase::registry;
+
+/*! @deprecated, behavior constructors should take a name argument (which by default should be the name of the type of the class) */
+BehaviorBase::BehaviorBase()
+	: ReferenceCounter(), EventListener(), started(false),
+	  instanceName("?"), className("BehaviorBase")
+{
+	registry.insert(this);
+}
+
+BehaviorBase::BehaviorBase(const std::string& name)
+	: ReferenceCounter(), EventListener(), started(false),
+	  instanceName(name), className(name)
+{
+	registry.insert(this);
+}
+
+BehaviorBase::BehaviorBase(const std::string& classname, const std::string& instancename)
+	: ReferenceCounter(), EventListener(), started(false),
+	  instanceName(instancename), className(classname)
+{
+	registry.insert(this);
+}
+
+
+BehaviorBase::BehaviorBase(const BehaviorBase& b)
+	: ReferenceCounter(b), EventListener(b), started(b.started),
+	  instanceName(b.instanceName), className(b.className)
+{
+	registry.insert(this);
+}
+
+BehaviorBase&
+BehaviorBase::operator=(const BehaviorBase& b) {
+	ReferenceCounter::operator=(b);
+	EventListener::operator=(b);
+	started=b.started;
+	instanceName=b.instanceName;
+	return *this;
+}
+
+BehaviorBase::~BehaviorBase() {
+	SetAutoDelete(false);
+	if(started)
+		DoStop();
+	//{ if(started) { references++; DoStop(); references--; } }
+	registry.erase(this);
+}
+
+void
+BehaviorBase::DoStart() {
+	//std::cout << getName() << " started " << this << std::endl;
+	if(!started) {
+		started=true;
+		AddReference();
+	}
+}
+
+void
+BehaviorBase::DoStop() {
+	//std::cout << getName() << " stopped " << this << std::endl;
+	if(started) {
+		started=false;
+		RemoveReference();
+	}
+}
+
diff -urdN ../Tekkotsu_2.2/Behaviors/BehaviorBase.h ./Behaviors/BehaviorBase.h
--- ../Tekkotsu_2.2/Behaviors/BehaviorBase.h	Wed Mar 24 01:38:21 2004
+++ ./Behaviors/BehaviorBase.h	Mon Nov 15 17:46:19 2004
@@ -5,6 +5,7 @@
 #include "Events/EventListener.h"
 #include "Shared/ReferenceCounter.h"
 #include <string>
+#include <set>
 
 //! The basis from which all other Behaviors should inherit
 /*! Makes use of ReferenceCounter so that behaviors can automatically delete themselves if
@@ -22,43 +23,62 @@
  *  what's going on.
  */
 class BehaviorBase : public ReferenceCounter, public EventListener {
- public:
-	//! constructor
-	BehaviorBase() : ReferenceCounter(), EventListener(), started(false) {}
-	//! copy constructor; assumes subclass handles copying approriately - i.e. if @a b is active, the copy will be as well, even though DoStart was never called..
-	BehaviorBase(const BehaviorBase& b) : ReferenceCounter(b), EventListener(b), started(b.started) {}
-	//! assignment operator; assumes subclass handles assignment appropriately - i.e. if @a b is active, the copy will be as well, even though DoStart was never called..
-	BehaviorBase& operator=(const BehaviorBase& b) { ReferenceCounter::operator=(b); EventListener::operator=(b); started=b.started; return *this; }
-
+public:
 	//! destructor - if is active when deleted, will call DoStop() first
-	virtual ~BehaviorBase() {
-		SetAutoDelete(false);
-		if(started)
-			DoStop();
-		//{ if(started) { references++; DoStop(); references--; } }
-	}
+	virtual ~BehaviorBase();
 	
 	//! By default, merely adds to the reference counter (through AddReference()); Note you should still call this from your overriding methods
-	virtual void DoStart() {
-		//std::cout << getName() << " started " << this << std::endl;
-		if(!started) {
-			started=true;
-			AddReference();
-		}
-	}
+	virtual void DoStart();
 
 	//! By default, subtracts from the reference counter (RemoveReference()), and thus may deletex if zero;  Don't forget to still call this when you override this; <b>Warning:</b> call this at the <i>end</i> of your DoStop(), not beginning (it might @c delete @c this )
-	virtual void DoStop() {
-		//std::cout << getName() << " stopped " << this << std::endl;
-		if(started) {
-			started=false;
-			RemoveReference();
-		}
-	}
+	virtual void DoStop();
 	
 	//! By defining here, allows you to get away with not supplying a processEvent() function for the EventListener interface.  By default, does nothing.
-	virtual void processEvent(const EventBase& /*event*/) {};
+	virtual void processEvent(const EventBase& /*event*/) {}
+
+	//! Identifies the behavior in menus and such
+	virtual std::string getName() const { return instanceName; }
+
+	//! Allows dynamic renaming of behaviors
+	virtual void setName(const std::string& name) { instanceName=name; }
+
+	//! Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis)
+	/*! By default simply returns getName(), because any calls from a
+	 *  BehaviorBase function to getClassDescription() are going to call
+	 *  BehaviorBase::getClassDescription(), not
+	 *  ~YourSubClass~::getClassDescription(), because static functions
+	 *  can't be virtual in C++ (doh!)
+	 *
+	 *  This means that getDescription called on a pointer to a
+	 *  BehaviorBase of unknown subtype would always return an empty
+	 *  string, which is pretty useless.  So instead we return the name
+	 *  in this situation.  If you want getDescription to return
+	 *  getClassDescription, you'll have to override it in your subclass
+	 *  to do so. */
+	virtual std::string getDescription() const {
+		std::string d=getClassDescription();
+		return (d.size()==0)?getName():d;
+	}
+
+	//! Returns the name of the class of this behavior (aka its type)
+	/*! Note that this isn't static to avoid the problems we found with
+	 *  getDescription/getClassDescription.  So instead we wind up
+	 *  wasting some memory in each instance of the class to store the
+	 *  className, but at least it will work the way you expect. */
+	virtual std::string getClassName() const { return className; }
+	
+	//! Gives a short description of what this class of behaviors does... you should override this (but don't have to)
+	/*! If you do override this, also consider overriding getDescription() to return it */
+	static std::string getClassDescription() { return ""; }
+
+	//! Returns true if the behavior is currently running
+	virtual bool isActive() const { return started; }
+	
+	//! Allows read-only access to the set of currently instantiated behaviors
+	/*! Not all of these behaviors are necessarily active, this is everything that has been allocated and not yet deallocated */
+	static const std::set<BehaviorBase*>& getRegistry() { return registry; }
 
+	// Just some debugging stuff in stasis
 	/*	virtual void AddReference() {
 			std::cout << getName() << " AddReference()==" << GetReferences() << ' ' << this << std::endl;
 			ReferenceCounter::AddReference();
@@ -70,20 +90,22 @@
 			}
 	*/
 	
-	//! Identifies the behavior in menus and such
-	virtual std::string getName() const =0;
-
-	//! Gives a short description of what this class of behaviors does... you should override this (but don't have to)
-	static std::string getClassDescription() { return ""; }
-
-	//! Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis)  By default simply returns getClassDescription()
-	virtual std::string getDescription() const { return getClassDescription(); }
-
-	//! Returns true if the behavior is currently running
-	virtual bool isActive() const { return started; }
+protected:
+	//! deprecated, behavior constructors should take a name argument (which by default should be the name of the type of the class)
+	BehaviorBase() __attribute__((deprecated));
+	//! constructor, @a name is used as both instance name and class name
+	explicit BehaviorBase(const std::string& name);
+	//! constructor, allows different initial values for class name and instance name
+	BehaviorBase(const std::string& classname, const std::string& instancename);
+	//! copy constructor; assumes subclass handles copying approriately - i.e. if @a b is active, the copy will be as well, even though DoStart was never called..
+	BehaviorBase(const BehaviorBase& b);
+	//! assignment operator; assumes subclass handles assignment appropriately - i.e. if @a b is active, the copy will be as well, even though DoStart was never called..
+	BehaviorBase& operator=(const BehaviorBase& b);
 
- protected:
 	bool started; //!< true when the behavior is active
+	std::string instanceName; //!< holds the name of this instance of behavior
+	const std::string className; //!< holds the type of the subclass of this behavior as a string
+	static std::set<BehaviorBase*> registry; //!< allows us to keep track of all the current behaviors
 };
 
 /*! @file
@@ -91,10 +113,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Controller.cc ./Behaviors/Controller.cc
--- ../Tekkotsu_2.2/Behaviors/Controller.cc	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Controller.cc	Sat Oct 16 21:16:10 2004
@@ -452,7 +452,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controller.h ./Behaviors/Controller.h
--- ../Tekkotsu_2.2/Behaviors/Controller.h	Wed Mar 24 00:35:00 2004
+++ ./Behaviors/Controller.h	Wed Nov 10 20:45:31 2004
@@ -46,10 +46,11 @@
  *    <i>bool:hilighted<sub>numitems</sub></i>\n
  *    <i>text:item-title<sub>numitems</sub></i>\n
  *    <i>text:item-description<sub>numitems</sub></i>' - refreshes the current menu\n
- *  - '<tt>status </tt><i>text</i>' - sets the status bar to <i>text</i> (until the next refresh)
+ *  - '<tt>status</tt>\n
+ *    <i>text</i>' - sets the status bar to <i>text</i> (until the next refresh)
  *  - '<tt>load</tt>\n
  *    <i>text:classname</i>\n
- *    <i>text:instancename</i>
+ *    <i>text:instancename</i>\n
  *    <i>int:port</i>\n
  *    [<i>arg1</i> [<i>arg2</i> [...]]]' - tells the GUI to load the java class named <i>classname</i>, and have it connect to <i>port</i>, passing it the argument list.
  *    <i>classname</i> should contain a constructor of the form <tt>Classname(String </tt><i>host</i>, <tt>int </tt><i>port</i>, <tt>String </tt><i>args</i><tt>[])</tt>
@@ -93,8 +94,8 @@
  */
 class Controller : public BehaviorBase, public EventTrapper {
 public:
-	Controller() : display(MotionManager::invalid_MC_ID), estop_id(MotionManager::invalid_MC_ID), root(NULL), cmdstack(), last_time(0), cur_time(0), nextEv_val(0), nextEv_dur(0), prevEv_val(0), prevEv_dur(0), alreadyGotBoth(false), isControlling(false), gui_comm(NULL)  {init();}	//!< Constructor
-	Controller(ControlBase* r) : display(MotionManager::invalid_MC_ID), estop_id(MotionManager::invalid_MC_ID), root(r), cmdstack(), last_time(0), cur_time(0), nextEv_val(0), nextEv_dur(0), prevEv_val(0), prevEv_dur(0), alreadyGotBoth(false), isControlling(false), gui_comm(NULL) { init(); } //!< Constructor, sets a default root control
+	Controller() : BehaviorBase("Controller"), EventTrapper(), display(MotionManager::invalid_MC_ID), estop_id(MotionManager::invalid_MC_ID), root(NULL), cmdstack(), last_time(0), cur_time(0), nextEv_val(0), nextEv_dur(0), prevEv_val(0), prevEv_dur(0), alreadyGotBoth(false), isControlling(false), gui_comm(NULL)  {init();}	//!< Constructor
+	Controller(ControlBase* r) : BehaviorBase("Controller"), EventTrapper(), display(MotionManager::invalid_MC_ID), estop_id(MotionManager::invalid_MC_ID), root(r), cmdstack(), last_time(0), cur_time(0), nextEv_val(0), nextEv_dur(0), prevEv_val(0), prevEv_dur(0), alreadyGotBoth(false), isControlling(false), gui_comm(NULL) { init(); } //!< Constructor, sets a default root control
 	virtual ~Controller() {
 		cout << "~Controller()..." << endl;
 		delete root;
@@ -127,9 +128,8 @@
 
 	Controller& setEStopID(MotionManager::MC_ID estopid); //!< Sets the emergency stop MC to monitor for pausing
 	
-	virtual std::string getName() const { return "Controller"; }
 	static std::string getClassDescription() { return "Provides interface for activating/deactivating controls (and through them, behaviors)"; }
-	
+	virtual std::string getDescription() const { return getClassDescription(); }
 
 
 	static void loadGUI(const std::string& type, const std::string& name, unsigned int port) {loadGUI(type,name,port,std::vector<std::string>());} //!< attempts to open a Java object on the desktop
@@ -211,10 +211,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/BatteryCheckControl.h ./Behaviors/Controls/BatteryCheckControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/BatteryCheckControl.h	Thu Oct  7 15:07:04 2004
+++ ./Behaviors/Controls/BatteryCheckControl.h	Thu Oct  7 15:07:04 2004
@@ -111,7 +111,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/BehaviorActivatorControl.h ./Behaviors/Controls/BehaviorActivatorControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/BehaviorActivatorControl.h	Thu Sep 25 11:26:10 2003
+++ ./Behaviors/Controls/BehaviorActivatorControl.h	Thu Sep 25 11:26:10 2003
@@ -62,7 +62,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/BehaviorReportControl.h ./Behaviors/Controls/BehaviorReportControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/BehaviorReportControl.h	Wed Dec 31 19:00:00 1969
+++ ./Behaviors/Controls/BehaviorReportControl.h	Tue Nov 16 14:25:24 2004
@@ -0,0 +1,67 @@
+//-*-c++-*-
+#ifndef INCLUDED_BehaviorReportControl_h_
+#define INCLUDED_BehaviorReportControl_h_
+
+#include "ControlBase.h"
+#include "Behaviors/BehaviorBase.h"
+
+//! Reads the set of currently instantiated behaviors and sends a report to ::sout
+class BehaviorReportControl : public ControlBase {
+public:
+	//! Constructor
+	BehaviorReportControl()
+		: ControlBase("Behavior Report","Generates a summary of currently instantiated behaviors")
+	{}
+
+	//! Prints a report to sout
+	virtual ControlBase * activate(MotionManager::MC_ID, Socket *) {
+		typedef std::set<BehaviorBase*> registry_t;
+		typedef std::vector<BehaviorBase*> behlist_t;
+		const registry_t& reg=BehaviorBase::getRegistry();
+		behlist_t active,inactive;
+		for(registry_t::const_iterator it=reg.begin(); it!=reg.end(); it++) {
+			if((*it)->isActive())
+				active.push_back(*it);
+			else
+				inactive.push_back(*it);
+		}
+
+		char format[100];
+		unsigned int maxlen=0;
+		for(behlist_t::const_iterator it=active.begin(); it!=active.end(); it++)
+			if((*it)->getName().size()>maxlen)
+				maxlen=(*it)->getClassName().size();
+		for(behlist_t::const_iterator it=inactive.begin(); it!=inactive.end(); it++)
+			if((*it)->getName().size()>maxlen)
+				maxlen=(*it)->getClassName().size();
+		snprintf(format,100,"  %%-%ds   %%s\n",maxlen);
+
+		sout->printf("** Currently Instantiated Behavior Report **\n");
+		sout->printf("%d active, %d inactive, %d total\n\n",active.size(),inactive.size(),reg.size());
+		sout->printf("Active Behaviors:\n",active.size());
+		sout->printf(format,"Class Name","Instance Name");
+		sout->printf(format,"------------","---------------");
+		for(behlist_t::const_iterator it=active.begin(); it!=active.end(); it++)
+			sout->printf(format,(*it)->getClassName().c_str(),(*it)->getName().c_str());
+		sout->printf("\n");
+		sout->printf("Inactive Behaviors:\n",inactive.size());
+		sout->printf(format,"Class Name","Instance Name");
+		sout->printf(format,"------------","---------------");
+		for(behlist_t::const_iterator it=inactive.begin(); it!=inactive.end(); it++)
+			sout->printf(format,(*it)->getClassName().c_str(),(*it)->getName().c_str());
+		return NULL;
+	}
+};
+
+/*! @file
+ * @brief Defines BehaviorReportControl, which reads the set of currently instantiated behaviors and sends a report to ::sout
+ * @author ejt (Creator)
+ *
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
+ */
+
+#endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/BehaviorSwitchActivatorControl.h ./Behaviors/Controls/BehaviorSwitchActivatorControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/BehaviorSwitchActivatorControl.h	Thu Sep 25 11:26:10 2003
+++ ./Behaviors/Controls/BehaviorSwitchActivatorControl.h	Thu Sep 25 11:26:10 2003
@@ -54,7 +54,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/BehaviorSwitchControl.h ./Behaviors/Controls/BehaviorSwitchControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/BehaviorSwitchControl.h	Wed Feb 18 16:11:25 2004
+++ ./Behaviors/Controls/BehaviorSwitchControl.h	Thu Nov 11 19:05:03 2004
@@ -86,7 +86,7 @@
 	virtual std::string getDescription() const {
 		if(mybeh==NULL)
 			return ControlBase::getDescription();
-		return mybeh->getDescription();
+		return "Class "+mybeh->getClassName()+": "+mybeh->getDescription();
 	}
 	
 protected:
@@ -224,11 +224,13 @@
 	virtual void startmine() {
 		if(!retained) {
 			mybeh=Al::construct();
+			mybeh->setName(getName());
 			if(behgrp!=NULL)
 				behgrp->curBehavior=mybeh;
 		} else {
 			if(mybeh==NULL) {
 				mybeh=Al::construct();
+				mybeh->setName(getName());
 				mybeh->AddReference();
 			}
 			if(behgrp!=NULL)
@@ -263,10 +265,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/ControlBase.cc ./Behaviors/Controls/ControlBase.cc
--- ../Tekkotsu_2.2/Behaviors/Controls/ControlBase.cc	Wed Aug  6 18:50:41 2003
+++ ./Behaviors/Controls/ControlBase.cc	Wed Nov  3 22:01:31 2004
@@ -2,6 +2,7 @@
 #include "Motion/MMAccessor.h"
 #include "Motion/LedMC.h"
 #include "Shared/string_util.h"
+#include "SoundPlay/SoundManager.h"
 #include "Wireless/Wireless.h"
 #include <iomanip>
 #include <sstream>
@@ -410,9 +411,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
- * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/ControlBase.h ./Behaviors/Controls/ControlBase.h
--- ../Tekkotsu_2.2/Behaviors/Controls/ControlBase.h	Thu Oct  7 18:15:37 2004
+++ ./Behaviors/Controls/ControlBase.h	Wed Nov  3 22:01:31 2004
@@ -4,7 +4,6 @@
 
 #include "Events/EventBase.h"
 #include "Motion/MotionManager.h"
-#include "SoundPlay/SoundManager.h"
 #include "Shared/Config.h"
 #include "Wireless/Socket.h"
 #include <string>
@@ -168,9 +167,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/DumpFileControl.h ./Behaviors/Controls/DumpFileControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/DumpFileControl.h	Thu Sep 25 11:26:10 2003
+++ ./Behaviors/Controls/DumpFileControl.h	Thu Sep 25 11:26:10 2003
@@ -40,7 +40,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/EventLogger.cc ./Behaviors/Controls/EventLogger.cc
--- ../Tekkotsu_2.2/Behaviors/Controls/EventLogger.cc	Thu Oct  7 18:15:21 2004
+++ ./Behaviors/Controls/EventLogger.cc	Wed Nov  3 22:01:32 2004
@@ -9,6 +9,7 @@
 #include "Events/LocomotionEvent.h"
 #include "Events/TextMsgEvent.h"
 #include "Events/VisionObjectEvent.h"
+#include "SoundPlay/SoundManager.h"
 
 EventLogger::EventLogger() : ControlBase("Event Logger","Allows you to see/log all of the un-trapped events as they are generated"), logfilePath(), logfile(), verbosity(0) {
 	for(unsigned int i=0; i<EventBase::numEGIDs; i++) {
@@ -108,8 +109,8 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/EventLogger.h ./Behaviors/Controls/EventLogger.h
--- ../Tekkotsu_2.2/Behaviors/Controls/EventLogger.h	Thu Oct  7 18:15:20 2004
+++ ./Behaviors/Controls/EventLogger.h	Thu Oct  7 18:15:20 2004
@@ -45,7 +45,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/FileBrowserControl.cc ./Behaviors/Controls/FileBrowserControl.cc
--- ../Tekkotsu_2.2/Behaviors/Controls/FileBrowserControl.cc	Wed Jan 14 15:43:43 2004
+++ ./Behaviors/Controls/FileBrowserControl.cc	Wed Jan 14 15:43:43 2004
@@ -158,7 +158,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/FileBrowserControl.h ./Behaviors/Controls/FileBrowserControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/FileBrowserControl.h	Wed Jan 14 15:43:44 2004
+++ ./Behaviors/Controls/FileBrowserControl.h	Wed Jan 14 15:43:44 2004
@@ -72,7 +72,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/FileInputControl.h ./Behaviors/Controls/FileInputControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/FileInputControl.h	Mon Mar 22 19:55:01 2004
+++ ./Behaviors/Controls/FileInputControl.h	Mon Mar 22 19:55:01 2004
@@ -48,7 +48,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/FreeMemReportControl.cc ./Behaviors/Controls/FreeMemReportControl.cc
--- ../Tekkotsu_2.2/Behaviors/Controls/FreeMemReportControl.cc	Thu Sep 25 11:26:11 2003
+++ ./Behaviors/Controls/FreeMemReportControl.cc	Thu Sep 25 11:26:11 2003
@@ -63,7 +63,7 @@
  * @author ejt (object), alokl (core function)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/FreeMemReportControl.h ./Behaviors/Controls/FreeMemReportControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/FreeMemReportControl.h	Thu Oct  7 15:07:04 2004
+++ ./Behaviors/Controls/FreeMemReportControl.h	Wed Nov 10 20:45:35 2004
@@ -13,9 +13,9 @@
 public:
 	//!@name Contructors/Destructors
 	//!contructor
-	FreeMemReportControl() : BehaviorBase(), ControlBase("Free Memory Report","Reports size of free memory, and monitors for low memory warning"), report_freq(-1U), low_mem(256), monitor_freq(1000), isWarning(false) {init();}
-	FreeMemReportControl(const std::string& n) : BehaviorBase(), ControlBase(n,"Reports size of free memory, and monitors for low memory warning"), report_freq(-1U), low_mem(256), monitor_freq(1000),isWarning(false) {init();}
-	FreeMemReportControl(const std::string& n, const std::string& d) : BehaviorBase(), ControlBase(n,d), report_freq(-1U), low_mem(256), monitor_freq(1000),isWarning(false) {init();}
+	FreeMemReportControl() : BehaviorBase("FreeMemReportControl"), ControlBase("Free Memory Report","Reports size of free memory, and monitors for low memory warning"), report_freq(-1U), low_mem(256), monitor_freq(1000), isWarning(false) {init();}
+	FreeMemReportControl(const std::string& n) : BehaviorBase("FreeMemReportControl"), ControlBase(n,"Reports size of free memory, and monitors for low memory warning"), report_freq(-1U), low_mem(256), monitor_freq(1000),isWarning(false) {init();}
+	FreeMemReportControl(const std::string& n, const std::string& d) : BehaviorBase("FreeMemReportControl"), ControlBase(n,d), report_freq(-1U), low_mem(256), monitor_freq(1000),isWarning(false) {init();}
 	virtual ~FreeMemReportControl() { SetAutoDelete(false); DoStop(); clearSlots(); } //!< destructor
 	//@}
 
@@ -66,10 +66,10 @@
  * @author ejt (object), alokl (core function)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/HelpControl.cc ./Behaviors/Controls/HelpControl.cc
--- ../Tekkotsu_2.2/Behaviors/Controls/HelpControl.cc	Tue Jul 13 20:50:26 2004
+++ ./Behaviors/Controls/HelpControl.cc	Tue Jul 13 20:50:26 2004
@@ -98,7 +98,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/HelpControl.h ./Behaviors/Controls/HelpControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/HelpControl.h	Mon Jan 19 17:03:58 2004
+++ ./Behaviors/Controls/HelpControl.h	Mon Jan 19 17:03:58 2004
@@ -45,7 +45,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/LoadCalibration.h ./Behaviors/Controls/LoadCalibration.h
--- ../Tekkotsu_2.2/Behaviors/Controls/LoadCalibration.h	Wed Feb 25 20:02:25 2004
+++ ./Behaviors/Controls/LoadCalibration.h	Wed Feb 25 20:02:25 2004
@@ -86,7 +86,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/LoadPostureControl.h ./Behaviors/Controls/LoadPostureControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/LoadPostureControl.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Controls/LoadPostureControl.h	Sat Oct 16 21:16:10 2004
@@ -60,7 +60,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/LoadWalkControl.h ./Behaviors/Controls/LoadWalkControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/LoadWalkControl.h	Sat Jan 10 15:10:27 2004
+++ ./Behaviors/Controls/LoadWalkControl.h	Sat Jan 10 15:10:27 2004
@@ -56,7 +56,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/MCValueEditControl.h ./Behaviors/Controls/MCValueEditControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/MCValueEditControl.h	Thu Sep 25 11:26:11 2003
+++ ./Behaviors/Controls/MCValueEditControl.h	Thu Sep 25 11:26:11 2003
@@ -29,7 +29,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/NullControl.h ./Behaviors/Controls/NullControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/NullControl.h	Thu Sep 25 11:26:11 2003
+++ ./Behaviors/Controls/NullControl.h	Thu Sep 25 11:26:11 2003
@@ -32,7 +32,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/PlaySoundControl.h ./Behaviors/Controls/PlaySoundControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/PlaySoundControl.h	Thu Sep 25 11:26:11 2003
+++ ./Behaviors/Controls/PlaySoundControl.h	Thu Sep 25 11:26:11 2003
@@ -32,7 +32,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/PostureEditor.cc ./Behaviors/Controls/PostureEditor.cc
--- ../Tekkotsu_2.2/Behaviors/Controls/PostureEditor.cc	Mon Oct 18 15:53:02 2004
+++ ./Behaviors/Controls/PostureEditor.cc	Mon Oct 18 15:53:02 2004
@@ -149,7 +149,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/PostureEditor.h ./Behaviors/Controls/PostureEditor.h
--- ../Tekkotsu_2.2/Behaviors/Controls/PostureEditor.h	Mon Oct 18 15:53:02 2004
+++ ./Behaviors/Controls/PostureEditor.h	Mon Oct 18 15:53:02 2004
@@ -52,7 +52,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/ProfilerCheckControl.h ./Behaviors/Controls/ProfilerCheckControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/ProfilerCheckControl.h	Fri Jul 25 16:18:04 2003
+++ ./Behaviors/Controls/ProfilerCheckControl.h	Thu Nov 11 15:34:59 2004
@@ -11,9 +11,6 @@
 	//! Constructor
 	ProfilerCheckControl() : ControlBase("Profiler Check","Reports time spent in all of the profiled sections in all processes") {}
 
-	//! Destructor
-	~ProfilerCheckControl() {}
-	
 	//! Prints a report to sout
 	virtual ControlBase * activate(MotionManager::MC_ID, Socket *) {
 		sout->printf("~~~ Main: ~~~\n%s",state->mainProfile.report().c_str());
@@ -27,10 +24,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
- * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/RebootControl.cc ./Behaviors/Controls/RebootControl.cc
--- ../Tekkotsu_2.2/Behaviors/Controls/RebootControl.cc	Thu Sep 25 11:26:11 2003
+++ ./Behaviors/Controls/RebootControl.cc	Thu Sep 25 11:26:11 2003
@@ -12,7 +12,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/RebootControl.h ./Behaviors/Controls/RebootControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/RebootControl.h	Thu Sep 25 11:26:11 2003
+++ ./Behaviors/Controls/RebootControl.h	Thu Sep 25 11:26:11 2003
@@ -23,7 +23,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/RunSequenceControl.h ./Behaviors/Controls/RunSequenceControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/RunSequenceControl.h	Mon Oct 18 13:01:38 2004
+++ ./Behaviors/Controls/RunSequenceControl.h	Mon Oct 18 13:01:38 2004
@@ -77,7 +77,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/SavePostureControl.h ./Behaviors/Controls/SavePostureControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/SavePostureControl.h	Thu Jan 29 20:29:41 2004
+++ ./Behaviors/Controls/SavePostureControl.h	Thu Jan 29 20:29:41 2004
@@ -30,7 +30,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/SaveWalkControl.h ./Behaviors/Controls/SaveWalkControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/SaveWalkControl.h	Thu Mar 25 19:28:41 2004
+++ ./Behaviors/Controls/SaveWalkControl.h	Thu Mar 25 19:28:41 2004
@@ -47,7 +47,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/SensorObserverControl.cc ./Behaviors/Controls/SensorObserverControl.cc
--- ../Tekkotsu_2.2/Behaviors/Controls/SensorObserverControl.cc	Thu Oct  7 15:07:04 2004
+++ ./Behaviors/Controls/SensorObserverControl.cc	Wed Nov  3 22:01:32 2004
@@ -7,6 +7,7 @@
 #include "Events/TextMsgEvent.h"
 #include "Events/VisionObjectEvent.h"
 #include "Shared/WorldState.h"
+#include "SoundPlay/SoundManager.h"
 
 SensorObserverControl::SensorObserverControl()
 	: ControlBase("Sensor Observer","Allows you to see/log the sensor data"), logfilePath(), logfile(), helpCtl(NULL), sensorCtl(NULL), buttonCtl(NULL), outputCtl(NULL), dutyCtl(NULL), consoleCtl(NULL), fileCtl(NULL), numListeners(0)
@@ -132,8 +133,8 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/SensorObserverControl.h ./Behaviors/Controls/SensorObserverControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/SensorObserverControl.h	Sun Jan 18 05:16:56 2004
+++ ./Behaviors/Controls/SensorObserverControl.h	Sun Jan 18 05:16:56 2004
@@ -53,7 +53,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/ShutdownControl.cc ./Behaviors/Controls/ShutdownControl.cc
--- ../Tekkotsu_2.2/Behaviors/Controls/ShutdownControl.cc	Thu Sep 25 11:26:11 2003
+++ ./Behaviors/Controls/ShutdownControl.cc	Thu Sep 25 11:26:11 2003
@@ -12,7 +12,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/ShutdownControl.h ./Behaviors/Controls/ShutdownControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/ShutdownControl.h	Thu Sep 25 11:26:11 2003
+++ ./Behaviors/Controls/ShutdownControl.h	Thu Sep 25 11:26:11 2003
@@ -23,7 +23,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/StringInputControl.cc ./Behaviors/Controls/StringInputControl.cc
--- ../Tekkotsu_2.2/Behaviors/Controls/StringInputControl.cc	Mon Jul 28 01:54:32 2003
+++ ./Behaviors/Controls/StringInputControl.cc	Mon Jul 28 01:54:32 2003
@@ -42,7 +42,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/StringInputControl.h ./Behaviors/Controls/StringInputControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/StringInputControl.h	Mon Mar 22 19:55:01 2004
+++ ./Behaviors/Controls/StringInputControl.h	Mon Mar 22 19:55:01 2004
@@ -44,7 +44,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/ToggleControl.h ./Behaviors/Controls/ToggleControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/ToggleControl.h	Mon Mar 22 19:55:01 2004
+++ ./Behaviors/Controls/ToggleControl.h	Mon Mar 22 19:55:01 2004
@@ -141,7 +141,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/ValueEditControl.h ./Behaviors/Controls/ValueEditControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/ValueEditControl.h	Thu Oct  7 15:07:04 2004
+++ ./Behaviors/Controls/ValueEditControl.h	Thu Oct  7 15:07:04 2004
@@ -166,7 +166,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/ValueSetControl.h ./Behaviors/Controls/ValueSetControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/ValueSetControl.h	Sun Jan 18 05:16:56 2004
+++ ./Behaviors/Controls/ValueSetControl.h	Sun Jan 18 05:16:56 2004
@@ -50,7 +50,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/WalkCalibration.cc ./Behaviors/Controls/WalkCalibration.cc
--- ../Tekkotsu_2.2/Behaviors/Controls/WalkCalibration.cc	Mon Mar  1 16:17:08 2004
+++ ./Behaviors/Controls/WalkCalibration.cc	Wed Nov  3 22:01:32 2004
@@ -6,6 +6,7 @@
 #include "Behaviors/Controller.h"
 #include "Shared/WorldState.h"
 #include "Shared/string_util.h"
+#include "SoundPlay/SoundManager.h"
 #include <stdlib.h>
 
 char * WalkCalibration::datanames[WalkCalibration::NUM_SRC] = { "fs","fr","sr","br","bs","rr" };
@@ -912,9 +913,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/WalkCalibration.h ./Behaviors/Controls/WalkCalibration.h
--- ../Tekkotsu_2.2/Behaviors/Controls/WalkCalibration.h	Thu Oct  7 15:07:04 2004
+++ ./Behaviors/Controls/WalkCalibration.h	Thu Oct  7 15:07:04 2004
@@ -124,7 +124,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/WaypointWalkControl.cc ./Behaviors/Controls/WaypointWalkControl.cc
--- ../Tekkotsu_2.2/Behaviors/Controls/WaypointWalkControl.cc	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Controls/WaypointWalkControl.cc	Wed Nov  3 22:01:32 2004
@@ -8,6 +8,7 @@
 #include "Motion/WaypointWalkMC.h"
 #include "Motion/WalkMC.h"
 #include "Motion/MMAccessor.h"
+#include "SoundPlay/SoundManager.h"
 
 WaypointWalkControl::WaypointWalkControl()
 	: ControlBase("WaypointWalkControl","Allows interactive control and execution of a set of waypoints"),
@@ -243,9 +244,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Behaviors/Controls/WaypointWalkControl.h ./Behaviors/Controls/WaypointWalkControl.h
--- ../Tekkotsu_2.2/Behaviors/Controls/WaypointWalkControl.h	Tue Jul 27 10:33:28 2004
+++ ./Behaviors/Controls/WaypointWalkControl.h	Tue Jul 27 10:33:28 2004
@@ -75,7 +75,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/ASCIIVisionBehavior.h ./Behaviors/Demos/ASCIIVisionBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/ASCIIVisionBehavior.h	Mon Oct 18 20:46:54 2004
+++ ./Behaviors/Demos/ASCIIVisionBehavior.h	Wed Nov 10 20:45:35 2004
@@ -13,7 +13,7 @@
 class ASCIIVisionBehavior : public BehaviorBase {
 public:
 	//! constructor
-	ASCIIVisionBehavior() : BehaviorBase() {}
+	ASCIIVisionBehavior() : BehaviorBase("ASCIIVisionBehavior") {}
 
 	static const unsigned int charMapSize=64;
 	static const char charMap[charMapSize];
@@ -30,9 +30,8 @@
 
 	virtual void processEvent(const EventBase& e);
 
-	virtual std::string getName() const { return "ASCIIVisionBehavior"; }
-
 	static std::string getClassDescription() { return "streams low-resolution ASCII-art of the camera image to sout"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	
@@ -43,10 +42,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/AlanBehavior.h ./Behaviors/Demos/AlanBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/AlanBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/AlanBehavior.h	Wed Nov 10 20:45:35 2004
@@ -17,7 +17,7 @@
 class AlanBehavior : public BehaviorBase {
 public:
 	AlanBehavior()
-		: BehaviorBase(), pose_id(MotionManager::invalid_MC_ID)
+		: BehaviorBase("AlanBehavior"), pose_id(MotionManager::invalid_MC_ID)
 	{}
 	
 	virtual void DoStart() {
@@ -97,15 +97,14 @@
 		}
 	}
 	
-	virtual std::string getName() const {
-		// Name is used for menus, or debugging.
-		return "AlanBehavior";
-	}
-	
 	static std::string getClassDescription() {
 		// This string will be shown by the HelpControl or by the tooltips of the Controller GUI
 		return "Lifts the left/right front legs higher as more pressure is applied to the front/back head buttons";
 	}
+	virtual std::string getDescription() const {
+		// We override this function to return the string we supplied above (not required, but nice)
+		return getClassDescription();
+	}
 	
 protected:
 	MotionManager::MC_ID pose_id; //!< ID of PostureMC, set up in DoStart() and used in processEvent()
@@ -116,10 +115,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/AutoGetupBehavior.h ./Behaviors/Demos/AutoGetupBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/AutoGetupBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/AutoGetupBehavior.h	Wed Nov 10 20:45:35 2004
@@ -15,7 +15,7 @@
 class AutoGetupBehavior : public BehaviorBase {
 public:
 	//! constructor
-	AutoGetupBehavior() : BehaviorBase(), back(0), side(0), gamma(.9), sensitivity(.85*.85), waiting(false) {}
+	AutoGetupBehavior() : BehaviorBase("AutoGetupBehavior"), back(0), side(0), gamma(.9), sensitivity(.85*.85), waiting(false) {}
 	//! destructor
 	virtual ~AutoGetupBehavior() {}
 
@@ -58,8 +58,8 @@
 			waiting=true;
 		}
 	}
-	virtual std::string getName() const { return "AutoGetupBehavior"; }
 	static std::string getClassDescription() { return "Monitors gravity's influence on the accelerometers - if it seems the robot has fallen over, it runs appropriate getup script"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 
 protected:
 	float back;          //!< exponential average of backwards accel
@@ -74,10 +74,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/BanditMachine.h ./Behaviors/Demos/BanditMachine.h
--- ../Tekkotsu_2.2/Behaviors/Demos/BanditMachine.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/BanditMachine.h	Thu Nov 11 16:32:14 2004
@@ -21,7 +21,7 @@
 public:
 	//!constructor
 	BanditMachine()
-		: StateNode("Bandit Machine",NULL), stare(NULL), start(NULL), liedown(MotionManager::invalid_MC_ID), bandit(2)
+		: StateNode("BanditMachine","BanditMachine",NULL), stare(NULL), start(NULL), liedown(MotionManager::invalid_MC_ID), bandit(2)
 	{
 		stare=new StareAtBallBehavior();
 		stare->AddReference();
@@ -39,6 +39,7 @@
 	}
 
 	static std::string getClassDescription() { return "Plays k-armed bandit with a computer"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 
 	virtual void setup() {
 		StateNode *wait=start=addNode(new WaitNode("Wait",this,bandit));
@@ -83,7 +84,7 @@
 		 *  @param p the parent node
 		 *  @param idx the joint index of the paw to move
 		 */
-		PressNode(const char* n, StateNode* p, unsigned int idx) : StateNode(n,p), press_id(MotionManager::invalid_MC_ID), index(idx) {
+		PressNode(const char* n, StateNode* p, unsigned int idx) : StateNode("PressNode",n,p), press_id(MotionManager::invalid_MC_ID), index(idx) {
 			SharedObject<MotionSequenceMC<MotionSequence::SizeSmall> > press;
 			press->setPlayTime(0);
 			press->setOutputCmd(idx,.6);
@@ -129,7 +130,7 @@
 		 *  @param right the PressNode to go to if the right paw is chosen
 		 */
 		DecideNode(const char* n, StateNode* p, karmedbanditExp3_1& bandito, StateNode* left, StateNode* right)
-			: StateNode(n,p), b(bandito), l(left), r(right)
+			: StateNode("DecideNode",n,p), b(bandito), l(left), r(right)
 		{}
 		virtual void DoStart() {
 			StateNode::DoStart();
@@ -162,7 +163,7 @@
 		 * @param bandito the class to pass the reward to (if it comes)
 		 */
 		WaitNode(const char* n, StateNode* p, karmedbanditExp3_1& bandito)
-			: StateNode(n,p), b(bandito), reward(false), leds_id(MotionManager::invalid_MC_ID)
+			: StateNode("WaitNode",n,p), b(bandito), reward(false), leds_id(MotionManager::invalid_MC_ID)
 		{
 			leds_id=motman->addPersistentMotion(SharedObject<LedMC>());
 		}
@@ -216,10 +217,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/BatteryMonitorBehavior.h ./Behaviors/Demos/BatteryMonitorBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/BatteryMonitorBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/BatteryMonitorBehavior.h	Wed Nov 10 20:45:35 2004
@@ -25,7 +25,7 @@
 	static const unsigned int no_power_p=14; //!< percent of 100 at which power will fail (approximate!)
 
 	//! constructor
-	BatteryMonitorBehavior() : BehaviorBase(), pose(NULL), pose_id(MotionManager::invalid_MC_ID), led_id(MotionManager::invalid_MC_ID) {}
+	BatteryMonitorBehavior() : BehaviorBase("BatteryMonitorBehavior"), pose(NULL), pose_id(MotionManager::invalid_MC_ID), led_id(MotionManager::invalid_MC_ID) {}
 	//! destructor
 	virtual ~BatteryMonitorBehavior() {}
 
@@ -94,8 +94,8 @@
 			}
 		}
 	}
-	virtual std::string getName() const { return "BatteryMonitorBehavior"; }
 	static std::string getClassDescription() { return "Reports the current battery status, and starts flicks the ears to warn when it gets too low"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 
 	//! returns true if the warning should be active (power remaining less than high_power_p, no external power, but also checks that a power update has been received)
 	static bool shouldWarn() { return state!=NULL && state->powerFlags[PowerSourceID::BatteryConnectSID] && (state->sensors[PowerRemainOffset]*100<=high_power_p || state->powerFlags[PowerSourceID::LowPowerWarnSID]) && !state->powerFlags[PowerSourceID::ExternalPowerSID]; }
@@ -156,10 +156,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/CameraBehavior.cc ./Behaviors/Demos/CameraBehavior.cc
--- ../Tekkotsu_2.2/Behaviors/Demos/CameraBehavior.cc	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/CameraBehavior.cc	Sat Oct 16 21:16:10 2004
@@ -196,7 +196,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/CameraBehavior.h ./Behaviors/Demos/CameraBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/CameraBehavior.h	Mon Feb  2 20:16:32 2004
+++ ./Behaviors/Demos/CameraBehavior.h	Wed Nov 10 20:45:35 2004
@@ -24,7 +24,7 @@
  public:
 	//! constructor, just sets up the variables
 	CameraBehavior()
-		: BehaviorBase(), camera_click(EventBase::buttonEGID,0,EventBase::deactivateETID,150), index(0), ledID(MotionManager::invalid_MC_ID)
+		: BehaviorBase("CameraBehavior"), camera_click(EventBase::buttonEGID,0,EventBase::deactivateETID,150), index(0), ledID(MotionManager::invalid_MC_ID)
 	{}
 
 	//! Register for events
@@ -36,8 +36,9 @@
 	//! Handles event processing - determines which generator to save from and writes to current file
 	virtual void processEvent(const EventBase& e);
 
-	virtual std::string getName() const { return "CameraBehavior"; } //!< returns name of behavior
 	static std::string getClassDescription() { return "Push head button to save a picture"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
+
  protected:
 	//! opens the next file to be saved to (with @a ext extension on the file name)
 	FILE * openNextFile(const std::string& ext);
@@ -60,10 +61,10 @@
  * @author ejt (rewrite for new vision system)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/ChaseBallBehavior.cc ./Behaviors/Demos/ChaseBallBehavior.cc
--- ../Tekkotsu_2.2/Behaviors/Demos/ChaseBallBehavior.cc	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/ChaseBallBehavior.cc	Sat Oct 16 21:16:10 2004
@@ -64,7 +64,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/ChaseBallBehavior.h ./Behaviors/Demos/ChaseBallBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/ChaseBallBehavior.h	Thu Sep 25 11:26:22 2003
+++ ./Behaviors/Demos/ChaseBallBehavior.h	Wed Nov 10 20:45:35 2004
@@ -10,7 +10,7 @@
 public:
 	//!constructor
 	ChaseBallBehavior()
-		: BehaviorBase(), headpointer_id(MotionManager::invalid_MC_ID), walker_id(MotionManager::invalid_MC_ID)
+		: BehaviorBase("ChaseBallBehavior"), headpointer_id(MotionManager::invalid_MC_ID), walker_id(MotionManager::invalid_MC_ID)
 	{}
 	//!destructor
 	virtual ~ChaseBallBehavior() {}
@@ -24,8 +24,8 @@
 	//! sets the head to point at the object and sets the body to move where the head points
 	virtual void processEvent(const EventBase& event);
 			
-	virtual std::string getName() const { return "ChaseBallBehavior"; } //!< returns name of behavior
 	static std::string getClassDescription() { return "Follows ball with head and walks whereever the head is pointing"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 
 protected:
 	MotionManager::MC_ID headpointer_id; //!< a HeadPointerMC object
@@ -37,10 +37,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
- * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/CrashTestBehavior.h ./Behaviors/Demos/CrashTestBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/CrashTestBehavior.h	Tue Aug 24 21:07:45 2004
+++ ./Behaviors/Demos/CrashTestBehavior.h	Wed Nov 10 20:45:35 2004
@@ -8,12 +8,13 @@
 //! Demonstrates (lack of) blocking using serr to (not) pinpoint a crash
 class CrashTestBehavior : public BehaviorBase {
 public:
-	CrashTestBehavior() : BehaviorBase()	{}
+	CrashTestBehavior() : BehaviorBase("CrashTestBehavior")	{}
 	
 	virtual void DoStart() {
 		//call superclass first for housekeeping:
 		BehaviorBase::DoStart();
 
+		serr->printf("I will now crash immediately following line 33\n");
 		//now do your code:
 		for(unsigned int i=0; i<100; i++) {
 			serr->printf("Hello serr!  This is %d\n",i);
@@ -23,16 +24,12 @@
 		//Hate to break it to you, but we're never going to get here...
 	}
 	
-	virtual std::string getName() const {
-		// Name is used for menus, or debugging.
-		return "CrashTestBehavior";
-	}
-	
 	static std::string getClassDescription() {
 		// This string will be shown by the HelpControl or by the tooltips of the Controller GUI
 		return "A little demo of blocking output before a crash after output #33 (yes, this crashes the AIBO)";
 	}
 	
+	virtual std::string getDescription() const { return getClassDescription(); }
 };
 
 /*! @file
@@ -40,10 +37,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/DriveMeBehavior.cc ./Behaviors/Demos/DriveMeBehavior.cc
--- ../Tekkotsu_2.2/Behaviors/Demos/DriveMeBehavior.cc	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/DriveMeBehavior.cc	Wed Nov 10 20:45:35 2004
@@ -18,7 +18,7 @@
 
 // ctor
 DriveMeBehavior::DriveMeBehavior()
-  : BehaviorBase(),
+  : BehaviorBase("DriveMeBehavior"),
     walker_id(MotionManager::invalid_MC_ID),
     stand_id(MotionManager::invalid_MC_ID),
     stand(),
@@ -109,9 +109,9 @@
  * @author tss (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/DriveMeBehavior.h ./Behaviors/Demos/DriveMeBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/DriveMeBehavior.h	Fri Jul 25 16:18:05 2003
+++ ./Behaviors/Demos/DriveMeBehavior.h	Wed Nov 10 20:45:36 2004
@@ -20,8 +20,8 @@
 
 	virtual void processEvent(const EventBase& event);
 			
-	virtual std::string getName() const { return "DriveMeBehavior"; }
 	static std::string getClassDescription() { return "Prompts for walk parameters and duration on system console (blocking read), and then executes, repeat until deactivation"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 
 protected:
 	MotionManager::MC_ID walker_id; //!< walks
@@ -39,10 +39,10 @@
  * @author tss (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
- * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/ExploreMachine.h ./Behaviors/Demos/ExploreMachine.h
--- ../Tekkotsu_2.2/Behaviors/Demos/ExploreMachine.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/ExploreMachine.h	Thu Nov 11 16:32:14 2004
@@ -16,14 +16,14 @@
 public:
 	//!constructor
 	ExploreMachine()
-		: StateNode("ExploreMachine"), start(NULL), turn(NULL), walkid(MotionManager::invalid_MC_ID)
+		: StateNode("ExploreMachine","ExploreMachine"), start(NULL), turn(NULL), walkid(MotionManager::invalid_MC_ID)
 	{
 		setRetain(false);
 	}
 
 	//!constructor
 	ExploreMachine(const std::string& nm, StateNode* p=NULL)
-		: StateNode(nm,p), start(NULL), turn(NULL), walkid(MotionManager::invalid_MC_ID)
+		: StateNode("ExploreMachine",nm,p), start(NULL), turn(NULL), walkid(MotionManager::invalid_MC_ID)
 	{
 		setRetain(false);
 	}
@@ -102,10 +102,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/FollowHeadBehavior.cc ./Behaviors/Demos/FollowHeadBehavior.cc
--- ../Tekkotsu_2.2/Behaviors/Demos/FollowHeadBehavior.cc	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/FollowHeadBehavior.cc	Wed Nov 10 20:45:36 2004
@@ -8,7 +8,7 @@
 #include "Motion/PIDMC.h"
 
 FollowHeadBehavior::FollowHeadBehavior() :
-	BehaviorBase(),
+	BehaviorBase("FollowHeadBehavior"),
 	head_release(EventBase::buttonEGID,ChinButOffset,EventBase::activateETID,0),
 	head_lock(EventBase::buttonEGID,ChinButOffset,EventBase::deactivateETID,0),
 	clock(EventBase::timerEGID,0,EventBase::statusETID,250),
@@ -74,8 +74,8 @@
  *
  * $Author: ejt $
  * $Name $
- * $Revision: 1.1 $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/FollowHeadBehavior.h ./Behaviors/Demos/FollowHeadBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/FollowHeadBehavior.h	Thu Sep 25 11:26:23 2003
+++ ./Behaviors/Demos/FollowHeadBehavior.h	Wed Nov 10 20:45:36 2004
@@ -39,8 +39,8 @@
 	/*! After every clock pulse, sets walk in direction of head */
 	virtual void processEvent(const EventBase& e);
 
-	virtual std::string getName() const { return "FollowHeadBehavior"; }
 	static std::string getClassDescription() { return "Walks whereever you point the head - press the chin button to loosen the head, release to lock it"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 
  protected:
 	const EventBase head_release; //!< event mask for releasing head (chin button down)
@@ -54,10 +54,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
- * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/FreezeTestBehavior.h ./Behaviors/Demos/FreezeTestBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/FreezeTestBehavior.h	Fri Aug 27 18:10:10 2004
+++ ./Behaviors/Demos/FreezeTestBehavior.h	Wed Nov 10 20:45:36 2004
@@ -8,7 +8,7 @@
 //! Demonstrates an infinite loop condition in the Main process
 class FreezeTestBehavior : public BehaviorBase {
 public:
-	FreezeTestBehavior() : BehaviorBase()	{}
+	FreezeTestBehavior() : BehaviorBase("FreezeTestBehavior")	{}
 	
 	virtual void DoStart() {
 		//call superclass first for housekeeping:
@@ -30,16 +30,11 @@
 		//Hate to break it to you, but we're never going to get here...
 	}
 	
-	virtual std::string getName() const {
-		// Name is used for menus, or debugging.
-		return "FreezeTestBehavior";
-	}
-	
 	static std::string getClassDescription() {
 		// This string will be shown by the HelpControl or by the tooltips of the Controller GUI
 		return "A little demo of a Main process infinite loop freeze (yes, this hangs the AIBO)";
 	}
-	
+	virtual std::string getDescription() const { return getClassDescription(); }
 };
 
 /*! @file
@@ -47,10 +42,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/GroundPlaneBehavior.h ./Behaviors/Demos/GroundPlaneBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/GroundPlaneBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/GroundPlaneBehavior.h	Wed Nov 10 20:45:36 2004
@@ -16,7 +16,7 @@
 public:
 	//! constructor
 	GroundPlaneBehavior()
-		: BehaviorBase(),
+		: BehaviorBase("GroundPlaneBehavior"),
 			head_release(EventBase::buttonEGID,(state->robotDesign&WorldState::ERS7Mask)?(int)ERS7Info::HeadButOffset:(int)ERS2xxInfo::HeadFrButOffset,EventBase::activateETID,0),
 			head_lock(EventBase::buttonEGID,(state->robotDesign&WorldState::ERS7Mask)?(int)ERS7Info::HeadButOffset:(int)ERS2xxInfo::HeadFrButOffset,EventBase::deactivateETID,0),
 			clock(EventBase::timerEGID,0,EventBase::statusETID,250)
@@ -71,9 +71,8 @@
 		}
 	}
 
-	virtual std::string getName() const { return "GroundPlaneBehavior"; }
-
 	static std::string getClassDescription() { return "Reports the location of the center of the camera image on the ground plane"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	EventBase head_release, head_lock, clock;
@@ -84,10 +83,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/HeadLevelBehavior.h ./Behaviors/Demos/HeadLevelBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/HeadLevelBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/HeadLevelBehavior.h	Wed Nov 10 20:45:36 2004
@@ -17,7 +17,7 @@
  public:
 	//! constructor
 	HeadLevelBehavior()
-		: BehaviorBase(),
+		: BehaviorBase("HeadLevelBehavior"),
 			head_release(EventBase::buttonEGID,0,EventBase::activateETID,0),
 			head_lock(EventBase::buttonEGID,0,EventBase::deactivateETID,0),
 			head(),
@@ -69,8 +69,8 @@
 		} else
 			ASSERTRET(false,"received unasked for event "<<event.getName());
 	}
-	virtual std::string getName() const { return "HeadLevelBehavior"; }
 	static std::string getClassDescription() { return "Uses the internal accelerometers to attempt to keep the head level."; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 
  protected:
 	EventBase head_release; //!< event mask for releasing head (chin button down)
@@ -85,10 +85,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif 
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/HelloWorldBehavior.h ./Behaviors/Demos/HelloWorldBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/HelloWorldBehavior.h	Mon Oct  6 20:59:33 2003
+++ ./Behaviors/Demos/HelloWorldBehavior.h	Wed Nov 10 20:45:36 2004
@@ -8,7 +8,11 @@
 //! Demonstrates serr, sout, and cout
 class HelloWorldBehavior : public BehaviorBase {
 public:
-	HelloWorldBehavior() : BehaviorBase()	{}
+	//Note that we pass the name of our class as an argument to the
+	//BehaviorBase constructor.  This is used for the default name for
+	//instances of this class, and may allow more readable debugging
+	//information
+	HelloWorldBehavior() : BehaviorBase("HelloWorldBehavior")	{}
 	
 	virtual void DoStart() {
 		//call superclass first for housekeeping:
@@ -25,18 +29,19 @@
 			printf("Hello printf!  This is %d\n",i);
 
 		//we'll just stop right away since this Behavior has no 'active' state.
-		DoStop();
-	}
-	
-	virtual std::string getName() const {
-		// Name is used for menus, or debugging.
-		return "HelloWorldBehavior";
+		DoStop(); //Note that you could also override this DoStop function...
 	}
 	
 	static std::string getClassDescription() {
-		// This string will be shown by the HelpControl or by the tooltips of the Controller GUI
+		// This string will be shown by the HelpControl or by the tooltips
+		// of the Controller GUI (not required, but nice)
 		return "A little demo of text output";
 	}
+	virtual std::string getDescription() const {
+		// We override this function to return the string we supplied
+		// above (not required, but nice)
+		return getClassDescription();
+	}
 	
 };
 
@@ -45,10 +50,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
- * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/KinematicSampleBehavior.h ./Behaviors/Demos/KinematicSampleBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/KinematicSampleBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/KinematicSampleBehavior.h	Wed Nov 10 20:45:36 2004
@@ -17,7 +17,7 @@
 public:
 	//! constructor
 	KinematicSampleBehavior()
-		: BehaviorBase(), lastLeg(LFrLegOrder), poseID(MotionManager::invalid_MC_ID)
+		: BehaviorBase("KinematicSampleBehavior"), lastLeg(LFrLegOrder), poseID(MotionManager::invalid_MC_ID)
 	{ }
 
 	virtual void DoStart() {
@@ -95,9 +95,8 @@
 		}
 	}
 
-	virtual std::string getName() const { return "KinematicSampleBehavior"; }
-
 	static std::string getClassDescription() { return "Uses kinematics to mirror leg positions (note that it mirrors the paw position - not necessarily the joint angles used to get there!)"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	unsigned int getIndex(LegOrder_t leg) {
@@ -113,10 +112,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/KinematicSampleBehavior2.h ./Behaviors/Demos/KinematicSampleBehavior2.h
--- ../Tekkotsu_2.2/Behaviors/Demos/KinematicSampleBehavior2.h	Tue Oct 19 13:06:51 2004
+++ ./Behaviors/Demos/KinematicSampleBehavior2.h	Wed Nov 10 20:45:36 2004
@@ -17,7 +17,7 @@
 public:
 	//! constructor
 	KinematicSampleBehavior2()
-		: BehaviorBase(), lastLeg(LFrLegOrder), poseID(MotionManager::invalid_MC_ID)
+		: BehaviorBase("KinematicSampleBehavior2"), lastLeg(LFrLegOrder), poseID(MotionManager::invalid_MC_ID)
 	{ }
 
 	virtual void DoStart() {
@@ -150,9 +150,8 @@
 		}
 	}
 
-	virtual std::string getName() const { return "KinematicSampleBehavior2"; }
-
 	static std::string getClassDescription() { return "Uses kinematics to make the back toe (Toe{LR}BkPaw) touch the lower thigh (Lower{LeftBackL,RightBackR}FrThigh)"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	LegOrder_t lastLeg;
@@ -164,10 +163,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/LookForSoundBehavior.h ./Behaviors/Demos/LookForSoundBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/LookForSoundBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/LookForSoundBehavior.h	Wed Nov 10 20:45:36 2004
@@ -10,7 +10,7 @@
 class LookForSoundBehavior : public BehaviorBase {
 public:
 	//! constructor
-	LookForSoundBehavior() : BehaviorBase(), mc_id(MotionManager::invalid_MC_ID){}
+	LookForSoundBehavior() : BehaviorBase("LookForSoundBehavior"), mc_id(MotionManager::invalid_MC_ID){}
 
 	virtual void DoStart()
 	{
@@ -62,9 +62,8 @@
 		}
 	}
 
-	virtual std::string getName() const { return "LookForSoundBehavior"; }
-
 	static std::string getClassDescription() { return "Looking for Sound Behavior Class"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	MotionManager::MC_ID mc_id;
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/MCRepeater.h ./Behaviors/Demos/MCRepeater.h
--- ../Tekkotsu_2.2/Behaviors/Demos/MCRepeater.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/MCRepeater.h	Wed Nov 10 20:45:36 2004
@@ -11,7 +11,7 @@
 class MCRepeater : public BehaviorBase {
 public:
 	//! constructor
-	MCRepeater(const SharedObjectBase* sharedmc) : BehaviorBase(), mc(sharedmc) {}
+	MCRepeater(const SharedObjectBase* sharedmc) : BehaviorBase("MCRepeater"), mc(sharedmc) {}
 
 	virtual void DoStart() {
 		BehaviorBase::DoStart(); // do this first
@@ -30,9 +30,8 @@
 		erouter->addListener(this,EventBase::motmanEGID,id,EventBase::deactivateETID);
 	}
 
-	virtual std::string getName() const { return "MCRepeater"; }
-
 	static std::string getClassDescription() { return "Sends a given MotionCommand to MotionManager, waits until it autoprunes, and then sends it again."; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	const SharedObjectBase* mc; //!< the motion command being repeated
@@ -47,10 +46,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/MotionStressTestBehavior.h ./Behaviors/Demos/MotionStressTestBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/MotionStressTestBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/MotionStressTestBehavior.h	Wed Nov 10 20:45:36 2004
@@ -12,7 +12,7 @@
 class MotionStressTestBehavior : public BehaviorBase {
 public:
 	//! constructor
-	MotionStressTestBehavior() : BehaviorBase(), nextLeg(RBkLegOrder), curMotions() {}
+	MotionStressTestBehavior() : BehaviorBase("MotionStressTestBehavior"), nextLeg(RBkLegOrder), curMotions() {}
 
 	virtual void DoStart() {
 		BehaviorBase::DoStart(); // do this first
@@ -74,9 +74,8 @@
 		cout << get_time() << "\tAdded id " << id << endl;
 	}
 
-	virtual std::string getName() const { return "MotionStressTestBehavior"; }
-
 	static std::string getClassDescription() { return "uses a separate MotionCommand for each of several joints to test for region leaks"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	LegOrder_t nextLeg;
@@ -88,10 +87,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/PaceTargetsMachine.cc ./Behaviors/Demos/PaceTargetsMachine.cc
--- ../Tekkotsu_2.2/Behaviors/Demos/PaceTargetsMachine.cc	Sun Dec  7 19:20:57 2003
+++ ./Behaviors/Demos/PaceTargetsMachine.cc	Wed Nov 10 20:45:36 2004
@@ -62,11 +62,12 @@
 }
 
 void PaceTargetsMachine::teardown() {
-	//preload the sounds
+	//release the sounds
 	sndman->ReleaseFile("cutey.wav");
 	sndman->ReleaseFile("barkmed.wav");
 	sndman->ReleaseFile("whimper.wav");
 	sndman->ReleaseFile("fart.wav");
+	StateNode::teardown();
 }
 
 /*! @file
@@ -74,9 +75,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/PaceTargetsMachine.h ./Behaviors/Demos/PaceTargetsMachine.h
--- ../Tekkotsu_2.2/Behaviors/Demos/PaceTargetsMachine.h	Sun Jan 18 05:16:56 2004
+++ ./Behaviors/Demos/PaceTargetsMachine.h	Thu Nov 11 16:32:14 2004
@@ -9,7 +9,7 @@
 class PaceTargetsMachine : public StateNode {
 public:
 	//!constructor
-	PaceTargetsMachine() : StateNode("PaceTargetsMachine"), start(NULL) {}
+	PaceTargetsMachine() : StateNode("PaceTargetsMachine","PaceTargetsMachine"), start(NULL) {}
 
 	virtual void setup();
 	virtual void DoStart();
@@ -29,10 +29,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/RelaxBehavior.h ./Behaviors/Demos/RelaxBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/RelaxBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/RelaxBehavior.h	Wed Nov 10 20:45:36 2004
@@ -15,7 +15,7 @@
 class RelaxBehavior : public BehaviorBase {
 public:
 	//! contstructor
-	RelaxBehavior() : BehaviorBase(), pidMCID(MotionManager::invalid_MC_ID) {}
+	RelaxBehavior() : BehaviorBase("RelaxBehavior"), pidMCID(MotionManager::invalid_MC_ID) {}
 	
 	virtual void DoStart() {
 		BehaviorBase::DoStart();
@@ -36,7 +36,8 @@
 		motman->addPrunableMotion(SharedObject<PIDMC>(1));
 		BehaviorBase::DoStop();
 	}
-	virtual std::string getName() const { return "RelaxBehavior"; }
+	static std::string getClassDescription() { return "Sets PID parameters for all applicable joints to 0, allowing the joints to move freely, reducing noise and power consumption"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 protected:
 	MotionManager::MC_ID pidMCID; //!< the id for the pid motion command
 };
@@ -49,8 +50,8 @@
  * @author ejt (Modifications)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/SimpleChaseBallBehavior.h ./Behaviors/Demos/SimpleChaseBallBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/SimpleChaseBallBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/SimpleChaseBallBehavior.h	Wed Nov 10 20:45:36 2004
@@ -19,7 +19,7 @@
 public:
 	//!constructor
 	SimpleChaseBallBehavior()
-		: BehaviorBase(), walker_id(MotionManager::invalid_MC_ID)
+		: BehaviorBase("SimpleChaseBallBehavior"), walker_id(MotionManager::invalid_MC_ID)
 	{}
 	//!destructor
 	virtual ~SimpleChaseBallBehavior() {}
@@ -49,8 +49,6 @@
 		}
 	}
 			
-	virtual std::string getName() const { return "SimpleChaseBallBehavior"; } 
-
 protected:
 	MotionManager::MC_ID walker_id;      //!< a WalkMC object
 };
@@ -60,10 +58,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/SoundTestBehavior.h ./Behaviors/Demos/SoundTestBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/SoundTestBehavior.h	Tue Dec 23 01:33:42 2003
+++ ./Behaviors/Demos/SoundTestBehavior.h	Wed Nov 10 20:45:36 2004
@@ -22,7 +22,7 @@
 public:
 	//! Constructor
 	SoundTestBehavior()
-		: BehaviorBase(), curplay(SoundManager::invalid_Play_ID), endtime(0),
+		: BehaviorBase("SoundTestBehavior"), curplay(SoundManager::invalid_Play_ID), endtime(0),
 			LFr(EventBase::buttonEGID,LFrPawOffset,EventBase::activateETID),
 			RFr(EventBase::buttonEGID,RFrPawOffset,EventBase::activateETID),
 			LBk(EventBase::buttonEGID,LBkPawOffset,EventBase::activateETID),
@@ -79,8 +79,9 @@
 	}
 
 	//! returns name to system
-	virtual std::string getName() const { return "SoundTestBehavior"; }
 	static std::string getClassDescription() { return "Plays different sounds when buttons are pressed.  Holding the chin button queues the sounds."; }
+	virtual std::string getDescription() const { return getClassDescription(); }
+
 protected:
 	//! called when a button is pressed - checks if it should enqueue or just play
 	void play(const char* name) {
@@ -120,10 +121,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/StareAtBallBehavior.h ./Behaviors/Demos/StareAtBallBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/StareAtBallBehavior.h	Thu Sep 25 11:26:23 2003
+++ ./Behaviors/Demos/StareAtBallBehavior.h	Thu Nov 11 19:05:03 2004
@@ -10,7 +10,7 @@
 public:
 	//!constructor
 	StareAtBallBehavior()
-		: BehaviorBase(), headpointer_id(MotionManager::invalid_MC_ID)
+		: BehaviorBase("StareAtBallBehavior"), headpointer_id(MotionManager::invalid_MC_ID)
 	{}
 	//!destructor
 	virtual ~StareAtBallBehavior() {}
@@ -24,8 +24,8 @@
 	//! sets the head to point at the object and sets the body to move where the head points
 	virtual void processEvent(const EventBase& event);
 			
-	virtual std::string getName() const { return "StareAtBallBehavior"; }
-	static std::string getClassDescription() { return "Tracks any objects seen by the vision system"; }
+	static std::string getClassDescription() { return "Tracks any pink objects seen by the vision system"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 
 protected:
 	MotionManager::MC_ID headpointer_id; //!< a HeadPointerMC object
@@ -36,10 +36,10 @@
  * @author tss (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
- * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/StareAtPawBehavior.h ./Behaviors/Demos/StareAtPawBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/StareAtPawBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/StareAtPawBehavior.h	Wed Nov 10 20:45:36 2004
@@ -15,7 +15,7 @@
 public:
 	//! constructor
 	StareAtPawBehavior()
-		: BehaviorBase(), lastLeg(LFrLegOrder), pointID(MotionManager::invalid_MC_ID)
+		: BehaviorBase("StareAtPawBehavior"), lastLeg(LFrLegOrder), pointID(MotionManager::invalid_MC_ID)
 	{ }
 
 	virtual void DoStart() {
@@ -78,9 +78,8 @@
 		}
 	}
 
-	virtual std::string getName() const { return "StareAtPawBehavior"; }
-
 	static std::string getClassDescription() { return "Uses kinematics to track the paw which last received a button press with the camera"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	LegOrder_t lastLeg;
@@ -93,10 +92,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/StareAtPawBehavior2.h ./Behaviors/Demos/StareAtPawBehavior2.h
--- ../Tekkotsu_2.2/Behaviors/Demos/StareAtPawBehavior2.h	Sat Oct 16 21:32:24 2004
+++ ./Behaviors/Demos/StareAtPawBehavior2.h	Wed Nov 10 20:45:36 2004
@@ -18,7 +18,7 @@
 public:
 	//! constructor
 	StareAtPawBehavior2()
-		: BehaviorBase(), lastLeg(LFrLegOrder), pointID(MotionManager::invalid_MC_ID)
+		: BehaviorBase("StareAtPawBehavior2"), lastLeg(LFrLegOrder), pointID(MotionManager::invalid_MC_ID)
 	{ }
 
 	virtual void DoStart() {
@@ -67,9 +67,8 @@
 
 			//Compute neck angles
 			PostureEngine pose;
-			NEWMAT::ColumnVector Plink(4); Plink=0; Plink(3)=1; //infinite ray along z axis, maximizes distance from camera to objective
-			//NEWMAT::ColumnVector Plink(4); Plink=0; Plink(3)=80; Plink(4)=1; //keep head 8cm away from paw
-			//Alternatively, could also use the pack function a la: Plink=Kinematics::pack(0,0,80);
+			NEWMAT::ColumnVector Plink=Kinematics::pack(0,0,1,0); //infinite ray along z axis - maximize distance from paw
+			//NEWMAT::ColumnVector Plink=Kinematics::pack(0,0,80,1); //or, keep head 8cm away from paw
 			pose.solveLinkVector(Pobj,CameraFrameOffset,Plink);
 			
 			//Set joint values
@@ -79,9 +78,8 @@
 		}
 	}
 
-	virtual std::string getName() const { return "StareAtPawBehavior2"; }
-
 	static std::string getClassDescription() { return "Uses kinematics to track the paw which last received a button press with the camera"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	LegOrder_t lastLeg;
@@ -93,10 +91,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/ToggleHeadLightBehavior.h ./Behaviors/Demos/ToggleHeadLightBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/ToggleHeadLightBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/ToggleHeadLightBehavior.h	Wed Nov 10 20:45:36 2004
@@ -10,7 +10,7 @@
 class ToggleHeadLightBehavior : public BehaviorBase {
 public:
 	//! constructor
-	ToggleHeadLightBehavior() : BehaviorBase(), light_id(MotionManager::invalid_MC_ID) {}
+	ToggleHeadLightBehavior() : BehaviorBase("ToggleHeadLightBehavior"), light_id(MotionManager::invalid_MC_ID) {}
 
 	//! opens the head light
 	virtual void DoStart() {
@@ -28,8 +28,7 @@
 	}
 
 	static std::string getClassDescription() { return "Opens or closes the head light on an ERS-220"; }
-
-	std::string getName() const { return "ToggleHeadLightBehavior"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 
 protected:
 	MotionManager::MC_ID light_id; //!< id value of the PostureMC used to control the light
@@ -40,10 +39,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/WalkToTargetMachine.cc ./Behaviors/Demos/WalkToTargetMachine.cc
--- ../Tekkotsu_2.2/Behaviors/Demos/WalkToTargetMachine.cc	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Demos/WalkToTargetMachine.cc	Sat Oct 16 21:16:10 2004
@@ -82,7 +82,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/WalkToTargetMachine.h ./Behaviors/Demos/WalkToTargetMachine.h
--- ../Tekkotsu_2.2/Behaviors/Demos/WalkToTargetMachine.h	Sun Jan 18 05:16:56 2004
+++ ./Behaviors/Demos/WalkToTargetMachine.h	Thu Nov 11 16:32:14 2004
@@ -12,7 +12,7 @@
 public:
 	//!constructor, pass success (close), failure (lost), and parent nodes, and VisionObjectSourceID_t
 	WalkToTargetMachine(unsigned int obj,StateNode* c=NULL, StateNode* l=NULL,StateNode* p=NULL)
-		: StateNode("WalkToTarget",p),tracking(obj),timeout(NULL),closeTrans(NULL),close(c),lost(l),
+		: StateNode("WalkToTarget","WalkToTarget",p),tracking(obj),timeout(NULL),closeTrans(NULL),close(c),lost(l),
 			walker_id(MotionManager::invalid_MC_ID), headpointer_id(MotionManager::invalid_MC_ID) 
 	{}
 	
@@ -24,6 +24,7 @@
 	virtual void teardown();
 
 	static std::string getClassDescription() { return "walks towards a visual target until it gets \"close\""; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 
 	//uses head to watch ball, walks towards it
 	virtual void processEvent(const EventBase& event);
@@ -51,10 +52,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/WallTestBehavior.cc ./Behaviors/Demos/WallTestBehavior.cc
--- ../Tekkotsu_2.2/Behaviors/Demos/WallTestBehavior.cc	Wed Dec 31 19:00:00 1969
+++ ./Behaviors/Demos/WallTestBehavior.cc	Tue Nov 16 14:22:42 2004
@@ -0,0 +1,231 @@
+#include "WallTestBehavior.h"
+#include "Shared/newmat/newmat.h"
+#include "Shared/newmat/newmatap.h"
+#include "Events/EventRouter.h"
+#include "Motion/MotionManager.h"
+#include "Motion/MotionSequenceMC.h"
+#include "Shared/Config.h"
+#include "Shared/WorldState.h"
+#include "Shared/newmat/newmatio.h"
+#include <fstream>
+
+void
+WallTestBehavior::DoStart() {
+	BehaviorBase::DoStart(); // do this first
+	int startrec,stoprec;
+	SharedObject<MotionSequenceMC<MotionSequence::SizeSmall> > pan;
+	pan->setPlayTime(startrec=reposTime);
+	pan->setPose(PostureEngine(config->motion.makePath("stand.pos").c_str()));
+	pan->setOutputCmd(HeadOffset+TiltOffset,0);
+	pan->setOutputCmd(HeadOffset+PanOffset,outputRanges[HeadOffset+PanOffset][MaxRange]);
+	pan->setOutputCmd(HeadOffset+RollOffset,0);
+	pan->setPlayTime(stoprec=pan->getPlayTime()+panTime);
+	pan->setOutputCmd(HeadOffset+TiltOffset,0);
+	pan->setOutputCmd(HeadOffset+PanOffset,outputRanges[HeadOffset+PanOffset][MinRange]);
+	pan->setOutputCmd(HeadOffset+RollOffset,0);
+	pan->setPlayTime(pan->getPlayTime()+reposTime);
+	pan->setOutputCmd(HeadOffset+TiltOffset,0);
+	pan->setOutputCmd(HeadOffset+PanOffset,0);
+	pan->setOutputCmd(HeadOffset+RollOffset,0);
+	pan->setPlayTime(pan->getPlayTime()+reposTime);
+	pan->setOutputCmd(HeadOffset+TiltOffset,0);
+	pan->setOutputCmd(HeadOffset+PanOffset,0);
+	pan->setOutputCmd(HeadOffset+RollOffset,0);
+	motman->addPrunableMotion(pan);
+	erouter->addTimer(this,0,startrec+lagTime,false);
+	erouter->addTimer(this,1,stoprec+lagTime,false);
+}
+
+void
+WallTestBehavior::DoStop() {
+	erouter->removeListener(this);
+	BehaviorBase::DoStop(); // do this last
+}
+
+void
+WallTestBehavior::processEvent(const EventBase& e) {
+	if(e.getGeneratorID()==EventBase::sensorEGID) {
+#ifdef TGT_ERS7
+		float nd = state->sensors[NearIRDistOffset];
+		if(false && nd<350) //force always use the far sensor - near is crappy(ier); without the 'false', would use either one
+			usedNear.push_back(true);
+		else {
+			nd=state->sensors[FarIRDistOffset];
+			usedNear.push_back(false);
+		}
+#else //not TGT_ERS7
+		float nd = state->sensors[IRDistOffset];
+#endif //not TGT_ERS7
+		float na = state->outputs[HeadOffset+PanOffset];
+		//cout << nd << ' ' << na << endl;
+		d.push_back(nd);
+		a.push_back(na);
+
+	} else if(e.getSourceID()==0) {
+		erouter->addListener(this,EventBase::sensorEGID,SensorSourceID::UpdatedSID);
+	} else if(e.getSourceID()==1) {
+		erouter->removeListener(this,EventBase::sensorEGID);
+				
+		PostureEngine pose;
+		pose.clear();
+		//float legheight=NEWMAT::ColumnVector(pose.getFrameInterestPoint(BaseFrameOffset,"LFrPaw"))(3);
+
+		cout << "Logging Non-Kinematic calculations to /data/raw_xy.txt" << endl;
+		{
+			ofstream rawxy("/ms/data/raw_xy.txt");
+			if(!rawxy) {
+				cout << "Could not open file" << endl;
+			} else {
+				cout << "Columns are:\tx\ty" << endl;
+				for(unsigned int i=0; i<d.size(); i++)
+					rawxy << d[i]*cos(a[i]) << '\t' << d[i]*sin(a[i]) << '\n';
+			}
+		}
+
+		cout << "Logging uncalibrated kinematic calculations to /data/k_xyz.txt" << endl;
+		//assumes IR is parallel to camera
+		{
+			ofstream kxys("/ms/data/k_xyz.txt");
+			if(!kxys) {
+				cout << "Could not open file" << endl;
+			} else {
+#ifdef TGT_ERS7
+				cout << "Columns are:\tx\ty\tz\tis_using_near" << endl;
+				float off=NEWMAT::ColumnVector(pose.getFrameInterestPoint(CameraFrameOffset,"NearIR"))(3);
+#else //not TGT_ERS7
+				cout << "Columns are:\tx\ty\tz" << endl;
+				float off=NEWMAT::ColumnVector(pose.getFrameInterestPoint(CameraFrameOffset,"IR"))(3);
+#endif //not TGT_ERS7
+				for(unsigned int i=0; i<d.size(); i++) {
+					pose(HeadOffset+PanOffset)=a[i];
+					NEWMAT::ColumnVector hit=pose.frameToBase(CameraFrameOffset)*Kinematics::pack(0,0,d[i]+off);
+#ifdef TGT_ERS7
+					kxys << hit(1) << '\t' << hit(2) << '\t' << hit(3) << '\t' << usedNear[i] << '\n';
+#else //not TGT_ERS7
+					kxys << hit(1) << '\t' << hit(2) << '\t' << hit(3) << '\n';
+#endif //not TGT_ERS7
+				}
+			}
+		}
+
+		cout << "Logging calibrated kinematic calculations to /data/ck_xyz.txt" << endl;
+		{
+			ofstream ckxys("/ms/data/ck_xyz.txt");
+			if(!ckxys) {
+				cout << "Could not open file" << endl;
+			} else {
+#ifdef TGT_ERS7
+				cout << "Columns are:\tx\ty\tz\tis_using_near" << endl;
+#else //not TGT_ERS7
+				cout << "Columns are:\tx\ty\tz" << endl;
+#endif //not TGT_ERS7
+				for(unsigned int i=0; i<d.size(); i++) {
+					pose(HeadOffset+PanOffset)=a[i];
+#ifdef TGT_ERS7
+					unsigned int frame=usedNear[i]?NearIRFrameOffset:FarIRFrameOffset;
+					NEWMAT::ColumnVector hit=pose.frameToBase(frame)*Kinematics::pack(0,0,d[i]);
+					ckxys << hit(1) << '\t' << hit(2) << '\t' << hit(3) << '\t' << usedNear[i] << '\n';
+#else //not TGT_ERS7
+					NEWMAT::ColumnVector hit=pose.frameToBase(IRFrameOffset)*Kinematics::pack(0,0,d[i]);
+					ckxys << hit(1) << '\t' << hit(2) << '\t' << hit(3) << '\n';
+#endif //not TGT_ERS7
+				}
+			}
+		}
+
+		//find data regions
+		unsigned int start[3];
+		unsigned int stop[3];
+		start[0]=stop[0]=0;
+		while(a[stop[0]++]>60*M_PI/180 && stop[0]<a.size()) ;
+		start[1]=stop[0];
+		while(a[start[1]++]>30*M_PI/180 && start[1]<a.size()) ;
+		stop[1]=start[1];
+		while(a[stop[1]++]>-30*M_PI/180 && stop[1]<a.size()) ;
+		start[2]=stop[1];
+		while(a[start[2]++]>-60*M_PI/180 && start[2]<a.size()) ;
+		stop[2]=a.size();
+			
+		cout << "Regions are: ";
+		for(int i=0; i<3; i++)
+			cout << start[i] << "-" << stop[i] << (i==2?"":", ");
+		cout << endl;
+
+		for(int w=0; w<3; w++) {
+			cout << "Wall "<<w<<": ";
+			//convert radial coordinates to x,y coordinates
+			int n=stop[w]-start[w];
+			if(n<3) {
+				cout << "not enough data - did you forget to turn off estop?" << endl;
+				continue;
+			}
+			vector<float> x,y;
+			for(unsigned int i=start[w]; i<stop[w]; i++) {
+#ifdef TGT_ERS7
+				if(d[i]==200 || d[i]>1500) //limits for the far sensor, near sensor is [50,500]
+					continue;
+#else //not ers-7
+				if(d[i]==100 || d[i]>700)
+					continue;
+#endif //not ers-7
+				x.push_back(d[i]*cos(a[i]));
+				y.push_back(d[i]*sin(a[i]));
+			}
+			cout << "(" << x.size() << " valid samples)" << endl;
+			if(x.size()<3) {
+				cout << "No wall" << endl;
+				continue;
+			}
+
+			float x0=0,x1=0;
+			TimeET t;
+
+			t.Set();
+			solve1(x,y,x0,x1);
+			cout << "   QR: 'y = "<<x0<<"x + "<<x1<<"'\tTime:"<<t.Age()<<endl;
+
+			t.Set();
+			solve2(x,y,x0,x1);
+			cout << "  SVD: '"<<x0<<"x + "<<x1<<"y = 1'\tTime:"<<t.Age()<<endl;
+		}
+	}
+}
+
+void
+WallTestBehavior::solve1(const std::vector<float>& x, const std::vector<float>& y, float& x0, float& x1) {
+	NEWMAT::Matrix A(x.size(),2); //x values in first column, 1's in second column (homogenous coordinates)
+	NEWMAT::ColumnVector b(x.size()); //vector of y values
+	for(unsigned int i=0; i<x.size(); i++) {
+		A(i+1,1)=x[i];
+		A(i+1,2)=1;
+		b(i+1)=y[i];
+	}
+
+	NEWMAT::UpperTriangularMatrix U;
+	NEWMAT::Matrix M;
+
+	NEWMAT::QRZ(A,U);
+	NEWMAT::QRZ(A,b,M);
+	NEWMAT::ColumnVector dq = U.i()*M;
+
+	x0=dq(1);
+	x1=dq(2);
+}
+
+void
+WallTestBehavior::solve2(const std::vector<float>& x, const std::vector<float>& y, float& x0, float& x1) {
+	NEWMAT::Matrix A(x.size(),3); //x values in first column, y's in the second, -1's in third column (homogenous coordinates)
+	for(unsigned int i=0; i<x.size(); i++) {
+		A(i+1,1)=x[i];
+		A(i+1,2)=y[i];
+		A(i+1,3)=-1;
+	}
+	
+	NEWMAT::DiagonalMatrix Q;
+	NEWMAT::Matrix U,V;
+	
+	NEWMAT::SVD(A,Q,U,V,false,true);
+	
+	x0=V(1,V.ncols())/V(3,V.ncols());
+	x1=V(2,V.ncols())/V(3,V.ncols());
+}
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/WallTestBehavior.h ./Behaviors/Demos/WallTestBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Demos/WallTestBehavior.h	Wed Dec 31 19:00:00 1969
+++ ./Behaviors/Demos/WallTestBehavior.h	Mon Nov 15 19:11:46 2004
@@ -0,0 +1,55 @@
+//-*-c++-*-
+#ifndef INCLUDED_WallTestBehavior_h_
+#define INCLUDED_WallTestBehavior_h_
+
+#include "Behaviors/BehaviorBase.h"
+#include <vector>
+
+namespace NEWMAT {
+	class Matrix;
+	class ColumnVector;
+};
+
+//! measures the relative angle of any walls to the front, left, or right
+/*! Making a special cameo appearance in solve1() and solve2(), linear least squares solution using newmat library */
+class WallTestBehavior : public BehaviorBase {
+public:
+	//! constructor
+	WallTestBehavior() : BehaviorBase("WallTestBehavior"), d(), a(), usedNear() {}
+
+	virtual void DoStart();
+	virtual void DoStop();
+	virtual void processEvent(const EventBase& e);
+
+	//! Takes a series of measurements, returns slope and intercept of linear least square fit (use QR)
+	/*! Uses QR factorization to solve \f$ax+b=y\f$ where we know @e x and @e y, and solve for @e a and @e b */
+	void solve1(const std::vector<float>& x, const std::vector<float>& y, float& x0, float& x1);
+	//! Takes a series of measurements, returns slope and intercept of linear least square fit (uses SVD)
+	/*! Uses SVD factorization to solve \f$ax+by=1\f$ where we know @e x and @e y, and solve for @e a and @e b */
+	void solve2(const std::vector<float>& x, const std::vector<float>& y, float& x0, float& x1);
+
+	static std::string getClassDescription() { return "Measures the relative angle of surrounding walls"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
+	
+protected:
+	std::vector<float> d; //!< log of distance measurement for each sample
+	std::vector<float> a; //!< log of head angle for each sample
+	std::vector<bool> usedNear; //!< only used with ERS-7, records whether the sample is from near or far IR sensor
+
+	static const unsigned int reposTime=750; //!< time to stand up
+	static const unsigned int panTime=3000;  //!< time for actual panning
+	static const unsigned int lagTime=128;   //!< time between when the panning is supposed to get to extremes and when it actually does
+};
+
+/*! @file
+ * @brief Defines WallTestBehavior, which measures the relative angle of any walls to the front, left, or right
+ * @author ejt (Creator)
+ *
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
+ */
+
+#endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/WorldStateVelDaemon.h ./Behaviors/Demos/WorldStateVelDaemon.h
--- ../Tekkotsu_2.2/Behaviors/Demos/WorldStateVelDaemon.h	Thu Oct  7 15:07:04 2004
+++ ./Behaviors/Demos/WorldStateVelDaemon.h	Wed Nov 10 20:45:36 2004
@@ -19,7 +19,7 @@
 class WorldStateVelDaemon : public BehaviorBase, public EventTrapper {
 public:
 	//! constructor
-	WorldStateVelDaemon() : BehaviorBase(), estopTime(1), old_x(0), old_y(0), old_a(0) {}
+	WorldStateVelDaemon() : BehaviorBase("WorldStateVelDaemon"), estopTime(1), old_x(0), old_y(0), old_a(0) {}
 
 	virtual void DoStart() {
 		BehaviorBase::DoStart(); // do this first
@@ -70,9 +70,8 @@
 		}
 	}
 
-	virtual std::string getName() const { return "WorldStateVelDaemon"; }
-
 	static std::string getClassDescription() { return "Keeps the WorldState's velocity fields up to date"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	unsigned int estopTime; //!< time estop activation was received
@@ -86,10 +85,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Demos/karmedbandit.h ./Behaviors/Demos/karmedbandit.h
--- ../Tekkotsu_2.2/Behaviors/Demos/karmedbandit.h	Thu Sep 18 18:40:27 2003
+++ ./Behaviors/Demos/karmedbandit.h	Thu Sep 18 18:40:27 2003
@@ -132,7 +132,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/Aibo3DControllerBehavior.h ./Behaviors/Mon/Aibo3DControllerBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Mon/Aibo3DControllerBehavior.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Mon/Aibo3DControllerBehavior.h	Wed Nov 10 20:45:36 2004
@@ -40,7 +40,7 @@
  public:
 	//! constructor
 	Aibo3DControllerBehavior() :
-	  BehaviorBase(),
+	  BehaviorBase("Aibo3DControllerBehavior"),
 	  rcontrol_id(MotionManager::invalid_MC_ID),
 	  cmdsock(NULL),
     fbuf((char*)val), pos(0)
@@ -110,12 +110,13 @@
 	//! returns port number the Java GUI should connect to
 	virtual unsigned int getPort() const { return config->main.aibo3d_port; }
 
-	virtual std::string getName() const { return "Aibo 3D"; } //!< returns name of behavior
 	static std::string getClassDescription() { 
 		char tmp[20];
 		sprintf(tmp,"%d",config->main.aibo3d_port);
 		return std::string("Listens to aibo3d control commands coming in from port ")+tmp;
 	}
+	virtual std::string getDescription() const { return getClassDescription(); }
+
 };
 
 
@@ -130,10 +131,10 @@
  * @author alokl (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif 
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/EStopControllerBehavior.cc ./Behaviors/Mon/EStopControllerBehavior.cc
--- ../Tekkotsu_2.2/Behaviors/Mon/EStopControllerBehavior.cc	Thu Oct  7 15:07:04 2004
+++ ./Behaviors/Mon/EStopControllerBehavior.cc	Thu Oct  7 15:07:04 2004
@@ -72,7 +72,7 @@
  * @author tss (Creator)
  * 
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/EStopControllerBehavior.h ./Behaviors/Mon/EStopControllerBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Mon/EStopControllerBehavior.h	Wed Jan 14 15:44:31 2004
+++ ./Behaviors/Mon/EStopControllerBehavior.h	Wed Nov 10 20:45:36 2004
@@ -23,7 +23,7 @@
 public:
 	//! constructor
 	EStopControllerBehavior(MotionManager::MC_ID estop)
-		: BehaviorBase(),
+		: BehaviorBase("EStopControllerBehavior"),
 			cmdsock(NULL),
 			estop_id(estop)
 	{
@@ -40,12 +40,12 @@
 
 	virtual void processEvent(const EventBase &);
 
-	virtual std::string getName() const { return "EStop Remote Control"; }
 	static std::string getClassDescription() {
 		char tmp[20];
 		sprintf(tmp,"%d",config->main.estopControl_port);
 		return std::string("Listens to estop commands coming in from port ")+tmp;
 	}
+	virtual std::string getDescription() const { return getClassDescription(); }
 
 	virtual void runCommand(const std::string& s); //!< processes a string received from wireless
 
@@ -67,10 +67,10 @@
  * @author tss (Creator)
  * 
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif 
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/HeadPointControllerBehavior.cc ./Behaviors/Mon/HeadPointControllerBehavior.cc
--- ../Tekkotsu_2.2/Behaviors/Mon/HeadPointControllerBehavior.cc	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Mon/HeadPointControllerBehavior.cc	Sat Oct 16 21:16:10 2004
@@ -124,7 +124,7 @@
  * @author tss (Creator)
  * 
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/HeadPointControllerBehavior.h ./Behaviors/Mon/HeadPointControllerBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Mon/HeadPointControllerBehavior.h	Thu Oct 14 17:59:14 2004
+++ ./Behaviors/Mon/HeadPointControllerBehavior.h	Wed Nov 10 20:45:36 2004
@@ -53,7 +53,7 @@
  public:
 	//! constructor
 	HeadPointControllerBehavior() :
-	  BehaviorBase(),
+	  BehaviorBase("HeadPointControllerBehavior"),
 	  head_id(MotionManager::invalid_MC_ID),
 	  t(0), p(0), r(0),
 	  theLastOne(theOne),
@@ -69,12 +69,12 @@
 	//! The only event we could possibly receive is the stop-if-no-heartbeat timer.
 	virtual void processEvent(const EventBase &) {}
 
-	virtual std::string getName() const { return "Head Remote Control"; }
 	static std::string getClassDescription() {
 		char tmp[20];
 		sprintf(tmp,"%d",config->main.headControl_port);
 		return std::string("Listens to head control commands coming in from port ")+tmp;
 	}
+	virtual std::string getDescription() const { return getClassDescription(); }
 };
 
 /*! @file
@@ -82,10 +82,10 @@
  * @author tss (Creator)
  * 
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif 
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/MicrophoneServer.cc ./Behaviors/Mon/MicrophoneServer.cc
--- ../Tekkotsu_2.2/Behaviors/Mon/MicrophoneServer.cc	Wed Dec 31 19:00:00 1969
+++ ./Behaviors/Mon/MicrophoneServer.cc	Fri Nov 12 17:07:39 2004
@@ -0,0 +1,245 @@
+#include "MicrophoneServer.h"
+
+#include "Events/DataEvent.h"
+#include "Events/EventRouter.h"
+#include "Shared/Config.h"
+#include "Wireless/Wireless.h"
+
+#include <OPENR/OPENRAPI.h>
+
+MicrophoneServer* MicrophoneServer::instance = 0;
+const char* const MicrophoneServer::MIC_LOCATOR = "PRM:/r1/c1/c2/c3/m1-Mic:M1";
+
+MicrophoneServer* MicrophoneServer::GetInstance() {
+	if (instance == 0) {
+		instance = new MicrophoneServer();
+	}
+	return instance;
+}
+
+MicrophoneServer::MicrophoneServer()
+	: BehaviorBase("Microphone Server"), socket(0) {
+		
+	AddReference();
+}
+
+MicrophoneServer::~MicrophoneServer() {
+	if (references == 1) {
+		instance = 0;
+	}
+}
+
+
+void MicrophoneServer::DoStart() {
+	BehaviorBase::DoStart();
+	
+	if (socket != 0) {
+		wireless->setDaemon(socket, false);
+		wireless->close(socket);
+		socket = 0;
+	}
+		
+	socket = wireless->socket(SocketNS::SOCK_STREAM, 512, SEND_BUFFER_SIZE);
+	wireless->setDaemon(socket, true);
+	wireless->listen(socket->sock, config->sound.streaming.mic_port);
+	
+	erouter->addListener(this, EventBase::micOSndEGID);
+}
+
+void MicrophoneServer::DoStop() {
+	erouter->removeListener(this);
+	
+	if (socket != 0) {
+		wireless->setDaemon(socket, false);
+		wireless->close(socket);
+		socket = 0;
+	}
+	
+	BehaviorBase::DoStop();
+}
+
+void MicrophoneServer::processEvent(const EventBase& event) {
+	if (event.getGeneratorID() != EventBase::micOSndEGID) {
+		return;
+	}
+	
+	// Got an audio frame from the microphone
+	if ((socket == 0) || (!wireless->isConnected(socket->sock))) {
+		return;
+	}
+	
+	const DataEvent<const OSoundVectorData*>* e =
+	  reinterpret_cast<const DataEvent<const OSoundVectorData*>*>(&event);
+	OSoundVectorData* data = const_cast<OSoundVectorData *>(e->getData());
+	const char* samples = reinterpret_cast<char*>(data->GetData(0));
+	const int samplesSize = data->GetInfo(0)->dataSize;
+	
+	unsigned int sampleRate = config->sound.streaming.mic_sample_rate;
+	unsigned int sampleBits = config->sound.streaming.mic_sample_bits;
+	bool stereo = config->sound.streaming.mic_stereo;
+	
+	unsigned int newSamplesSize = GetResampledFrameSize(samplesSize, sampleRate, sampleBits, stereo);
+	if (newSamplesSize == 0) {
+		return;
+	}
+	
+	const unsigned int headerSize = 8;
+	char* buf = (char*) socket->getWriteBuffer(headerSize + newSamplesSize);
+	if (buf == 0) {
+		// Network not ready, drop this frame
+		return;
+	}
+		
+	unsigned int resampledSize = 0;
+	resampledSize = ResampleFrame(samples, samplesSize, sampleRate, sampleBits, stereo, buf + headerSize, newSamplesSize);
+	if (resampledSize != newSamplesSize) {
+		return;
+	}
+	
+	encode(&buf, (unsigned short) (newSamplesSize + headerSize - 4));
+	encode(&buf, (unsigned short) 0); // PCM frame
+	encode(&buf, (unsigned short) sampleRate);
+	encode(&buf, (byte)	 sampleBits);
+	encode(&buf, stereo);
+
+	socket->write(headerSize + newSamplesSize);
+}
+
+unsigned int MicrophoneServer::GetResampledFrameSize(
+	unsigned int samplesSize,
+	unsigned int newSampleRate,
+	unsigned int newSampleBits,
+	bool newStereo) {
+	
+	if (newSampleRate > 16000) {
+		newSampleRate = 16000;
+	} else if (newSampleRate < 1) {
+		newSampleRate = 1;
+	}
+	
+	if (newSampleBits >= 12) {
+		newSampleBits = 16;
+	} else {
+		newSampleBits = 8;
+	}
+	
+	if ((newSampleRate == 16000) && (newSampleBits == 16) && (newStereo)) {
+		// No need to resample
+		return samplesSize;
+	} else {
+		// Resample from 16 kHz 16 bit stereo
+		const unsigned int frameCount = samplesSize / 4; 
+		const unsigned int newFrameCount = frameCount * newSampleRate / 16000;
+		const unsigned int newFrameSize =
+		((newSampleBits == 8) ? 1 : 2) * ((newStereo) ? 2 : 1);
+		return newFrameCount * newFrameSize;		
+	}
+}
+
+unsigned int MicrophoneServer::ResampleFrame(
+	const char* samples,
+	unsigned int samplesSize,
+	unsigned int& newSampleRate,
+	unsigned int& newSampleBits,
+	bool& newStereo,
+	void* buf,
+	unsigned int bufSize) {
+		 
+	
+	if (newSampleRate > 16000) {
+		newSampleRate = 16000;
+	} else if (newSampleRate < 1) {
+		newSampleRate = 1;
+	}
+	
+	if (newSampleBits >= 12) {
+		newSampleBits = 16;
+	} else {
+		newSampleBits = 8;
+	}
+			
+	if ((newSampleRate == 16000) && (newSampleBits == 16) && (newStereo)) {
+		// No need to resample
+		if (samplesSize <= bufSize) {
+			memcpy(buf, samples, samplesSize);
+			return samplesSize;
+		} else {
+			return 0;
+		}
+	} else {
+		// Resample from 16 kHz 16 bit stereo
+		const unsigned int frameCount = samplesSize / 4; 
+		const unsigned int newFrameCount = frameCount * newSampleRate / 16000;
+		const unsigned int newFrameSize =
+			((newSampleBits == 8) ? 1 : 2) * ((newStereo) ? 2 : 1);
+		unsigned int newSamplesSize = newFrameCount * newFrameSize;
+		if (newSamplesSize > bufSize) {
+			return 0;
+		}
+		
+		char* newSamplesChar = (char*) buf;
+		short* newSamplesShort = (short*) buf;
+		const short* samplesShort = (const short*) samples;
+		for (unsigned int newFrame = 0; newFrame < newFrameCount; newFrame++) {
+			const int frame = newFrame * 16000 / newSampleRate;
+			if (newSampleBits == 8) {
+				// 8-bit
+				if (newStereo) {
+					// 8-bit stereo
+					newSamplesChar[newFrame * 2 + 0] = samples[frame * 4 + 1];
+					newSamplesChar[newFrame * 2 + 1] = samples[frame * 4 + 3];
+				} else {
+					// 8-bit mono
+					newSamplesChar[newFrame] =
+						((int) samplesShort[frame * 2 + 0]
+							+ (int) samplesShort[frame * 2 + 1]) >> 9;
+				}
+			} else {
+				// 16-bit
+				if (newStereo) {
+					// 16-bit stereo
+					newSamplesShort[newFrame * 2 + 0] = samplesShort[frame * 2 + 0];
+					newSamplesShort[newFrame * 2 + 1] = samplesShort[frame * 2 + 1];
+				} else {
+					// 16-bit mono
+					newSamplesShort[newFrame] =
+						((int) samplesShort[frame * 2 + 0]
+							+ (int) samplesShort[frame * 2 + 1]) >> 1;
+				}
+			}
+		}
+		return newSamplesSize;
+	}
+}
+
+bool MicrophoneServer::SetMicrophoneUnidirectional(bool unidirectional) {
+	OPrimitiveID micID;
+	OStatus result = OPENR::OpenPrimitive(MIC_LOCATOR, &micID);
+	if (result != oSUCCESS) {
+		return false;
+	}
+	
+	result = OPENR::ControlPrimitive(
+		micID, ((unidirectional) ? oprmreqMIC_UNI : oprmreqMIC_OMNI),	0, 0, 0, 0);
+	if (result != oSUCCESS) {
+		return false;
+	}
+	
+	return true;
+}
+
+bool MicrophoneServer::SetMicrophoneAlcEnabled(bool enabled) {
+	OPrimitiveID micID;
+	OStatus result = OPENR::OpenPrimitive(MIC_LOCATOR, &micID);
+	if (result != oSUCCESS) {
+		return false;
+	}
+	
+	result = OPENR::ControlPrimitive(
+		micID, ((enabled) ? oprmreqMIC_ALC_ON : oprmreqMIC_ALC_OFF),	0, 0, 0, 0);
+	if (result != oSUCCESS) {
+		return false;
+	}
+	
+	return true;
+}
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/MicrophoneServer.h ./Behaviors/Mon/MicrophoneServer.h
--- ../Tekkotsu_2.2/Behaviors/Mon/MicrophoneServer.h	Wed Dec 31 19:00:00 1969
+++ ./Behaviors/Mon/MicrophoneServer.h	Fri Nov 12 17:07:39 2004
@@ -0,0 +1,62 @@
+//-*-c++-*-
+#ifndef INCLUDED_MicrophoneServer_h_
+#define INCLUDED_MicrophoneServer_h_
+
+#include "Events/EventBase.h"
+#include "Behaviors/BehaviorBase.h"
+
+//! Streams audio from the microphone over the network
+class MicrophoneServer : public BehaviorBase {
+	public:
+		static MicrophoneServer* GetInstance();
+		virtual ~MicrophoneServer();
+		
+		virtual void DoStart();
+		virtual void DoStop();
+		virtual void processEvent(const EventBase& event);
+		
+		static bool SetMicrophoneUnidirectional(bool unidirectional);
+		static bool SetMicrophoneAlcEnabled(bool enabled);
+		
+	private:
+		static const unsigned int SEND_BUFFER_SIZE = 2048 + 16;
+	
+		MicrophoneServer();
+		MicrophoneServer(const MicrophoneServer& rhs);
+		MicrophoneServer& operator=(const MicrophoneServer& rhs);
+		static MicrophoneServer* instance;
+		
+		unsigned int GetResampledFrameSize(
+			unsigned int samplesSize,
+			unsigned int newSampleRate,
+			unsigned int newSampleBits,
+			bool newStereo);
+		
+		unsigned int ResampleFrame(
+			const char* samples,
+			unsigned int samplesSize,
+			unsigned int& newSampleRate,
+			unsigned int& newSampleBits,
+			bool& newStereo,
+			void* newSamples,
+			unsigned int newSamplesSize);
+		
+		static const char* const MIC_LOCATOR;
+		
+		class Socket *socket;
+		
+		//! writes @a value to @a dst and advances @a dst
+		template<class T>
+		inline static void encode(char **dst, const T& value) {
+			memcpy(*dst, &value, sizeof(T));
+			(*dst) += sizeof(T);
+		}
+		
+		//! writes @a length bytes from @a src to @a dst
+		template<class T>
+		inline static void encode(char **dst, const T * src, int num) {
+			memcpy(*dst, src, num*sizeof(T));
+			(*dst) += num*sizeof(T);
+		}
+};
+#endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/RawCamBehavior.cc ./Behaviors/Mon/RawCamBehavior.cc
--- ../Tekkotsu_2.2/Behaviors/Mon/RawCamBehavior.cc	Thu Oct  7 15:07:05 2004
+++ ./Behaviors/Mon/RawCamBehavior.cc	Wed Nov 10 20:45:36 2004
@@ -8,7 +8,7 @@
 #include "Shared/ProjectInterface.h"
 
 RawCamBehavior::RawCamBehavior()
-	: BehaviorBase(), visRaw(NULL), packet(NULL), cur(NULL), avail(0), max_buf(0)
+	: BehaviorBase("RawCamBehavior"), visRaw(NULL), packet(NULL), cur(NULL), avail(0), max_buf(0)
 {}
 
 void
@@ -16,6 +16,10 @@
 	BehaviorBase::DoStart();
 	
 	std::vector<std::string> args;
+	args.push_back("raw");
+	char port[50];
+	snprintf(port,50,"%d",config->vision.rawcam_port);
+	args.push_back(port);
 	if(config->vision.rawcam_transport==0) {
 		max_buf=UDP_WIRELESS_BUFFER_SIZE;
 		visRaw=wireless->socket(SocketNS::SOCK_DGRAM, 1024, max_buf);
@@ -289,9 +293,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/RawCamBehavior.h ./Behaviors/Mon/RawCamBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Mon/RawCamBehavior.h	Tue Sep 28 18:12:30 2004
+++ ./Behaviors/Mon/RawCamBehavior.h	Wed Nov 10 20:45:36 2004
@@ -42,13 +42,12 @@
 
 	virtual void processEvent(const EventBase& e);
 
-	virtual std::string getName() const { return "RawCamServer"; }
-
 	static std::string getClassDescription() {
 		char tmp[20];
 		sprintf(tmp,"%d",config->vision.rle_port);
 		return std::string("Forwards images from camera over port ")+tmp;
 	}
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	//! opens a new packet, writes header info; returns true if open, false if otherwise open (check cur==NULL for error)
@@ -74,10 +73,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/SegCamBehavior.cc ./Behaviors/Mon/SegCamBehavior.cc
--- ../Tekkotsu_2.2/Behaviors/Mon/SegCamBehavior.cc	Thu Oct  7 15:07:05 2004
+++ ./Behaviors/Mon/SegCamBehavior.cc	Wed Nov 10 20:45:36 2004
@@ -8,7 +8,7 @@
 #include "Vision/RLEGenerator.h"
 
 SegCamBehavior::SegCamBehavior()
-	: BehaviorBase(), visRLE(NULL), packet(NULL), cur(NULL), avail(0), max_buf(0)
+	: BehaviorBase("SegCamBehavior"), visRLE(NULL), packet(NULL), cur(NULL), avail(0), max_buf(0)
 {
 }
 
@@ -17,6 +17,10 @@
 	BehaviorBase::DoStart();
 	
 	std::vector<std::string> args;
+	args.push_back("rle");
+	char port[50];
+	snprintf(port,50,"%d",config->vision.rle_port);
+	args.push_back(port);
 	if(config->vision.rle_transport==0) {
 		max_buf=UDP_WIRELESS_BUFFER_SIZE;
 		visRLE=wireless->socket(SocketNS::SOCK_DGRAM, 1024, max_buf);
@@ -167,9 +171,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/SegCamBehavior.h ./Behaviors/Mon/SegCamBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Mon/SegCamBehavior.h	Tue Sep 28 18:12:30 2004
+++ ./Behaviors/Mon/SegCamBehavior.h	Wed Nov 10 20:45:36 2004
@@ -53,13 +53,12 @@
 
 	virtual void processEvent(const EventBase& e);
 
-	virtual std::string getName() const { return "SegCamServer"; }
-
 	static std::string getClassDescription() {
 		char tmp[20];
 		sprintf(tmp,"%d",config->vision.rle_port);
 		return std::string("Forwards segmented images from camera over port ")+tmp;
 	}
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	//! opens a new packet, writes header info; returns true if open, false if otherwise open (check cur==NULL for error)
@@ -85,10 +84,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/SpeakerServer.cc ./Behaviors/Mon/SpeakerServer.cc
--- ../Tekkotsu_2.2/Behaviors/Mon/SpeakerServer.cc	Wed Dec 31 19:00:00 1969
+++ ./Behaviors/Mon/SpeakerServer.cc	Fri Nov 12 17:07:39 2004
@@ -0,0 +1,318 @@
+#include "SpeakerServer.h"
+
+#include "Shared/Buffer.h"
+#include "Shared/Config.h"
+#include "Shared/RobotInfo.h"
+#include "Wireless/Wireless.h"
+
+SpeakerServer* SpeakerServer::instance = 0;
+
+SpeakerServer* SpeakerServer::GetInstance() {
+	if (instance == 0) {
+		instance = new SpeakerServer();
+	}
+	return instance;
+}
+
+SpeakerServer::SpeakerServer()
+	: BehaviorBase("Speaker Server"), socket(0),
+		packet(), frame(0), resampled(0),
+		channel(SoundManager::invalid_Play_ID) {
+		
+	AddReference();
+}
+
+SpeakerServer::~SpeakerServer() {
+	delete frame;
+	delete resampled;
+	
+	if (references == 1) {
+		instance = 0;
+	}
+}
+
+
+void SpeakerServer::DoStart() {
+	BehaviorBase::DoStart();
+	
+	if (socket != 0) {
+		wireless->setDaemon(socket, false);
+		wireless->close(socket);
+		socket = 0;
+	}
+	
+	packet.header->SetPosition(0);
+	channel = SoundManager::invalid_Play_ID;
+		
+	socket =
+		wireless->socket(SocketNS::SOCK_STREAM, RECEIVE_BUFFER_SIZE + 8, 512);
+	wireless->setReceiver(socket->sock, socket_callback);
+	wireless->setDaemon(socket, true);
+	wireless->listen(socket->sock, config->sound.streaming.speaker_port);
+}
+
+void SpeakerServer::DoStop() {
+	if (socket != 0) {
+		wireless->setDaemon(socket, false);
+		wireless->close(socket);
+		socket = 0;
+	}
+	
+	sndman->StopPlay(channel);
+	channel = SoundManager::invalid_Play_ID;
+	
+	packet.samples->SetCapacity(0);
+	
+	delete frame;
+	delete resampled;
+
+	BehaviorBase::DoStop();
+}
+
+int SpeakerServer::socket_callback(char *buf, int size) {
+	if (instance == 0) {
+		return 0;
+	} else {
+		return instance->GotSocketData(buf, size);
+	}
+}
+
+SpeakerServer::Packet::Packet()
+	: header(new Buffer(4)), size(0), type(0), skipped(false),
+		pcmHeader(new Buffer(4)), sampleRate(0), sampleBits(0),
+		samples(new Buffer(0)) {}
+		
+SpeakerServer::Packet::~Packet() {
+	delete header;
+	delete pcmHeader;
+	delete samples;
+}
+
+int SpeakerServer::GotSocketData(char* data, int dataSize) {
+	while (dataSize > 0) {
+		if (!packet.header->IsFull()) {
+			if (!packet.header->Fill(data, dataSize)) {
+				break;
+			}
+			packet.size =
+				(unsigned short) GetShort(&packet.header->GetData()[0]);
+			packet.type = GetShort(&packet.header->GetData()[2]);
+			if ((packet.type == 0) && (packet.size >= 4)) {
+				// PCM packet
+				packet.pcmHeader->SetPosition(0);
+				packet.skipped = false;
+			} else {
+				packet.skipped = true;
+			}
+		}
+		
+		if (packet.skipped) {
+			if (packet.size > dataSize) {
+				packet.size -= dataSize;
+				break;
+			} else {
+				data += packet.size;
+				dataSize -= packet.size;
+				// Start reading next packet
+				packet.header->SetPosition(0);
+				continue;
+			}
+		}
+		
+		if (!packet.pcmHeader->IsFull()) {
+			if (!packet.pcmHeader->Fill(data, dataSize)) {
+				break;
+			}
+			packet.size -= packet.pcmHeader->GetLimit();
+			packet.sampleRate =
+				(unsigned short) GetShort(&packet.pcmHeader->GetData()[0]);
+			packet.sampleBits = packet.pcmHeader->GetData()[2];
+			
+			const int resampledSize =
+				packet.size *
+					((packet.sampleBits == 8) ? 2 : 1)
+					* config->sound.sample_rate / packet.sampleRate;
+			
+			if ((packet.size > MAX_PACKET_SIZE)
+						|| (resampledSize > MAX_PACKET_SIZE)) {
+				// Too many samples
+				packet.skipped = true;
+				continue;
+			}
+			packet.samples->SetCapacity(MAX_PACKET_SIZE);
+			packet.samples->SetLimit(packet.size);
+			packet.samples->SetPosition(0);
+		}
+				
+		if (!packet.samples->IsFull()) {
+			if (!packet.samples->Fill(data, dataSize)) {
+				break;
+			}
+			AddPacket(
+				packet.samples->GetData(),
+				packet.samples->GetLimit(),
+				packet.sampleRate,
+				packet.sampleBits);
+			// Start reading next packet
+			packet.header->SetPosition(0);
+			continue;
+		}
+	}
+
+	return 0;
+}
+
+void SpeakerServer::AddPacket(
+	const void* samples,
+	int samplesSize,
+	int sampleRate,
+	byte sampleBits) {
+
+	if (samplesSize < 1) {
+		return;
+	}
+
+	samples =
+		ResampleForSpeaker(
+			samples, samplesSize, sampleRate, sampleBits, samplesSize);
+	if (samples == 0) {
+		return;
+	}
+	
+	const int frameSize =
+		config->sound.streaming.speaker_frame_length
+			* config->sound.sample_rate
+			* ((config->sound.sample_bits == 8) ? 1 : 2)
+			/ 1000;
+	if (frame == 0) {
+		frame = new Buffer(frameSize);
+	} else if (frameSize != frame->GetLimit()) {
+		if (frame->GetPosition() > frameSize) {
+			QueueFrame(frame->GetData(), frame->GetPosition());
+			frame->SetPosition(0);
+		} else {
+			frame->SetLimit(frameSize);
+		}
+		
+		if (frame->GetLimit() < frameSize) {
+			if (frame->GetCapacity() < frameSize) {
+				frame->SetCapacity(frameSize);
+			}
+			frame->SetLimit(frameSize);
+		}
+	}
+	
+	if (frame->GetLimit() < 1) {
+		return;
+	}
+	
+	const char* buf = (const char*) samples;
+	while (frame->Fill(buf, samplesSize)) {
+		QueueFrame(frame->GetData(), frame->GetPosition());
+		frame->SetPosition(0);
+	}
+}
+		
+		
+void SpeakerServer::QueueFrame(const char* samples, int samplesSize) {
+	if (channel != SoundManager::invalid_Play_ID) {
+		const int remainingTime = sndman->GetRemainTime(channel) - RobotInfo::SoundBufferTime;
+		if (remainingTime > (int) config->sound.streaming.speaker_max_delay) {
+			// Queue too long
+			sndman->StopPlay(channel);
+			channel = SoundManager::invalid_Play_ID;
+		} else if (remainingTime < 0) {
+			// Queue underrun
+		} else {
+			// Try queueing
+			SoundManager::Play_ID newChannel =
+				sndman->ChainBuffer(channel, samples, (int) samplesSize);
+			if (newChannel != SoundManager::invalid_Play_ID) {
+				channel = newChannel;
+				return;
+			}
+		}
+	}
+	
+	// Start a new channel
+	channel = sndman->PlayBuffer(samples, samplesSize);
+}
+
+const void* SpeakerServer::ResampleForSpeaker(
+	const void* samples,
+	int samplesSize,
+	int sampleRate,
+	byte bitsPerSample,
+	int& newSamplesSize) {
+		
+	const int newSampleRate = config->sound.sample_rate;
+	const int newBitsPerSample = config->sound.sample_bits;
+	
+	if ((sampleRate == newSampleRate) && (bitsPerSample == newBitsPerSample)) {
+		newSamplesSize = samplesSize;
+		return samples;
+	}
+	
+	const int sampleCount = samplesSize / ((bitsPerSample == 16) ? 2 : 1);	
+	const int newSampleCount = sampleCount * newSampleRate / sampleRate;
+	newSamplesSize = newSampleCount * ((newBitsPerSample == 16) ? 2 : 1);
+	
+	if (newSampleCount == 0) {
+		newSamplesSize = 0;
+		return 0;
+	}
+	
+	if (resampled == 0) {
+		resampled = new Buffer(newSamplesSize);
+	} else if (resampled->GetCapacity() < newSamplesSize) {
+		resampled->SetCapacity(newSamplesSize);
+	}
+	
+	// The code below is biased towards upsampling (normal case).
+	// It does not average samples during downsampling.
+	
+	if (bitsPerSample == 16) {
+		// 16-bit signed source
+		const short* source = (const short*) samples; 
+		if (newBitsPerSample == 16) {
+			// 16-bit signed source, 16-bit signed destination
+			short* dest = (short*) resampled->GetData();
+			for (int i = 0; i < newSampleCount; i++) {  
+				dest[i] = source[i * sampleRate / newSampleRate];
+			}
+		} else if (newBitsPerSample == 8) {
+			// 16-bit signed source, 8-bit unsigned destination
+			byte* dest = (byte*) resampled->GetData();
+			for (int i = 0; i < newSampleCount; i++) {  
+				dest[i] = ((byte) (source[i * sampleRate / newSampleRate] >> 8)) ^ 0x80;
+			}
+		} else {
+			newSamplesSize = 0;
+			return 0;
+		}
+	} else if (bitsPerSample == 8) {
+		// 8-bit unsigned source
+		const byte* source = (const byte*) samples;
+		if (newBitsPerSample == 8) {
+			// 8-bit unsigned source, 8-bit unsigned destination
+			byte* dest = (byte*) resampled->GetData();
+			for (int i = 0; i < newSampleCount; i++) {  
+				dest[i] = source[i * sampleRate / newSampleRate];
+			}
+		} else if (newBitsPerSample == 16) {
+			// 8-bit unsigned source, 16-bit signed destination
+			short* dest = (short*) resampled->GetData();
+			for (int i = 0; i < newSampleCount; i++) {  
+				dest[i] = (source[i * sampleRate / newSampleRate] ^ 0x80) << 8;
+			}
+		} else {
+			newSamplesSize = 0;
+			return 0;
+		}
+	} else {
+		newSamplesSize = 0;
+		return 0;
+	}
+	
+	return resampled->GetData();
+}
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/SpeakerServer.h ./Behaviors/Mon/SpeakerServer.h
--- ../Tekkotsu_2.2/Behaviors/Mon/SpeakerServer.h	Wed Dec 31 19:00:00 1969
+++ ./Behaviors/Mon/SpeakerServer.h	Fri Nov 12 17:07:39 2004
@@ -0,0 +1,69 @@
+//-*-c++-*-
+#ifndef INCLUDED_SpeakerServer_h_
+#define INCLUDED_SpeakerServer_h_
+
+#include "Behaviors/BehaviorBase.h"
+#include "SoundPlay/SoundManager.h"
+
+//! Plays streamed audio via the speaker
+class SpeakerServer : public BehaviorBase {
+	public:
+		static SpeakerServer* GetInstance();
+		virtual ~SpeakerServer();
+		
+		virtual void DoStart();
+		virtual void DoStop();
+		
+		static int socket_callback(char *buf, int size);
+	
+	private:
+		SpeakerServer();
+		SpeakerServer(const SpeakerServer& rhs);
+		SpeakerServer& operator=(const SpeakerServer& rhs);
+		static SpeakerServer* instance;
+		
+		int GotSocketData(char* data, int dataSize);
+		class Socket *socket;
+		static short GetShort(const void* buf) { short result; memcpy(&result, buf, sizeof(short)); return result; }
+		
+		static const int MAX_PACKET_SIZE = 1024 * 1024;
+		static const int RECEIVE_BUFFER_SIZE = 2048;
+	
+		class Packet {
+			public:
+				Packet();
+				virtual ~Packet();
+				
+				class Buffer* header;
+				int size;
+				int type;
+				bool skipped;
+				
+				class Buffer* pcmHeader;
+				unsigned short sampleRate;
+				byte sampleBits;
+				
+				class Buffer* samples;
+			
+			private:
+				Packet(const Packet& rhs);
+				Packet& operator=(const Packet& rhs);
+		};
+		
+		Packet packet; 
+		class Buffer* frame;
+		class Buffer* resampled;
+		
+		void AddPacket(
+			const void* samples, int samplesSize, int sampleRate, byte sampleBits);
+		const void* ResampleForSpeaker(
+			const void* samples,
+			int samplesSize,
+			int sampleRate,
+			byte bitsPerSample,
+			int& newSamplesSize);
+				
+		void QueueFrame(const char* samples, int samplesSize);
+		SoundManager::Play_ID channel;
+};
+#endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/ViewWMVarsBehavior.h ./Behaviors/Mon/ViewWMVarsBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Mon/ViewWMVarsBehavior.h	Fri Apr 16 16:17:22 2004
+++ ./Behaviors/Mon/ViewWMVarsBehavior.h	Wed Nov 10 20:45:36 2004
@@ -11,7 +11,7 @@
 class ViewWMVarsBehavior : public BehaviorBase {
 public:
 	//! constructor
-	ViewWMVarsBehavior() : BehaviorBase() {}
+	ViewWMVarsBehavior() : BehaviorBase("ViewWMVarsBehavior") {}
 
 	virtual void DoStart() {
 		BehaviorBase::DoStart();
@@ -25,12 +25,12 @@
 		BehaviorBase::DoStop();
 	}
 
-	virtual std::string getName() const { return "View WMVars"; }
 	static std::string getClassDescription() {
 		char tmp[20];
 		sprintf(tmp,"%d",config->main.wmmonitor_port);
 		return std::string("Brings up the WatchableMemory GUI on port ")+tmp+std::string(" (connects to WMMonitorBehavior, this just launches the GUI)");
 	}
+	virtual std::string getDescription() const { return getClassDescription(); }
 };
 
 /*! @file
@@ -38,10 +38,10 @@
  * @author ejt (Creator)
  * 
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif 
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/WMMonitorBehavior.cc ./Behaviors/Mon/WMMonitorBehavior.cc
--- ../Tekkotsu_2.2/Behaviors/Mon/WMMonitorBehavior.cc	Fri Apr 16 16:17:22 2004
+++ ./Behaviors/Mon/WMMonitorBehavior.cc	Fri Apr 16 16:17:22 2004
@@ -146,7 +146,7 @@
  * @author alokl (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/WMMonitorBehavior.h ./Behaviors/Mon/WMMonitorBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Mon/WMMonitorBehavior.h	Thu Oct  7 15:07:05 2004
+++ ./Behaviors/Mon/WMMonitorBehavior.h	Wed Nov 10 20:45:36 2004
@@ -34,7 +34,7 @@
  public:
 	//! constructor
 	WMMonitorBehavior() :
-	  BehaviorBase(),
+	  BehaviorBase("WMMonitorBehavior"),
 	  cmdsock(NULL)
 	{ wmMonitorBehavior = this; }
 	//! destructor
@@ -98,12 +98,12 @@
 
 	virtual unsigned int getPort() const { return config->main.wmmonitor_port; } //!< returns network port from config
 
-	virtual std::string getName() const { return "Watchable Memory Monitor"; } //!< returns name of behavior
 	static std::string getClassDescription() { 
 		char tmp[20];
 		sprintf(tmp,"%d",config->main.wmmonitor_port);
 		return std::string("Bidirectional control communication with WMMonitor on port ")+tmp;
 	}
+	virtual std::string getDescription() const { return getClassDescription(); }
 
 protected:
 	static const unsigned int packet_wmclass=14; //!< magic id number, corresponds to Listener.java PACKET_WMCLASS
@@ -136,10 +136,10 @@
  * @author alokl (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif 
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/WalkControllerBehavior.cc ./Behaviors/Mon/WalkControllerBehavior.cc
--- ../Tekkotsu_2.2/Behaviors/Mon/WalkControllerBehavior.cc	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Mon/WalkControllerBehavior.cc	Wed Nov  3 22:01:32 2004
@@ -1,5 +1,6 @@
 #include "WalkControllerBehavior.h"
 #include "Behaviors/Controller.h"
+#include "SoundPlay/SoundManager.h"
 
 WalkControllerBehavior* WalkControllerBehavior::theOne = NULL;
 
@@ -157,9 +158,9 @@
  * @author PA Gov. School for the Sciences 2003 Team Project - Haoqian Chen, Yantian Martin, Jon Stahlman (modifications)
  * 
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/WalkControllerBehavior.h ./Behaviors/Mon/WalkControllerBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Mon/WalkControllerBehavior.h	Thu Dec 11 00:49:30 2003
+++ ./Behaviors/Mon/WalkControllerBehavior.h	Wed Nov 10 20:45:36 2004
@@ -10,7 +10,6 @@
 #include "Motion/MMAccessor.h"
 #include "Events/EventRouter.h"
 #include "Events/EventBase.h"
-#include "SoundPlay/SoundManager.h"
 #include "Shared/Config.h"
 
 //! Listens to control commands coming in from the command port for remotely controlling the walk
@@ -66,7 +65,7 @@
  public:
 	//! constructor
 	WalkControllerBehavior() :
-	  BehaviorBase(),
+	  BehaviorBase("WalkControllerBehavior"),
 		shared_walker(),
 	  dx(0), dy(0), da(0),
 	  theLastOne(theOne),
@@ -89,12 +88,12 @@
 		walker->setTargetVelocity(0,0,0);
 	}
 
-	virtual std::string getName() const { return "Walk Remote Control"; }
 	static std::string getClassDescription() {
 		char tmp[20];
 		sprintf(tmp,"%d",config->main.walkControl_port);
 		return std::string("Listens to walk control commands coming in from port ")+tmp;
 	}
+	virtual std::string getDescription() const { return getClassDescription(); }
 };
 
 /*! @file
@@ -104,10 +103,10 @@
  * @author PA Gov. School for the Sciences 2003 Team Project - Haoqian Chen, Yantian Martin, Jon Stahlman (modifications)
  * 
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif 
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/WorldStateSerializerBehavior.cc ./Behaviors/Mon/WorldStateSerializerBehavior.cc
--- ../Tekkotsu_2.2/Behaviors/Mon/WorldStateSerializerBehavior.cc	Thu Oct  7 15:07:05 2004
+++ ./Behaviors/Mon/WorldStateSerializerBehavior.cc	Wed Nov 10 20:45:36 2004
@@ -5,7 +5,7 @@
 #include "Events/EventRouter.h"
 
 WorldStateSerializerBehavior::WorldStateSerializerBehavior()
-	: BehaviorBase(), wsJoints(NULL), wsPIDs(NULL)
+	: BehaviorBase("WorldStateSerializerBehavior"), wsJoints(NULL), wsPIDs(NULL)
 {
 	wsJoints=wireless->socket(SocketNS::SOCK_STREAM, 1024, 2048);
   wireless->setDaemon(wsJoints);
@@ -53,8 +53,8 @@
  * @author alokl (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
diff -urdN ../Tekkotsu_2.2/Behaviors/Mon/WorldStateSerializerBehavior.h ./Behaviors/Mon/WorldStateSerializerBehavior.h
--- ../Tekkotsu_2.2/Behaviors/Mon/WorldStateSerializerBehavior.h	Thu Feb  5 18:33:41 2004
+++ ./Behaviors/Mon/WorldStateSerializerBehavior.h	Wed Nov 10 20:45:36 2004
@@ -18,12 +18,12 @@
 	virtual void DoStart(); //!< starts listening for sensor update events
 	virtual void DoStop(); //!< stops listening for events
 	virtual void processEvent(const EventBase& e); //!< core functionality - performs serialization, sends to sockets
-	virtual std::string getName() const { return "World State Serializer"; }
 	static std::string getClassDescription() {
 		char tmp[80];
 		sprintf(tmp,"Sends sensor information to port %d and current pid values to port %d",config->main.wsjoints_port,config->main.wspids_port);
 		return tmp;
 	}
+	virtual std::string getDescription() const { return getClassDescription(); }
 
 protected:
 	//! writes @a value to @a dst and advances @a dst
@@ -55,10 +55,10 @@
  * @author alokl (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Nodes/GroupNode.h ./Behaviors/Nodes/GroupNode.h
--- ../Tekkotsu_2.2/Behaviors/Nodes/GroupNode.h	Sun Jan 18 05:16:57 2004
+++ ./Behaviors/Nodes/GroupNode.h	Thu Nov 11 16:32:14 2004
@@ -20,9 +20,9 @@
 class GroupNode : public StateNode {
 public:
 	//!constructor
-	GroupNode() : StateNode("GroupNode") {}
+	GroupNode() : StateNode("GroupNode","GroupNode") {}
 	//!constructor
-	explicit GroupNode(const std::string& nm, StateNode* p=NULL) : StateNode(nm,p) {}
+	explicit GroupNode(const std::string& nm, StateNode* p=NULL) : StateNode("GroupNode",nm,p) {}
 
 	//! activates all of the sub nodes
 	virtual void DoStart() {
@@ -42,10 +42,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Nodes/HeadPointerNode.h ./Behaviors/Nodes/HeadPointerNode.h
--- ../Tekkotsu_2.2/Behaviors/Nodes/HeadPointerNode.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Nodes/HeadPointerNode.h	Tue Nov 16 20:31:06 2004
@@ -15,7 +15,7 @@
 public:
   //! constructor
   HeadPointerNode(std::string nodename="HeadPointerNode") : 
-    StateNode(nodename), head_mc(), head_id(MotionManager::invalid_MC_ID) {}
+    StateNode("HeadPointerNode",nodename), head_mc(), head_id(MotionManager::invalid_MC_ID) {}
 
   //! activate the node
   virtual void DoStart() {
@@ -34,7 +34,7 @@
 
   //! receive motmanEGID status event and throw stateMachineEGID status event
   virtual void processEvent(const EventBase&) {
-    erouter->postEvent(EventBase::stateMachineEGID,(unsigned int)this,EventBase::statusETID,0);
+		erouter->postEvent(EventBase::stateMachineEGID,reinterpret_cast<unsigned int>(this),EventBase::statusETID,0,getName(),1);
   }
 
   //! reveal the MotionCommand
@@ -43,6 +43,11 @@
   //! reveal the MC_ID
   MotionManager::MC_ID& getMC_ID() { return head_id; }
 
+protected:
+  //! constructor
+  HeadPointerNode(std::string &classname, std::string &nodename) : 
+    StateNode(classname,nodename), head_mc(), head_id(MotionManager::invalid_MC_ID) {}
+
 
 };
 
@@ -50,11 +55,11 @@
  * @brief Defines HeadPointerNode, a simple StateNode that runs a HeadPointerMC motion command and throws a status event upon completion
  * @author dst (Creator)
  *
- * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Nodes/LedNode.h ./Behaviors/Nodes/LedNode.h
--- ../Tekkotsu_2.2/Behaviors/Nodes/LedNode.h	Wed Dec 31 19:00:00 1969
+++ ./Behaviors/Nodes/LedNode.h	Tue Nov 16 20:31:06 2004
@@ -0,0 +1,65 @@
+//-*-c++-*-
+#ifndef INCLUDED_LedNode_h_
+#define INCLUDED_LedNode_h_
+
+#include "Behaviors/StateNode.h"
+#include "Events/EventRouter.h"
+#include "Motion/LedMC.h"
+
+//! A simple StateNode that executes a LedMC motion command and throws a status event upon completion
+class LedNode : public StateNode {
+protected:
+  SharedObject<LedMC> leds_mc;    //!< MotionCommand used by this node
+  MotionManager::MC_ID leds_id;  //!< id number for the MotionCommand
+
+public:
+  //! constructor
+  LedNode(std::string nodename="LedNode") : 
+    StateNode("LedNode",nodename), leds_mc(), leds_id(MotionManager::invalid_MC_ID) {}
+
+  //! activate the node
+  virtual void DoStart() {
+    leds_id = motman->addPersistentMotion(leds_mc);
+    erouter->addListener(this,EventBase::motmanEGID,leds_id,EventBase::statusETID);
+    StateNode::DoStart();  // don't activate transitions until our listener has been added
+  }
+
+  //! deactivate the node
+  virtual void DoStop() {
+    motman->removeMotion(leds_id);
+    leds_id = MotionManager::invalid_MC_ID;
+    erouter->removeListener(this);
+    StateNode::DoStop();
+  }
+
+  //! receive motmanEGID status event and throw stateMachineEGID status event
+  virtual void processEvent(const EventBase&) {
+		erouter->postEvent(EventBase::stateMachineEGID,reinterpret_cast<unsigned int>(this),EventBase::statusETID,0,getName(),1);
+  }
+
+  //! reveal the MotionCommand
+  SharedObject<LedMC>& getMC() { return leds_mc; }
+
+  //! reveal the MC_ID
+  MotionManager::MC_ID& getMC_ID() { return leds_id; }
+
+protected:
+  //! constructor
+  LedNode(std::string &classname, std::string &nodename) : 
+    StateNode(classname,nodename), leds_mc(), leds_id(MotionManager::invalid_MC_ID) {}
+
+
+};
+
+/*! @file
+ * @brief Defines LedNode, a simple StateNode that runs a LedMC motion command and throws a status event upon completion
+ * @author dst (Creator)
+ *
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
+ */
+
+#endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Nodes/OutputNode.h ./Behaviors/Nodes/OutputNode.h
--- ../Tekkotsu_2.2/Behaviors/Nodes/OutputNode.h	Thu Sep 25 23:09:10 2003
+++ ./Behaviors/Nodes/OutputNode.h	Thu Nov 11 15:35:00 2004
@@ -9,14 +9,12 @@
 //! A very simple StateNode that outputs its name to a given ostream upon activation, handy for debugging
 class OutputNode : public StateNode {
 public:
-	//!constructor, uses cout for output
-	OutputNode() : StateNode(), next(NULL), out(cout), msg() {}
 	//!constructor, sets name and ostream to use for output
-	OutputNode(const char* nm, StateNode* par, ostream& output) : StateNode(nm,par), next(NULL), out(output), msg(nm) {}
+	OutputNode(const char* nm, StateNode* par, ostream& output) : StateNode("OutputNode",nm,par), next(NULL), out(output), msg(nm) {}
 	//!constructor, sets name and another state which will immediately be transitioned to upon activation
-	OutputNode(const char* nm, StateNode* par, ostream& output, StateNode * nextstate) : StateNode(nm,par), next(nextstate), out(output), msg(nm) {}
+	OutputNode(const char* nm, StateNode* par, ostream& output, StateNode * nextstate) : StateNode("OutputNode",nm,par), next(nextstate), out(output), msg(nm) {}
 	//!constructor, sets name, message, and another state which will immediately be transitioned to upon activation
-	OutputNode(const char* nm, const std::string& mg, StateNode* par, ostream& output, StateNode * nextstate) : StateNode(nm,par), next(nextstate), out(output), msg(mg) {}
+	OutputNode(const char* nm, const std::string& mg, StateNode* par, ostream& output, StateNode * nextstate) : StateNode("OutputNode",nm,par), next(nextstate), out(output), msg(mg) {}
 
 	//!outputs this state's name, will transition to #next if non-NULL
 	/*!if #next is NULL, the state will simply stay active until some other transition causes it to leave*/
@@ -44,10 +42,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
- * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Nodes/PlayMotionSequenceNode.h ./Behaviors/Nodes/PlayMotionSequenceNode.h
--- ../Tekkotsu_2.2/Behaviors/Nodes/PlayMotionSequenceNode.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Nodes/PlayMotionSequenceNode.h	Thu Nov 11 16:32:14 2004
@@ -14,12 +14,12 @@
 public:
 	//!constructor
 	PlayMotionSequenceNode()
-		: StateNode("PlayMotionSequenceNode"), msid(MotionManager::invalid_MC_ID), msidIsMine(false), looping(false), filename()
+		: StateNode("PlayMotionSequenceNode","PlayMotionSequenceNode"), msid(MotionManager::invalid_MC_ID), msidIsMine(false), looping(false), filename()
 	{}
 
 	//!constructor
 	PlayMotionSequenceNode(const std::string& nm, StateNode* par, const std::string& file, bool loop=false)
-		: StateNode(nm,par), msid(MotionManager::invalid_MC_ID), msidIsMine(false), looping(false), filename(file)
+		: StateNode("PlayMotionSequenceNode",nm,par), msid(MotionManager::invalid_MC_ID), msidIsMine(false), looping(false), filename(file)
 	{
 		setLooping(loop);
 	}
@@ -78,7 +78,7 @@
 			if(looping) {
 				updateMS(filename);
 			}
-			erouter->postEvent(EventBase::stateMachineEGID,(unsigned int)this,EventBase::statusETID,0);
+			erouter->postEvent(EventBase::stateMachineEGID,reinterpret_cast<unsigned int>(this),EventBase::statusETID,0,getName(),1);
 		}
 	}
 
@@ -120,10 +120,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Nodes/SoundNode.h ./Behaviors/Nodes/SoundNode.h
--- ../Tekkotsu_2.2/Behaviors/Nodes/SoundNode.h	Thu Oct  7 20:08:47 2004
+++ ./Behaviors/Nodes/SoundNode.h	Tue Nov 16 20:31:06 2004
@@ -15,7 +15,7 @@
 public:
   //! constructor
   SoundNode(std::string nodename="SoundNode", std::string soundfilename="") : 
-    StateNode(nodename), filename(soundfilename), curplay_id(SoundManager::invalid_Play_ID) {}
+    StateNode("SoundNode",nodename), filename(soundfilename), curplay_id(SoundManager::invalid_Play_ID) {}
 
   //! activate the node
   virtual void DoStart() {
@@ -32,7 +32,7 @@
 
   //! receive audioEGID status event and throw stateMachineEGID status event
   virtual void processEvent(const EventBase&) {
-    erouter->postEvent(EventBase::stateMachineEGID,(unsigned int)this,EventBase::statusETID,0);
+		erouter->postEvent(EventBase::stateMachineEGID,reinterpret_cast<unsigned int>(this),EventBase::statusETID,0,getName(),1);
   }
 
   //! interrupts playing of the current sound
@@ -47,6 +47,13 @@
   //! sets the name of the sound file associated with this node
   void setFileName(std::string &soundfilename) { filename = soundfilename; }
 
+protected:
+  //! constructor
+  SoundNode(std::string &classname, std::string &nodename, std::string &soundfilename) : 
+    StateNode(classname,nodename), filename(soundfilename), curplay_id(SoundManager::invalid_Play_ID) {}
+
+
+
 };
 
 /*! @file
@@ -54,10 +61,10 @@
  * @author dst (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Nodes/TailWagNode.h ./Behaviors/Nodes/TailWagNode.h
--- ../Tekkotsu_2.2/Behaviors/Nodes/TailWagNode.h	Wed Dec 31 19:00:00 1969
+++ ./Behaviors/Nodes/TailWagNode.h	Mon Nov 15 17:22:36 2004
@@ -0,0 +1,60 @@
+//-*-c++-*-
+#ifndef INCLUDED_TailWagNode_h_
+#define INCLUDED_TailWagNode_h_
+
+#include "Behaviors/StateNode.h"
+#include "Events/EventRouter.h"
+#include "Motion/TailWagMC.h"
+
+//! A simple StateNode that executes a TailWagMC motion command
+class TailWagNode : public StateNode {
+protected:
+  SharedObject<TailWagMC> tail_mc;    //!< MotionCommand used by this node
+  MotionManager::MC_ID tail_id;  //!< id number for the MotionCommand
+
+public:
+  //! constructor
+  TailWagNode(std::string nodename="TailWagNode") : 
+    StateNode("TailWagNode",nodename), tail_mc(), tail_id(MotionManager::invalid_MC_ID) {}
+
+  //! activate the node
+  virtual void DoStart() {
+    StateNode::DoStart();
+    tail_id = motman->addPersistentMotion(tail_mc);
+    erouter->addListener(this,EventBase::motmanEGID,tail_id,EventBase::statusETID);
+  }
+
+  //! deactivate the node
+  virtual void DoStop() {
+    motman->removeMotion(tail_id);
+    tail_id = MotionManager::invalid_MC_ID;
+    erouter->removeListener(this);
+    StateNode::DoStop();
+  }
+
+  //! receive motmanEGID status event and throw stateMachineEGID status event - this doesn't ever actually happen for a TailWagMC, but just for completeness...
+  virtual void processEvent(const EventBase&) {
+		erouter->postEvent(EventBase::stateMachineEGID,reinterpret_cast<unsigned int>(this),EventBase::statusETID,0,getName(),1);
+  }
+
+  //! reveal the MotionCommand itself, use getMC_ID() instead if this node isActive().
+  SharedObject<TailWagMC>& getMC() { return tail_mc; }
+
+  //! reveal the MC_ID
+  MotionManager::MC_ID& getMC_ID() { return tail_id; }
+
+
+};
+
+/*! @file
+ * @brief Defines TailWagNode, a simple StateNode that runs a TailWagMC motion command
+ * @author dst, ejt (Creators)
+ *
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
+ */
+
+#endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Nodes/WalkNode.h ./Behaviors/Nodes/WalkNode.h
--- ../Tekkotsu_2.2/Behaviors/Nodes/WalkNode.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Nodes/WalkNode.h	Thu Nov 11 15:35:00 2004
@@ -17,13 +17,20 @@
 		setRetain(false);
 	}
 
-	//!constructor, positive is counter-clockwise from above (to match coordinate system)
+	//!constructor, positive @a yvel is counter-clockwise from above (to match coordinate system)
 	WalkNode(float xvel, float yvel, float avel, StateNode * p=NULL)
 		: StateNode("WalkNode",p), walkid(MotionManager::invalid_MC_ID), walkidIsMine(true), x(xvel), y(yvel), a(avel)
 	{
 		setRetain(false);
 	}
 
+	//!constructor, positive @a yvel is counter-clockwise from above (to match coordinate system)
+	WalkNode(const std::string& name, float xvel, float yvel, float avel, StateNode * p=NULL)
+		: StateNode("WalkNode",name,p), walkid(MotionManager::invalid_MC_ID), walkidIsMine(true), x(xvel), y(yvel), a(avel)
+	{
+		setRetain(false);
+	}
+
 	//! sets the velocity of the walk
 	void setVelocity(float xvel, float yvel, float avel) {
 		x=xvel;
@@ -110,10 +117,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/StateNode.cc ./Behaviors/StateNode.cc
--- ../Tekkotsu_2.2/Behaviors/StateNode.cc	Mon Oct  4 18:57:56 2004
+++ ./Behaviors/StateNode.cc	Wed Nov 10 20:45:31 2004
@@ -2,6 +2,9 @@
 #include "Events/EventRouter.h"
 #include "Wireless/Wireless.h"
 
+/*! @deprecated, behavior constructors should take a name argument (which by default should be the name of the type of the class) */
+StateNode::StateNode() : BehaviorBase("StateNode"), parent(NULL), transitions(), issetup(false), retain(true), nodes() {}
+
 StateNode::~StateNode() {
 	ASSERT(!isActive(), "Destructing while active?")
 	for(std::vector<Transition*>::iterator it=transitions.begin(); it!=transitions.end(); it++)
@@ -27,16 +30,18 @@
 }
 
 void StateNode::DoStart() {
-	BehaviorBase::DoStart();
-	if(!issetup) {
-		setup();
-		issetup=true;
-	}
-	for(std::vector<Transition*>::iterator it=transitions.begin(); it!=transitions.end(); it++)
-	  if ( !(*it)->isActive()  ) (*it)->DoStart();
-	erouter->postEvent(EventBase::stateMachineEGID,reinterpret_cast<unsigned int>(this),EventBase::activateETID,0,getName(),1);
-	if(parent!=NULL)
-		parent->transitionTo(this);
+  if ( parent == NULL && transitions.size() > 0 )
+    serr->printf("Warning! StateNode '%s' has transitions but no parent; you probably forgot to call addNode().\n",getName().c_str());
+  BehaviorBase::DoStart();
+  if(!issetup) {
+    setup();
+    issetup=true;
+  }
+  for(std::vector<Transition*>::iterator it=transitions.begin(); it!=transitions.end(); it++)
+    if ( !(*it)->isActive()  ) (*it)->DoStart();
+  erouter->postEvent(EventBase::stateMachineEGID,reinterpret_cast<unsigned int>(this),EventBase::activateETID,0,getName(),1);
+  if(parent!=NULL)
+    parent->transitionTo(this);
 }
 
 void StateNode::DoStop() {
@@ -58,10 +63,6 @@
 	BehaviorBase::DoStop();
 }
 
-void StateNode::setName(const std::string& n) {
-	name=n;
-}
-
 void StateNode::transitionTo(StateNode*) {
 	// may want to throw a status event here
 }
@@ -74,10 +75,10 @@
  * @brief Describes StateNode, which is both a state machine controller as well as a node within a state machine itself
  * @author ejt (Creator)
  *
- * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Behaviors/StateNode.h ./Behaviors/StateNode.h
--- ../Tekkotsu_2.2/Behaviors/StateNode.h	Mon Oct  4 18:57:56 2004
+++ ./Behaviors/StateNode.h	Mon Nov 15 17:46:19 2004
@@ -11,13 +11,11 @@
 /*! Override setup() to setup your own Transition and StateNode network.*/
 class StateNode  : public BehaviorBase {
 public:
-	//!constructor
-	StateNode() : BehaviorBase(), parent(NULL), transitions(), issetup(false), retain(true), nodes(), name("?") {	/*std::cout << "!" << std::endl;*/ }
+	//! deprecated, behavior constructors should take a name argument (which by default should be the name of the type of the class)
+	StateNode() __attribute__((deprecated));
 
-	//!constructor, pass a name to use, calls setName(n) 
-	StateNode(const std::string& n, StateNode* p=NULL) : BehaviorBase(), parent(p), transitions(), issetup(false), retain(true), nodes(), name("") {
-		setName(n);
-	}
+	//!constructor, pass a name to use and the parent node if applicable (usually 'this' within setup())
+	StateNode(const std::string& name, StateNode* p=NULL) : BehaviorBase("StateNode",name), parent(p), transitions(), issetup(false), retain(true), nodes() {}
 
 	//!destructor, removes references to its outgoing transitions (be careful of incoming ones - they're still around!), and calls RemoveReference() on subnodes
 	virtual ~StateNode();
@@ -49,16 +47,10 @@
 	//!This is called by DoStop() when you should destruct subnodes
 	virtual void teardown() { issetup=false; /*std::cout << "Teardown!!!!!!!!" << std::endl;*/ }
 
-	//!set name to @a n.  Makes a copy of @a n, so you can throw it away later.
-	void setName(const std::string& n);
-
-	//!returns name of StateNode
-	virtual std::string getName() const { return name; }
-
-	//!returns name again (you should override this for top-level nodes to give users better descriptions)
-	virtual std::string getDescription() const { return name; }
-
 protected:
+	//!constructor, pass a name to use and the parent node if applicable (usually 'this' within setup())
+	StateNode(const std::string& classname, const std::string& name, StateNode* p=NULL) : BehaviorBase(classname,name), parent(p), transitions(), issetup(false), retain(true), nodes() {}
+
 	//!called by a subnode when it is being DoStart()'ed
 	virtual void transitionTo(StateNode* n);
 
@@ -79,10 +71,6 @@
 	//! vector of StateNodes, just so they can be dereferenced again on DoStop() (unless retained) or ~StateNode()
 	std::vector<StateNode*> nodes;
 
-	//Behavior Stuff:
-	//! holds the name of the Node/Machine
-	std::string name;
-
 private:
 	StateNode(const StateNode& node); //!< don't call this
 	StateNode operator=(const StateNode& node); //!< don't call this
@@ -92,11 +80,11 @@
  * @brief Describes StateNode, which is both a state machine controller as well as a node within a state machine itself
  * @author ejt (Creator)
  *
- * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Transition.cc ./Behaviors/Transition.cc
--- ../Tekkotsu_2.2/Behaviors/Transition.cc	Thu Oct  7 20:08:34 2004
+++ ./Behaviors/Transition.cc	Thu Nov 11 15:34:59 2004
@@ -3,6 +3,23 @@
 #include "Wireless/Wireless.h"
 #include "SoundPlay/SoundManager.h"
 
+/*! @deprecated, use the version of the constructor where you can pass a name */
+Transition::Transition() : BehaviorBase("Transition"), srcs(), dsts(), sound() {}
+
+/*! @deprecated, use the version of the constructor where you can pass a name */
+Transition::Transition(StateNode* destination)
+	: BehaviorBase("Transition"), srcs(), dsts(), sound()
+{
+	addDestination(destination);
+}
+
+
+/*! @deprecated: use #fire() instead (just a better name) */
+void Transition::activate() {
+	serr->printf("Transition::activate() is deprecated.  Use Transition::fire() instead.\n");
+	fire();
+}
+
 void Transition::fire() {
 	//serr->printf("%s fire() - enter %d\n",getName().c_str(),get_time());
 
@@ -22,14 +39,30 @@
 	RemoveReference();
 }
 
+std::string Transition::getName() const {
+	if(instanceName != className) {
+		return instanceName;
+	} else {
+		std::string ans;
+		ans+='{';
+		for(unsigned int i=0; i<srcs.size(); i++)
+			ans+=srcs[i]->getName()+(i<srcs.size()-1?',':'}');
+		ans+="--"+instanceName+"-->";
+		ans+='{';
+		for(unsigned int i=0; i<dsts.size(); i++)
+			ans+=dsts[i]->getName()+(i<srcs.size()-1?',':'}');
+		return ans;
+	}
+} 
+
 /*! @file
  * @brief Implements Transition, represents a transition between StateNodes.
  * @author ejt (Creator)
  *
- * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Behaviors/Transition.h ./Behaviors/Transition.h
--- ../Tekkotsu_2.2/Behaviors/Transition.h	Mon Oct  4 18:59:57 2004
+++ ./Behaviors/Transition.h	Mon Nov 15 17:46:19 2004
@@ -3,7 +3,6 @@
 #define INCLUDED_Transition_h_
 
 #include "BehaviorBase.h"
-#include "Wireless/Socket.h"
 #include <vector>
 
 class StateNode;
@@ -36,29 +35,14 @@
 class Transition : public BehaviorBase {
 	friend class StateNode;
 public:
-	//!constructor
-	Transition() : BehaviorBase(), srcs(), dsts(), sound() {}
-	//!constructor, specify destination StateNode (ignores NULL)
-	Transition(StateNode* destination) : BehaviorBase(), srcs(), dsts(), sound() {
-		addDestination(destination);
-	}
-	//!copy constructor, just in case you need it
-	Transition(const Transition& t) : BehaviorBase(t), srcs(t.srcs), dsts(t.dsts), sound(t.sound) {}
-
-	//!assignment operator (only does shallow copy)
-	Transition& operator=(const Transition& t) { BehaviorBase::operator=(t); srcs=t.srcs; dsts=t.dsts; sound=t.sound; return *this; }
-
 	//!destructor
 	virtual ~Transition() {}
 
 	//!call this when the transition should be made, base class version simply calls StateNode::DoStop() on each active of #srcs and StateNode::DoStart() on each inactive of #dsts, but you can override.
 	virtual void fire();
 
-  //!deprecated: use #fire() instead
-  virtual void activate() {
-    serr->printf("Transition::activate() is deprecated.  Use Transition::fire() instead.\n");
-    fire();
-  }
+  //!deprecated: use #fire() instead (just a better name
+  virtual void activate() __attribute__((deprecated));
 
 	virtual std::vector<StateNode*>& getSources() { return srcs; }  //!< returns a user-modifiable reference to the current source list
 	virtual const std::vector<StateNode*>& getSources() const { return srcs; } //!< returns a const reference to the current source list
@@ -70,7 +54,32 @@
 	virtual void setSound(const std::string& snd) { sound=snd; } //!< set a sound file to be played upon activation; you might want to preload this in the parent node; empty string to turn off
 	virtual std::string getSound() { return sound; } //!< returns the current sound file
 	
+	//! If #instanceName == #className, will autogenerate a name incorporating source and destination names
+	virtual std::string getName() const;
+
 protected:
+	//! deprecated, use the version of the constructor where you can pass a name
+	Transition() __attribute__((deprecated));
+	//!constructor, pass your subclass type name as a string for the default name
+	explicit Transition(const std::string& classname) : BehaviorBase(classname), srcs(), dsts(), sound() {}
+	//! deprecated, use the version of the constructor where you can pass a name
+	explicit Transition(StateNode* destination) __attribute__((deprecated));
+	//!constructor, specify destination StateNode (ignores NULL)
+	Transition(const std::string& classname, StateNode* destination) : BehaviorBase(classname), srcs(), dsts(), sound() {
+		addDestination(destination);
+	}
+	//!constructor, pass your subclass type name as a string for the default name, and a separate instance name
+	Transition(const std::string& classname, const std::string& instancename) : BehaviorBase(classname,instancename), srcs(), dsts(), sound() {}
+	//!constructor, specify names and destination StateNode (ignores NULL)
+	Transition(const std::string& classname, const std::string& instancename, StateNode* destination) : BehaviorBase(classname,instancename), srcs(), dsts(), sound() {
+		addDestination(destination);
+	}
+	//!copy constructor, just in case you need it
+	Transition(const Transition& t) : BehaviorBase(t), srcs(t.srcs), dsts(t.dsts), sound(t.sound) {}
+
+	//!assignment operator (only does shallow copy)
+	Transition& operator=(const Transition& t) { BehaviorBase::operator=(t); srcs=t.srcs; dsts=t.dsts; sound=t.sound; return *this; }
+
 	//! if @a source is non-null, add it to the source list
 	/*! Only StateNodes should be calling this - you add a transition to a source, not a source to a transition.
 	 *  @see StateNode::addTransition() */
@@ -85,11 +94,11 @@
  * @brief Describes Transition, represents a transition between StateNodes.
  * @author ejt (Creator)
  *
- * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Transitions/CompareTrans.h ./Behaviors/Transitions/CompareTrans.h
--- ../Tekkotsu_2.2/Behaviors/Transitions/CompareTrans.h	Thu Oct  7 15:07:05 2004
+++ ./Behaviors/Transitions/CompareTrans.h	Mon Nov 15 17:46:19 2004
@@ -36,7 +36,12 @@
 	
 	//! constructor, see CompareTrans class notes for information
   CompareTrans(StateNode* destination, const T* monitor, Test_t test, const T& value, const EventBase& poll)
-		: Transition(destination), mon(monitor), tst(test), val(value), poller(poll)
+		: Transition("CompareTrans",destination), mon(monitor), tst(test), val(value), poller(poll)
+	{ }
+	
+	//! constructor, see CompareTrans class notes for information
+  CompareTrans(const std::string& name, StateNode* destination, const T* monitor, Test_t test, const T& value, const EventBase& poll)
+		: Transition("CompareTrans",name,destination), mon(monitor), tst(test), val(value), poller(poll)
 	{ }
 	
 	//!starts listening
@@ -69,9 +74,12 @@
 		}
 	}
 
-	virtual std::string getName() const { return "CompareTrans"; }
-
 protected:
+	//! constructor, see CompareTrans class notes for information (this version is only need by subclasses so they can pass their type name)
+  CompareTrans(const std::string& classname, const std::string& instancename, StateNode* destination, const T* monitor, Test_t test, const T& value, const EventBase& poll)
+		: Transition(classname,instancename,destination), mon(monitor), tst(test), val(value), poller(poll)
+	{ }
+
 	const T* mon; //!< address of value to monitor
 	Test_t tst; //!< test to make
 	T val; //!< value to compare against
@@ -87,10 +95,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Transitions/CompletionTrans.h ./Behaviors/Transitions/CompletionTrans.h
--- ../Tekkotsu_2.2/Behaviors/Transitions/CompletionTrans.h	Sat Oct 16 21:16:10 2004
+++ ./Behaviors/Transitions/CompletionTrans.h	Mon Nov 15 17:46:19 2004
@@ -14,7 +14,10 @@
 
 public:
   CompletionTrans(StateNode* destination, int n=0) :
-    Transition(destination), minsrcs(n), completions(NULL) {};
+    Transition("CompletionTrans",destination), minsrcs(n), completions(NULL) {};
+
+  CompletionTrans(const std::string& name, StateNode* destination, int n=0) :
+    Transition("CompletionTrans",name,destination), minsrcs(n), completions(NULL) {};
 
   //! starts listening
   virtual void DoStart() {
@@ -50,9 +53,11 @@
     if (numcomplete >= threshold) fire();
   }
 
-  virtual std::string getName() const { return "CompletionTrans"; }
-
 protected:
+	//!constructor, this version is only need by subclasses so they can pass their type name
+  CompletionTrans(const std::string& classname, const std::string& instancename, StateNode* destination, int n=0) :
+    Transition(classname,instancename,destination), minsrcs(n), completions(NULL) {};
+
   //!@name Dummy functions to satisfy the compiler
   CompletionTrans(const CompletionTrans&);  //!< don't call this
   CompletionTrans& operator=(const CompletionTrans&);  //!< don't call this
@@ -65,10 +70,10 @@
  * @author dst (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Transitions/EventTrans.h ./Behaviors/Transitions/EventTrans.h
--- ../Tekkotsu_2.2/Behaviors/Transitions/EventTrans.h	Thu Oct  7 15:07:05 2004
+++ ./Behaviors/Transitions/EventTrans.h	Mon Nov 15 17:46:19 2004
@@ -15,15 +15,29 @@
   EventBase::EventTypeID_t etid;
 
 public:
-  EventTrans(StateNode* destination, EventBase::EventGeneratorID_t gid) :
-    Transition(destination), argcount(1), egid(gid), esid(0), etid(EventBase::statusETID) {};
+  EventTrans(StateNode* destination, EventBase::EventGeneratorID_t gid)
+		: Transition("EventTrans",destination), argcount(1), egid(gid), esid(0), etid(EventBase::statusETID)
+	{}
 
-  EventTrans(StateNode* destination, EventBase::EventGeneratorID_t gid, unsigned int sid) :
-    Transition(destination), argcount(2), egid(gid), esid(sid), etid(EventBase::statusETID) {};
+  EventTrans(StateNode* destination, EventBase::EventGeneratorID_t gid, unsigned int sid)
+		: Transition("EventTrans",destination), argcount(2), egid(gid), esid(sid), etid(EventBase::statusETID)
+	{}
 
-  EventTrans(StateNode* destination, EventBase::EventGeneratorID_t gid, 
-	     unsigned int sid, EventBase::EventTypeID_t tid) :
-    Transition(destination), argcount(3), egid(gid), esid(sid), etid(tid) {};
+  EventTrans(StateNode* destination, EventBase::EventGeneratorID_t gid, unsigned int sid, EventBase::EventTypeID_t tid)
+		: Transition("EventTrans",destination), argcount(3), egid(gid), esid(sid), etid(tid)
+	{}
+
+  EventTrans(const std::string& name, StateNode* destination, EventBase::EventGeneratorID_t gid)
+		: Transition("EventTrans",name,destination), argcount(1), egid(gid), esid(0), etid(EventBase::statusETID)
+	{}
+
+  EventTrans(const std::string& name, StateNode* destination, EventBase::EventGeneratorID_t gid, unsigned int sid)
+		: Transition("EventTrans",name,destination), argcount(2), egid(gid), esid(sid), etid(EventBase::statusETID)
+	{}
+
+  EventTrans(const std::string& name, StateNode* destination, EventBase::EventGeneratorID_t gid, unsigned int sid, EventBase::EventTypeID_t tid)
+		: Transition("EventTrans",name,destination), argcount(3), egid(gid), esid(sid), etid(tid)
+	{}
 
   //! starts listening
   virtual void DoStart() {
@@ -44,8 +58,6 @@
   //! fire the transition if an event is seen
   virtual void processEvent(const EventBase&) { fire(); }
 
-  virtual std::string getName() const { return "EventTrans"; }
-
 };
 
 /*! @file
@@ -53,10 +65,10 @@
  * @author dst (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Transitions/LostTargetTrans.h ./Behaviors/Transitions/LostTargetTrans.h
--- ../Tekkotsu_2.2/Behaviors/Transitions/LostTargetTrans.h	Wed Dec 31 19:00:00 1969
+++ ./Behaviors/Transitions/LostTargetTrans.h	Tue Nov 16 21:51:49 2004
@@ -0,0 +1,65 @@
+//-*-c++-*-
+#ifndef INCLUDED_LostTargetTrans_h_
+#define INCLUDED_LostTargetTrans_h_
+
+#include "Behaviors/Transitions/TimeOutTrans.h"
+#include "Events/VisionObjectEvent.h"
+
+
+//! Causes a transition if the target has not been seen @e minframe times within
+//! @e delay milliseconds.
+
+class LostTargetTrans : public TimeOutTrans {
+ public:
+
+  //! constructor, specify delay in milliseconds
+  LostTargetTrans(StateNode* destination, unsigned int source_id,
+		  unsigned int delay, int minframes=5) :
+    TimeOutTrans("LostTargetTrans","LostTargetTrans",destination,delay),
+    sid(source_id), minf(minframes), counter(0) {}
+
+  //! constructor, specify delay in milliseconds
+  LostTargetTrans(const std::string &name, StateNode* destination, unsigned int source_id,
+		  unsigned int delay, int minframes=5) :
+    TimeOutTrans("LostTargetTrans",name,destination,delay),
+    sid(source_id), minf(minframes), counter(0) {}
+
+  //!starts timer
+  virtual void DoStart() {
+    TimeOutTrans::DoStart();
+    erouter->addListener(this,EventBase::visObjEGID,sid);
+  }
+
+  virtual void processEvent(const EventBase &e) {
+    if (e.getGeneratorID()==EventBase::visObjEGID && e.getSourceID()==sid) {
+      ++counter;
+      if (counter > minf) resetTimer();
+    }
+    else
+      TimeOutTrans::processEvent(e);
+  }
+
+  //! resets timer; does not deactivate it
+  virtual void resetTimer() {
+    TimeOutTrans::resetTimer();
+    counter = 0;
+  }
+
+  //! set minimum number of frames that target must be seen before resetting the timer
+  virtual void set_minframes(int minframes) { minf = minframes; }
+
+protected:
+  LostTargetTrans(const std::string &classname, const std::string &instancename, 
+		  StateNode* destination, unsigned int source_id,
+		  unsigned int delay, int minframes=5) :
+    TimeOutTrans(classname,instancename,destination,delay),
+    sid(source_id), minf(minframes), counter(0) {}
+
+
+ private:
+  unsigned int sid;
+  int minf;   //!< number of frames that target must be seen before resetting the timer
+  int counter; //!< number of frames target has been seen so far
+};
+
+#endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Transitions/NullTrans.h ./Behaviors/Transitions/NullTrans.h
--- ../Tekkotsu_2.2/Behaviors/Transitions/NullTrans.h	Thu Oct  7 15:07:05 2004
+++ ./Behaviors/Transitions/NullTrans.h	Mon Nov 15 17:46:19 2004
@@ -9,7 +9,10 @@
 class NullTrans : public Transition {
 public:
   //! constructor
-  NullTrans(StateNode* destination) : Transition(destination) {}
+  NullTrans(StateNode* destination) : Transition("NullTrans",destination) {}
+	
+  //! constructor
+  NullTrans(const std::string& name, StateNode* destination) : Transition("NullTrans",name,destination) {}
 	
   //!starts 0 msec timer, so transition will occur very soon
   virtual void DoStart() {
@@ -22,9 +25,6 @@
 
   //!when timer event is received, fire() the transition
   virtual void processEvent(const EventBase&) { fire(); }
-
-  virtual std::string getName() const { return "TimeOutTrans"; }
-
 };
 
 /*! @file
@@ -32,10 +32,10 @@
  * @author dst (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Transitions/SmoothCompareTrans.h ./Behaviors/Transitions/SmoothCompareTrans.h
--- ../Tekkotsu_2.2/Behaviors/Transitions/SmoothCompareTrans.h	Mon Nov 10 19:08:18 2003
+++ ./Behaviors/Transitions/SmoothCompareTrans.h	Mon Nov 15 17:46:19 2004
@@ -16,7 +16,13 @@
 public:
 	//! constructor, see SmoothCompareTrans class notes for information
   SmoothCompareTrans(StateNode* destination, const T* monitor, typename SmoothCompareTrans<T>::Test_t test, const T& value, const EventBase& poll, float gammap=0)
-		: CompareTrans<T>(destination,&avg,test,value,poll), avg(*monitor), realmon(monitor),
+		: CompareTrans<T>("SmoothCompareTrans",destination,&avg,test,value,poll), avg(*monitor), realmon(monitor),
+		burnin((unsigned int)(1/(1-gammap))), tests(0), g(gammap)
+	{ }
+
+	//! constructor, see SmoothCompareTrans class notes for information
+  SmoothCompareTrans(const std::string& name, StateNode* destination, const T* monitor, typename SmoothCompareTrans<T>::Test_t test, const T& value, const EventBase& poll, float gammap=0)
+		: CompareTrans<T>("SmoothCompareTrans",name,destination,&avg,test,value,poll), avg(*monitor), realmon(monitor),
 		burnin((unsigned int)(1/(1-gammap))), tests(0), g(gammap)
 	{ }
 
@@ -47,8 +53,6 @@
 			CompareTrans<T>::processEvent(e);
 	}
 
-	virtual std::string getName() const { return "SmoothCompareTrans"; }
-
 protected:
 	T avg; //!< the current running average
 	const T* realmon; //!< pointer to the value being monitored
@@ -69,10 +73,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Transitions/TimeOutTrans.h ./Behaviors/Transitions/TimeOutTrans.h
--- ../Tekkotsu_2.2/Behaviors/Transitions/TimeOutTrans.h	Thu Oct  7 15:07:05 2004
+++ ./Behaviors/Transitions/TimeOutTrans.h	Mon Nov 15 17:46:19 2004
@@ -9,7 +9,10 @@
 class TimeOutTrans : public Transition {
 public:
   //! constructor, specify delay in milliseconds
-  TimeOutTrans(StateNode* destination, unsigned int delay) : Transition(destination), d(delay) {}
+  TimeOutTrans(StateNode* destination, unsigned int delay) : Transition("TimeOutTrans",destination), d(delay) {}
+
+  //! constructor, specify delay in milliseconds
+  TimeOutTrans(const std::string& name, StateNode* destination, unsigned int delay) : Transition("TimeOutTrans",name,destination), d(delay) {}
 
   //!starts timer
   virtual void DoStart() {
@@ -32,9 +35,10 @@
     fire();
   }
 
-  virtual std::string getName() const { return "TimeOutTrans"; }
-
 protected:
+  //! constructor, specify delay in milliseconds
+  TimeOutTrans(const std::string& classname, const std::string& instancename, StateNode* destination, unsigned int delay) : Transition(classname,instancename,destination), d(delay) {}
+
   //!amount to delay (in milliseconds) before transition
   unsigned int d;
 };
@@ -44,10 +48,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Transitions/VisualTargetCloseTrans.h ./Behaviors/Transitions/VisualTargetCloseTrans.h
--- ../Tekkotsu_2.2/Behaviors/Transitions/VisualTargetCloseTrans.h	Thu Oct  7 15:07:05 2004
+++ ./Behaviors/Transitions/VisualTargetCloseTrans.h	Mon Nov 15 17:46:19 2004
@@ -14,7 +14,10 @@
 class VisualTargetCloseTrans : public Transition {
 public:
 	//!constructor
-	VisualTargetCloseTrans(StateNode* destination, unsigned int source_id) : Transition(destination), sid(source_id) {}
+	VisualTargetCloseTrans(StateNode* destination, unsigned int source_id) : Transition("VisualTargetCloseTrans",destination), sid(source_id) {}
+
+	//!constructor
+	VisualTargetCloseTrans(const std::string& name, StateNode* destination, unsigned int source_id) : Transition("VisualTargetCloseTrans",name,destination), sid(source_id) {}
 
 	//!starts listening for the object specified by the source id in the constructor
 	virtual void DoStart() { Transition::DoStart(); erouter->addListener(this,EventBase::visObjEGID,sid); }
@@ -41,8 +44,6 @@
 			fire();
 	}
 
-	virtual std::string getName() const { return "VisualTargetCloseTrans"; }
-
 protected:
 	//!Source ID of object to track
 	unsigned int sid;
@@ -53,10 +54,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Behaviors/Transitions/VisualTargetTrans.h ./Behaviors/Transitions/VisualTargetTrans.h
--- ../Tekkotsu_2.2/Behaviors/Transitions/VisualTargetTrans.h	Thu Oct  7 15:07:05 2004
+++ ./Behaviors/Transitions/VisualTargetTrans.h	Mon Nov 15 17:46:19 2004
@@ -12,7 +12,11 @@
 public:
 	//!constructor
 	VisualTargetTrans(StateNode* destination, unsigned int source_id)
-		: Transition(destination), sid(source_id), count(0) {}
+		: Transition("VisualTargetTrans",destination), sid(source_id), count(0) {}
+
+	//!constructor
+	VisualTargetTrans(const std::string& name, StateNode* destination, unsigned int source_id)
+		: Transition("VisualTargetTrans",name,destination), sid(source_id), count(0) {}
 
 	//!starts listening for the object specified by the source id in the constructor
 	virtual void DoStart() {
@@ -46,8 +50,6 @@
 		//serr->printf("VisualTargetTrans::processEvent() - leave %d\n",get_time());
 	}
 
-	virtual std::string getName() const { return "VisualTargetTrans"; }
-
 protected:
 	//!Source ID of object to track
 	unsigned int sid;
@@ -60,10 +62,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Events/ButtonEvent.cc ./Events/ButtonEvent.cc
--- ../Tekkotsu_2.2/Events/ButtonEvent.cc	Thu Sep 16 16:39:53 2004
+++ ./Events/ButtonEvent.cc	Thu Sep 16 16:39:53 2004
@@ -78,7 +78,7 @@
  * @author YOURNAMEHERE (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/ButtonEvent.h ./Events/ButtonEvent.h
--- ../Tekkotsu_2.2/Events/ButtonEvent.h	Thu Sep 16 16:39:53 2004
+++ ./Events/ButtonEvent.h	Thu Sep 16 16:39:53 2004
@@ -32,7 +32,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/DataEvent.h ./Events/DataEvent.h
--- ../Tekkotsu_2.2/Events/DataEvent.h	Sun Jan 18 05:16:57 2004
+++ ./Events/DataEvent.h	Sun Jan 18 05:16:57 2004
@@ -32,7 +32,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/EventBase.cc ./Events/EventBase.cc
--- ../Tekkotsu_2.2/Events/EventBase.cc	Tue Sep 28 19:07:02 2004
+++ ./Events/EventBase.cc	Tue Sep 28 19:07:02 2004
@@ -168,7 +168,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/EventBase.h ./Events/EventBase.h
--- ../Tekkotsu_2.2/Events/EventBase.h	Mon Oct 18 12:59:20 2004
+++ ./Events/EventBase.h	Mon Oct 18 12:59:20 2004
@@ -176,7 +176,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/EventGeneratorBase.cc ./Events/EventGeneratorBase.cc
--- ../Tekkotsu_2.2/Events/EventGeneratorBase.cc	Thu Oct  7 15:07:05 2004
+++ ./Events/EventGeneratorBase.cc	Tue Nov  9 15:01:49 2004
@@ -1,27 +1,81 @@
 #include "EventGeneratorBase.h"
 #include "Events/EventRouter.h"
 
+using namespace std;
+
 void
 EventGeneratorBase::DoStart() {
 	BehaviorBase::DoStart();
-	if(autoListen)
-		erouter->addListener(this,getListenGeneratorID(),getListenSourceID());
+	if(autoListen) {
+		erouter->addListener(this,EventBase::erouterEGID,getGeneratorID());
+		if(erouter->hasListeners(getGeneratorID(),getSourceID())) {
+			erouter->addListener(this,getListenGeneratorID(),getListenSourceID());
+			isListening=true;
+		}
+	}
 }
 
 void
 EventGeneratorBase::DoStop() {
 	erouter->removeListener(this);
+	isListening=false;
 	BehaviorBase::DoStop();
 }
 
+void
+EventGeneratorBase::processEvent(const EventBase& event) {
+	if(!autoListen)
+		return;
+	if(event.getGeneratorID()==EventBase::erouterEGID) {
+		if(erouter->hasListeners(getGeneratorID(),getSourceID())) {
+			if(!isListening) {
+				erouter->addListener(this,getListenGeneratorID(),getListenSourceID());
+				isListening=true;
+			}
+		} else {
+			if(isListening) {
+				erouter->removeListener(this,getListenGeneratorID(),getListenSourceID());
+				isListening=false;
+			}
+		}
+	}
+}
+
+void
+EventGeneratorBase::setAutoListen(EventBase::EventGeneratorID_t gid, unsigned int sid) {
+	if(isListening) {
+		erouter->removeListener(this,getListenGeneratorID(),getListenSourceID());
+		isListening=false;
+	}
+	autoListen=true;
+	srcGenID=gid;
+	srcSourceID=sid;
+		if(erouter->hasListeners(getGeneratorID(),getSourceID())) {
+		if(!isListening) {
+			erouter->addListener(this,getListenGeneratorID(),getListenSourceID());
+			isListening=true;
+		}
+	}
+}
+
+void
+EventGeneratorBase::unsetAutoListen() {
+	if(isListening) {
+		erouter->removeListener(this,getListenGeneratorID(),getListenSourceID());
+		isListening=false;
+	}
+	autoListen=false;
+}
+
+
 /*! @file
  * @brief 
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Events/EventGeneratorBase.h ./Events/EventGeneratorBase.h
--- ../Tekkotsu_2.2/Events/EventGeneratorBase.h	Wed Feb 18 16:12:18 2004
+++ ./Events/EventGeneratorBase.h	Wed Nov 10 20:45:37 2004
@@ -22,14 +22,11 @@
 public:
 	//!@name Constructors
 	//!
-	EventGeneratorBase()
-		: BehaviorBase(), myGenID(EventBase::unknownEGID), mySourceID(0), autoListen(false), srcGenID(EventBase::unknownEGID), srcSourceID(0), myName()
-	{}
 	EventGeneratorBase(const std::string& name, EventBase::EventGeneratorID_t mgid, unsigned int msid)
-		: BehaviorBase(), myGenID(mgid), mySourceID(msid), autoListen(false), srcGenID(EventBase::unknownEGID), srcSourceID(0), myName(name)
+		: BehaviorBase(name), myGenID(mgid), mySourceID(msid), autoListen(false), isListening(false), srcGenID(EventBase::unknownEGID), srcSourceID(0)
 	{}
 	EventGeneratorBase(const std::string& name, EventBase::EventGeneratorID_t mgid, unsigned int msid,EventBase::EventGeneratorID_t srcgid, unsigned int srcsid)
-		: BehaviorBase(), myGenID(mgid), mySourceID(msid), autoListen(true), srcGenID(srcgid), srcSourceID(srcsid), myName(name)
+		: BehaviorBase(name), myGenID(mgid), mySourceID(msid), autoListen(true), isListening(false), srcGenID(srcgid), srcSourceID(srcsid)
 	{}
 	//@}
 
@@ -40,6 +37,13 @@
 	
 	virtual void DoStop();
 	
+	//! if autolistening, will receive EventRouter events concerning our own listeners
+	/*! This will automatically reduce overhead by eliminating chains of events thrown
+	 *  that don't have any end listeners.  However, this might mean your subclass's
+	 *  processEvent will be receiving the events from erouterEGID, and will need
+	 *  to call EventGeneratorBase::processEvent() in order to allow them to be used */
+	virtual void processEvent(const EventBase& event);
+	
 	//! return the generator ID that will be broadcast from
 	virtual EventBase::EventGeneratorID_t getGeneratorID() { return myGenID; }
 	//! set the generator ID that will be broadcast from (typically it's a bad idea to call this...)
@@ -55,28 +59,18 @@
 	//! returns the generator ID that will be listened for (not the generator of the FilterBankEvent to be created - that depends on the subclass)
 	virtual EventBase::EventGeneratorID_t getListenGeneratorID() const { return srcGenID; }
 	//! turns on auto listening to make it easier to set up dependancies between vision filters
-	virtual void setAutoListen(EventBase::EventGeneratorID_t gid, unsigned int sid) { autoListen=true; srcGenID=gid; srcSourceID=sid; }
+	virtual void setAutoListen(EventBase::EventGeneratorID_t gid, unsigned int sid);
 
 	//! turns off auto listening
-	virtual void unsetAutoListen() { autoListen=false; }
-
-	//! returns current name
-	virtual std::string getName() const {
-		return myName;
-	}
-
-	//! sets a name (overriding automatically generated one)
-	virtual void setName(const std::string& name) {
-		myName=name;
-	}
+	virtual void unsetAutoListen();
 
 protected:
 	EventBase::EventGeneratorID_t myGenID; //!< the generator ID to broadcast on
 	unsigned int mySourceID;     //!< the source ID to broadcast on
 	bool autoListen;          //!< if true, will automatically start listening for EventBase(genID,sourceID) events
+	bool isListening;         //!< true if listening triggered by autoListen
 	EventBase::EventGeneratorID_t srcGenID; //!< the generator ID to listen for (typically the source that this filter works on)
 	unsigned int srcSourceID;    //!< the source ID to listen for
-	std::string myName;  //!< the name to report (handy for debugging output)
 };
 
 /*! @file
@@ -84,10 +78,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Events/EventListener.h ./Events/EventListener.h
--- ../Tekkotsu_2.2/Events/EventListener.h	Thu Sep 25 11:27:10 2003
+++ ./Events/EventListener.h	Thu Sep 25 11:27:10 2003
@@ -20,7 +20,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/EventRouter.cc ./Events/EventRouter.cc
--- ../Tekkotsu_2.2/Events/EventRouter.cc	Thu Oct  7 18:14:17 2004
+++ ./Events/EventRouter.cc	Thu Oct  7 18:14:17 2004
@@ -532,7 +532,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/EventRouter.h ./Events/EventRouter.h
--- ../Tekkotsu_2.2/Events/EventRouter.h	Thu Oct  7 18:14:17 2004
+++ ./Events/EventRouter.h	Thu Oct  7 18:14:17 2004
@@ -299,7 +299,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/EventTranslator.cc ./Events/EventTranslator.cc
--- ../Tekkotsu_2.2/Events/EventTranslator.cc	Thu Oct 14 19:02:35 2004
+++ ./Events/EventTranslator.cc	Thu Oct 14 19:02:35 2004
@@ -86,7 +86,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/EventTranslator.h ./Events/EventTranslator.h
--- ../Tekkotsu_2.2/Events/EventTranslator.h	Thu Sep 16 14:35:12 2004
+++ ./Events/EventTranslator.h	Thu Sep 16 14:35:12 2004
@@ -62,7 +62,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/EventTrapper.h ./Events/EventTrapper.h
--- ../Tekkotsu_2.2/Events/EventTrapper.h	Thu Sep 25 11:27:10 2003
+++ ./Events/EventTrapper.h	Thu Sep 25 11:27:10 2003
@@ -26,7 +26,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/FilterBankEvent.h ./Events/FilterBankEvent.h
--- ../Tekkotsu_2.2/Events/FilterBankEvent.h	Sun Jan 18 05:16:57 2004
+++ ./Events/FilterBankEvent.h	Sun Jan 18 05:16:57 2004
@@ -58,7 +58,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/LocomotionEvent.cc ./Events/LocomotionEvent.cc
--- ../Tekkotsu_2.2/Events/LocomotionEvent.cc	Wed Sep  1 17:30:57 2004
+++ ./Events/LocomotionEvent.cc	Wed Sep  1 17:30:57 2004
@@ -60,7 +60,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/LocomotionEvent.h ./Events/LocomotionEvent.h
--- ../Tekkotsu_2.2/Events/LocomotionEvent.h	Wed Sep  1 17:30:57 2004
+++ ./Events/LocomotionEvent.h	Wed Sep  1 17:30:57 2004
@@ -45,7 +45,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/SegmentedColorFilterBankEvent.h ./Events/SegmentedColorFilterBankEvent.h
--- ../Tekkotsu_2.2/Events/SegmentedColorFilterBankEvent.h	Sun Jan 18 05:16:57 2004
+++ ./Events/SegmentedColorFilterBankEvent.h	Sun Jan 18 05:16:57 2004
@@ -69,7 +69,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/TextMsgEvent.cc ./Events/TextMsgEvent.cc
--- ../Tekkotsu_2.2/Events/TextMsgEvent.cc	Wed Sep  1 17:30:57 2004
+++ ./Events/TextMsgEvent.cc	Wed Sep  1 17:30:57 2004
@@ -54,7 +54,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/TextMsgEvent.h ./Events/TextMsgEvent.h
--- ../Tekkotsu_2.2/Events/TextMsgEvent.h	Wed Sep  1 17:30:57 2004
+++ ./Events/TextMsgEvent.h	Wed Sep  1 17:30:57 2004
@@ -35,7 +35,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Events/VisionObjectEvent.h ./Events/VisionObjectEvent.h
--- ../Tekkotsu_2.2/Events/VisionObjectEvent.h	Wed Sep  1 17:30:57 2004
+++ ./Events/VisionObjectEvent.h	Wed Sep  1 17:30:57 2004
@@ -46,7 +46,7 @@
  * @author alokl (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/MMCombo/MMCombo.cc ./MMCombo/MMCombo.cc
--- ../Tekkotsu_2.2/MMCombo/MMCombo.cc	Mon Oct 11 18:00:19 2004
+++ ./MMCombo/MMCombo.cc	Fri Nov 12 17:07:39 2004
@@ -366,7 +366,7 @@
 	if(state!=NULL)
 		isERS7=state->robotDesign&WorldState::ERS7Mask;
 	else {
-		char robotDesignStr[orobotdesignNAME_MAX];
+		char robotDesignStr[orobotdesignNAME_MAX + 1];
 		memset(robotDesignStr, 0, sizeof(robotDesignStr));
 		if (OPENR::GetRobotDesign(robotDesignStr) != oSUCCESS) {
 			cout << objectName << "::SetupOutputs - OPENR::GetRobotDesign() failed." << endl;
@@ -387,12 +387,13 @@
 		}
 			
 		// Should be a relatively simple matter to copy angles into commands...
-		unsigned int used=0; //but only copy open joints (so main does ears, motion does everything else)
+		unsigned int used=0; //but only copy open joints (so main does ears on 210, motion does everything else)
 		for(unsigned int i=PIDJointOffset; i<PIDJointOffset+NumPIDJoints; i++)
 			if(open[i]) {
+				float cal=config->motion.calibration[i-PIDJointOffset];
 				OJointCommandValue2* jval = reinterpret_cast<OJointCommandValue2*>(cmdVecData->GetData(used)->value);
 				for(unsigned int frame=0; frame<NumFrames; frame++)
-					jval[frame].value = (slongword)(outputs[frame][i]*1e6);
+					jval[frame].value = (slongword)(outputs[frame][i]*1e6*cal);
 				used++;
 			}
 		if(isERS7) {
@@ -534,9 +535,10 @@
 	PROFSECTION("GotAudio()",state->mainProfile);
 	etrans.translateEvents();
 
-	erouter->postEvent(new DataEvent<const OSoundVectorData*>(reinterpret_cast<const OSoundVectorData*>(event.Data(0)),EventBase::micOSndEGID,0,EventBase::statusETID));
-	
-  erouter->processTimers();
+	for (int i = 0; i < event.NumOfData(); i++) {
+		erouter->postEvent(new DataEvent<const OSoundVectorData*>(reinterpret_cast<const OSoundVectorData*>(event.Data(i)),EventBase::micOSndEGID,0,EventBase::statusETID));
+		erouter->processTimers();
+	}
   
   observer[obsMic]->AssertReady();
 }
@@ -616,7 +618,7 @@
 void
 MMCombo::SetupOutputs(const bool to_open[NumOutputs])
 {
-	char robotDesignStr[orobotdesignNAME_MAX];
+	char robotDesignStr[orobotdesignNAME_MAX + 1];
 	memset(robotDesignStr, 0, sizeof(robotDesignStr));
 	if (OPENR::GetRobotDesign(robotDesignStr) != oSUCCESS) {
 		cout << objectName << "::SetupOutputs - OPENR::GetRobotDesign() failed." << endl;
@@ -767,10 +769,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 
diff -urdN ../Tekkotsu_2.2/MMCombo/MMCombo.h ./MMCombo/MMCombo.h
--- ../Tekkotsu_2.2/MMCombo/MMCombo.h	Tue Sep 28 19:07:04 2004
+++ ./MMCombo/MMCombo.h	Tue Sep 28 19:07:04 2004
@@ -141,7 +141,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/DynamicMotionSequence.h ./Motion/DynamicMotionSequence.h
--- ../Tekkotsu_2.2/Motion/DynamicMotionSequence.h	Thu Sep 25 11:27:22 2003
+++ ./Motion/DynamicMotionSequence.h	Thu Sep 25 11:27:22 2003
@@ -112,7 +112,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/EmergencyStopMC.cc ./Motion/EmergencyStopMC.cc
--- ../Tekkotsu_2.2/Motion/EmergencyStopMC.cc	Mon Aug 30 16:26:45 2004
+++ ./Motion/EmergencyStopMC.cc	Mon Aug 30 16:26:45 2004
@@ -209,7 +209,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/EmergencyStopMC.h ./Motion/EmergencyStopMC.h
--- ../Tekkotsu_2.2/Motion/EmergencyStopMC.h	Mon Aug 30 16:26:45 2004
+++ ./Motion/EmergencyStopMC.h	Mon Aug 30 16:26:45 2004
@@ -62,7 +62,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/Geometry.h ./Motion/Geometry.h
--- ../Tekkotsu_2.2/Motion/Geometry.h	Thu Sep 25 11:27:22 2003
+++ ./Motion/Geometry.h	Thu Sep 25 11:27:22 2003
@@ -51,7 +51,7 @@
  * @verbinclude CMPack_license.txt
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/HeadPointerMC.cc ./Motion/HeadPointerMC.cc
--- ../Tekkotsu_2.2/Motion/HeadPointerMC.cc	Thu Oct 14 17:59:23 2004
+++ ./Motion/HeadPointerMC.cc	Thu Oct 14 17:59:23 2004
@@ -113,7 +113,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/HeadPointerMC.h ./Motion/HeadPointerMC.h
--- ../Tekkotsu_2.2/Motion/HeadPointerMC.h	Thu Oct 14 19:02:53 2004
+++ ./Motion/HeadPointerMC.h	Thu Oct 14 19:02:53 2004
@@ -121,7 +121,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/Kinematics.cc ./Motion/Kinematics.cc
--- ../Tekkotsu_2.2/Motion/Kinematics.cc	Sat Oct 16 21:16:10 2004
+++ ./Motion/Kinematics.cc	Thu Oct 28 19:06:10 2004
@@ -322,6 +322,11 @@
 }
 
 NEWMAT::ReturnMatrix
+Kinematics::calculateGroundPlane() {
+  return calculateGroundPlane(pack(state->sensors[BAccelOffset],state->sensors[LAccelOffset],state->sensors[DAccelOffset]));
+}
+
+NEWMAT::ReturnMatrix
 Kinematics::calculateGroundPlane(const NEWMAT::ColumnVector& down) {
 	//Find the unused foot
 	unsigned int highleg=findUnusedLeg(down);
@@ -405,10 +410,10 @@
  * @brief 
  * @author ejt (Creator)
  *
- * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Motion/Kinematics.h ./Motion/Kinematics.h
--- ../Tekkotsu_2.2/Motion/Kinematics.h	Tue Oct 19 13:06:31 2004
+++ ./Motion/Kinematics.h	Tue Oct 19 13:06:31 2004
@@ -317,7 +317,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/LedEngine.cc ./Motion/LedEngine.cc
--- ../Tekkotsu_2.2/Motion/LedEngine.cc	Sun Sep 12 00:22:37 2004
+++ ./Motion/LedEngine.cc	Sun Sep 12 00:22:37 2004
@@ -392,7 +392,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/LedEngine.h ./Motion/LedEngine.h
--- ../Tekkotsu_2.2/Motion/LedEngine.h	Sun Sep 12 00:22:37 2004
+++ ./Motion/LedEngine.h	Mon Nov 15 19:29:47 2004
@@ -75,7 +75,7 @@
 	void flash(LEDBitMask_t leds, unsigned int ms);
 	//!causes the leds specified by @a leds to cycle between low and high, clears others.  See cycle() for parameter documentation.
 	inline void ccycle(LEDBitMask_t leds, unsigned int period, float amp, float offset=0, int phase=0) { clear(); cycle(leds,period,amp,offset,phase); }
-	//!causes the leds specified by @a leds to cycle between low and high
+	//!causes the leds specified by @a leds to cycle between low and high; values calculated for cycle will be clipped to [0,1] for more sensible blending of square wave approximations (high amplitude sine wave)
 	void cycle(LEDBitMask_t leds, unsigned int period, float amp, float offset=0, int phase=0);
 	//!sets all leds to 0.
 	void clear();
@@ -134,6 +134,10 @@
 	static float calcCycle(unsigned int period, float amp, float offset, unsigned int t) {
 		//		cout << period << ',' << amp << ',' << offset << ',' << time << " -> " << x;
 		float x=cos(t*6.2831853/period)*(-amp/2)+.5+offset;
+		if(x<0)
+			return 0;
+		if(x>1)
+			return 1;
 		return x;
 	}
 	//!Calculates the current value of led @a i for current time t
@@ -172,11 +176,11 @@
  * @brief Describes LedEngine, which provides basic LED effects to anything that inherits or instantiates it
  * @author ejt (Creator)
  *
- * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Motion/LedMC.h ./Motion/LedMC.h
--- ../Tekkotsu_2.2/Motion/LedMC.h	Fri Sep 10 18:25:15 2004
+++ ./Motion/LedMC.h	Fri Sep 10 18:25:15 2004
@@ -57,7 +57,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/MMAccessor.h ./Motion/MMAccessor.h
--- ../Tekkotsu_2.2/Motion/MMAccessor.h	Wed Feb 18 16:13:02 2004
+++ ./Motion/MMAccessor.h	Wed Feb 18 16:13:02 2004
@@ -153,7 +153,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/MotionCommand.cc ./Motion/MotionCommand.cc
--- ../Tekkotsu_2.2/Motion/MotionCommand.cc	Thu Sep 25 11:27:23 2003
+++ ./Motion/MotionCommand.cc	Thu Sep 25 11:27:23 2003
@@ -7,7 +7,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/MotionCommand.h ./Motion/MotionCommand.h
--- ../Tekkotsu_2.2/Motion/MotionCommand.h	Mon Feb  9 17:45:28 2004
+++ ./Motion/MotionCommand.h	Mon Feb  9 17:45:28 2004
@@ -186,7 +186,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/MotionManager.cc ./Motion/MotionManager.cc
--- ../Tekkotsu_2.2/Motion/MotionManager.cc	Sat Oct 16 21:16:11 2004
+++ ./Motion/MotionManager.cc	Sat Oct 16 21:16:11 2004
@@ -748,7 +748,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/MotionManager.h ./Motion/MotionManager.h
--- ../Tekkotsu_2.2/Motion/MotionManager.h	Mon Oct 18 19:10:26 2004
+++ ./Motion/MotionManager.h	Mon Oct 18 19:10:26 2004
@@ -259,7 +259,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/MotionManagerMsg.h ./Motion/MotionManagerMsg.h
--- ../Tekkotsu_2.2/Motion/MotionManagerMsg.h	Tue Sep  2 16:58:49 2003
+++ ./Motion/MotionManagerMsg.h	Tue Sep  2 16:58:49 2003
@@ -52,7 +52,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/MotionSequenceMC.cc ./Motion/MotionSequenceMC.cc
--- ../Tekkotsu_2.2/Motion/MotionSequenceMC.cc	Thu Oct 14 19:02:53 2004
+++ ./Motion/MotionSequenceMC.cc	Mon Nov  8 16:48:19 2004
@@ -197,7 +197,7 @@
 }
 
 unsigned int MotionSequence::SaveBuffer(char buf[], unsigned int len) const {
-	std::cout << "SAVEBUFFER..." << std::flush;
+	//std::cout << "SAVEBUFFER..." << std::flush;
 	unsigned int origlen=len;
 	int written=snprintf(buf,len,"#MSq\n");
 	if(!ChkAdvance(written,(const char**)&buf,&len,"*** ERROR MotionSequence save failed on header\n")) return 0;	if(len==0 || len>origlen) {
@@ -434,9 +434,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Motion/MotionSequenceMC.h ./Motion/MotionSequenceMC.h
--- ../Tekkotsu_2.2/Motion/MotionSequenceMC.h	Thu Oct 14 15:24:46 2004
+++ ./Motion/MotionSequenceMC.h	Thu Oct 14 15:24:46 2004
@@ -341,7 +341,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/OldHeadPointerMC.cc ./Motion/OldHeadPointerMC.cc
--- ../Tekkotsu_2.2/Motion/OldHeadPointerMC.cc	Thu Oct 14 16:23:50 2004
+++ ./Motion/OldHeadPointerMC.cc	Thu Oct 14 16:23:50 2004
@@ -176,7 +176,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/OldHeadPointerMC.h ./Motion/OldHeadPointerMC.h
--- ../Tekkotsu_2.2/Motion/OldHeadPointerMC.h	Thu Oct 14 16:23:50 2004
+++ ./Motion/OldHeadPointerMC.h	Thu Oct 14 16:23:50 2004
@@ -116,7 +116,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/OldKinematics.cc ./Motion/OldKinematics.cc
--- ../Tekkotsu_2.2/Motion/OldKinematics.cc	Thu Aug  5 16:29:04 2004
+++ ./Motion/OldKinematics.cc	Thu Aug  5 16:29:04 2004
@@ -603,7 +603,7 @@
  * @verbinclude CMPack_license.txt
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/OldKinematics.h ./Motion/OldKinematics.h
--- ../Tekkotsu_2.2/Motion/OldKinematics.h	Thu Aug  5 16:29:04 2004
+++ ./Motion/OldKinematics.h	Thu Aug  5 16:29:04 2004
@@ -118,7 +118,7 @@
  * @verbinclude CMPack_license.txt
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/OutputCmd.h ./Motion/OutputCmd.h
--- ../Tekkotsu_2.2/Motion/OutputCmd.h	Sun Sep  7 18:14:01 2003
+++ ./Motion/OutputCmd.h	Sun Sep  7 18:14:01 2003
@@ -27,7 +27,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/OutputPID.h ./Motion/OutputPID.h
--- ../Tekkotsu_2.2/Motion/OutputPID.h	Sat Dec 13 00:01:40 2003
+++ ./Motion/OutputPID.h	Sat Dec 13 00:01:40 2003
@@ -44,7 +44,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/PIDMC.h ./Motion/PIDMC.h
--- ../Tekkotsu_2.2/Motion/PIDMC.h	Wed Jan 14 15:45:01 2004
+++ ./Motion/PIDMC.h	Wed Jan 14 15:45:01 2004
@@ -138,7 +138,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/Path.h ./Motion/Path.h
--- ../Tekkotsu_2.2/Motion/Path.h	Thu Sep 25 11:27:23 2003
+++ ./Motion/Path.h	Thu Sep 25 11:27:23 2003
@@ -107,7 +107,7 @@
  * @endverbatim
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/PostureEngine.cc ./Motion/PostureEngine.cc
--- ../Tekkotsu_2.2/Motion/PostureEngine.cc	Mon Oct 18 15:53:33 2004
+++ ./Motion/PostureEngine.cc	Mon Nov 15 16:43:54 2004
@@ -180,6 +180,7 @@
 			}
 		}
 		written=-1;
+		jname[0]='\0';
 		sscanf(buf,formatstring,jname,&fval,&fwht,&written);
 		if(!ChkAdvance(written,&buf,&len,"*** ERROR PostureEngine load corrupted - line %d\n",linenum)) return 0;
 		while(*buf!='\n' && *buf!='\r')
@@ -190,20 +191,22 @@
 			buf++;
 		linenum++;
 		//std::cout << '"' << jname << "\"\t" << (float)fval << '\t' << (float)fwht << std::endl;
-		unsigned int startidx=idx+1;
+		// we continue the search in order from where we left off - these are often
+		// going to go in order, so might as well save a little time
+		unsigned int startidx=idx;
 		for(;idx<NumOutputs;idx++)
 			if(strcmp(jname,outputNames[idx])==0) {
 				cmds[idx].set(fval,fwht);
 				break;
 			}
-		if(idx==NumOutputs) {
+		if(idx==NumOutputs) { //not found following startidx, look from beginning
 			for(idx=0;idx<startidx;idx++)
 				if(strcmp(jname,outputNames[idx])==0) {
 					cmds[idx].set(fval,fwht);
 					break;
 			}
-			if(idx==startidx && strcmp(jname,outputNames[idx])!=0)
-				std::cout << "*** WARNING " << jname << " is not a valid joint on this model." << std::endl;
+			if(idx==startidx && strcmp(jname,outputNames[idx])!=0) //not found at all
+				std::cout << "*** WARNING '" << jname << "' is not a valid joint on this model." << std::endl;
 		}
 	}
 	std::cout << "*** WARNING PostureEngine load missing #END" << std::endl;
@@ -330,9 +333,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Motion/PostureEngine.h ./Motion/PostureEngine.h
--- ../Tekkotsu_2.2/Motion/PostureEngine.h	Mon Oct 18 15:53:33 2004
+++ ./Motion/PostureEngine.h	Mon Oct 18 15:53:33 2004
@@ -109,7 +109,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/PostureMC.h ./Motion/PostureMC.h
--- ../Tekkotsu_2.2/Motion/PostureMC.h	Mon Aug 30 16:26:45 2004
+++ ./Motion/PostureMC.h	Mon Aug 30 16:26:45 2004
@@ -92,7 +92,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/RemoteControllerMC.h ./Motion/RemoteControllerMC.h
--- ../Tekkotsu_2.2/Motion/RemoteControllerMC.h	Wed Jan  7 17:52:26 2004
+++ ./Motion/RemoteControllerMC.h	Wed Jan  7 17:52:26 2004
@@ -44,7 +44,7 @@
  * @author alokl (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/Spline.h ./Motion/Spline.h
--- ../Tekkotsu_2.2/Motion/Spline.h	Thu Sep 25 11:27:23 2003
+++ ./Motion/Spline.h	Thu Sep 25 11:27:23 2003
@@ -375,7 +375,7 @@
  * @endverbatim
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/TailWagMC.h ./Motion/TailWagMC.h
--- ../Tekkotsu_2.2/Motion/TailWagMC.h	Thu Sep 25 11:27:23 2003
+++ ./Motion/TailWagMC.h	Mon Nov 15 17:22:36 2004
@@ -12,16 +12,25 @@
 class TailWagMC : public MotionCommand {
  public:
 	//!constructor
-	TailWagMC() : period(500), magnitude(22*3.141592/180), active(false), tilt() { }
+	TailWagMC() : period(500), magnitude(22*M_PI/180), active(true), tilt() { }
+	TailWagMC(unsigned int cyc_period, float cyc_magnitude) : period(cyc_period), magnitude(cyc_magnitude), active(true), tilt() { }
 	//!destructor
 	virtual ~TailWagMC() {}
 	virtual int updateOutputs() {
-		if(active && state->robotDesign&WorldState::ERS210Mask) {
+		if(!active)
+			return 0;
+		if(state->robotDesign&WorldState::ERS210Mask) {
 			for(unsigned int i=0; i<NumFrames; i++)
-				pans[i].set(sin((2*M_PI*(get_time()+i*FrameTime))/period)*magnitude); //bug fix thanks L.A.Olsson@herts.ac.uk
+				pans[i].set(sin((2*M_PI*(get_time()+i*FrameTime))/period)*magnitude); //bug fix thanks L.A.Olsson AT herts ac uk
 			motman->setOutput(this,ERS210Info::TailOffset+PanOffset,pans);
 			motman->setOutput(this,ERS210Info::TailOffset+TiltOffset,tilt);
-			return 1;
+			return tilt.weight>0?2:1;
+		} else if(state->robotDesign&WorldState::ERS7Mask) {
+			for(unsigned int i=0; i<NumFrames; i++)
+				pans[i].set(sin((2*M_PI*(get_time()+i*FrameTime))/period)*magnitude); //bug fix thanks L.A.Olsson AT herts ac uk
+			motman->setOutput(this,ERS7Info::TailOffset+PanOffset,pans);
+			motman->setOutput(this,ERS7Info::TailOffset+TiltOffset,tilt);
+			return tilt.weight>0?2:1;
 		} else
 			return 0;
 	}
@@ -51,10 +60,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
- * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
+ * $State: Exp $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Motion/WalkMC.cc ./Motion/WalkMC.cc
--- ../Tekkotsu_2.2/Motion/WalkMC.cc	Fri Jul 23 23:10:59 2004
+++ ./Motion/WalkMC.cc	Fri Jul 23 23:10:59 2004
@@ -544,7 +544,7 @@
  * @verbinclude CMPack_license.txt
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/WalkMC.h ./Motion/WalkMC.h
--- ../Tekkotsu_2.2/Motion/WalkMC.h	Thu Aug  5 16:29:04 2004
+++ ./Motion/WalkMC.h	Thu Aug  5 16:29:04 2004
@@ -269,7 +269,7 @@
  * @verbinclude CMPack_license.txt
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/WaypointEngine.h ./Motion/WaypointEngine.h
--- ../Tekkotsu_2.2/Motion/WaypointEngine.h	Tue Jul 27 10:33:59 2004
+++ ./Motion/WaypointEngine.h	Tue Jul 27 10:33:59 2004
@@ -750,7 +750,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/WaypointWalkMC.h ./Motion/WaypointWalkMC.h
--- ../Tekkotsu_2.2/Motion/WaypointWalkMC.h	Tue Jul 27 10:33:59 2004
+++ ./Motion/WaypointWalkMC.h	Tue Jul 27 10:33:59 2004
@@ -50,7 +50,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/gvector.h ./Motion/gvector.h
--- ../Tekkotsu_2.2/Motion/gvector.h	Thu Sep 25 11:27:23 2003
+++ ./Motion/gvector.h	Thu Sep 25 11:27:23 2003
@@ -677,7 +677,7 @@
  * @endverbatim
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Motion/roboop/Makefile ./Motion/roboop/Makefile
--- ../Tekkotsu_2.2/Motion/roboop/Makefile	Tue Oct  5 00:40:50 2004
+++ ./Motion/roboop/Makefile	Tue Nov  9 16:26:13 2004
@@ -3,12 +3,14 @@
 # This makefile is suitable for Unix-like systems with non-ANSI compilers.
 # If you have an ANSI compiler, makefile.ansi is a better starting point.
 
-# Read installation instructions before saying "make" !!
-
-# The name of your C compiler:
-OPENRSDK_ROOT ?= /usr/local/OPEN_R_SDK
-TEKKOTSU_ROOT ?= /usr/local/Tekkotsu
-CXX= $(OPENRSDK_ROOT)/bin/mipsel-linux-gcc
+ifndef TEKKOTSU_ENVIRONMENT_CONFIGURATION
+$(error An error has occured, TEKKOTSU_ENVIRONMENT_CONFIGURATION was not defined)
+endif
+include $(TEKKOTSU_ENVIRONMENT_CONFIGURATION)
+FILTERSYSWARN:=$(patsubst $(TEKKOTSU_ROOT)/%,../../%,$(FILTERSYSWARN))
+COLORFILT:=$(patsubst $(TEKKOTSU_ROOT)/%,../../%,$(COLORFILT))
+BUILDDIR=$(patsubst $(TEKKOTSU_ROOT)/%,../../%,$(TK_BD)/Motion/roboop)
+SRCSUFFIX=.cpp
 
 # You may need to adjust these cc options:
 CXXFLAGS= -I ../../Shared/newmat -fno-inline \
@@ -31,74 +33,73 @@
 RM= rm -f
 # file rename command
 MV= mv
-# library (.a) file creation command
-AR= $(OPENRSDK_ROOT)/bin/mipsel-linux-ar rc
-# second step in .a creation (use "touch" if not needed)
-AR2= $(OPENRSDK_ROOT)/bin/mipsel-linux-ranlib
 
 # End of configurable options.
 
-COLORFILT=$(TEKKOTSU_ROOT)/tools/colorfilt
-FILTERSYSWARN=$(TEKKOTSU_ROOT)/tools/filtersyswarn/filtersyswarn $(OPENRSDK_ROOT)
-
-# source files: JPEG library proper
-LIBSOURCES:= $(wildcard *.cpp)
+# source files:
+LIBSOURCES:= $(wildcard *$(SRCSUFFIX))
+ifeq ($(TEKKOTSU_TARGET_PLATFORM), PLATFORM_APERIOS)
+LIBSOURCES:=$(filter-out gnugraph$(SRCSUFFIX),$(LIBSOURCES))
+endif
 
 SOURCES= $(LIBSOURCES)
 
-LIBOBJECTS= $(LIBSOURCES:.cpp=.o)
+LIBOBJECTS= $(addprefix $(BUILDDIR)/,$(LIBSOURCES:.cpp=.o))
 
-all: libroboop.a
+all: $(BUILDDIR)/libroboop.a
 
 .PHONY: all clean
 
-libroboop.a: $(LIBOBJECTS)
+$(BUILDDIR)/libroboop.a: $(LIBOBJECTS)
 	$(RM) $@
-	$(AR) $@  $(LIBOBJECTS)
-	$(AR2) $@
+	@echo "Linking $@..."
+	@$(AR) $@  $(LIBOBJECTS)
+	@$(AR2) $@
 
 clean:
 	$(RM) *.o *.a *.log core
 
 %.o:
-	@echo "Compiling ROBOOP::$<... (Reduced warnings)"; \
-	$(CXX) $(CXXFLAGS) -o $@ -c $< > $*.log 2>&1; \
+	@mkdir -p $(dir $@)
+	@src=$(patsubst %.o,%$(SRCSUFFIX),$(patsubst $(BUILDDIR)/%,%,$@)); \
+	echo "Compiling ROBOOP::$$src... (Reduced warnings)"; \
+	$(CXX) $(CXXFLAGS) -o $@ -c $$src > $*.log 2>&1; \
 	retval=$$?; \
-	cat $*.log | $(FILTERSYSWARN) | $(COLORFILT); \
-	test $$retval -eq 0; \
+	cat $*.log | $(FILTERSYSWARN) | $(COLORFILT) | $(TEKKOTSU_LOGVIEW); \
+	test $$retval -eq 0;
 
-controller.o: controller.cpp controller.h
+$(BUILDDIR)/controller.o: controller.cpp controller.h
 
-control_select.o: control_select.cpp control_select.h
+$(BUILDDIR)/control_select.o: control_select.cpp control_select.h
 
-dynamics_sim.o: dynamics_sim.cpp dynamics_sim.h
+$(BUILDDIR)/dynamics_sim.o: dynamics_sim.cpp dynamics_sim.h
 
-trajectory.o: trajectory.cpp trajectory.h
+$(BUILDDIR)/trajectory.o: trajectory.cpp trajectory.h
 
-clik.o :  clik.cpp clik.h utils.h robot.h
+$(BUILDDIR)/clik.o :  clik.cpp clik.h utils.h robot.h
 
-robot.o :  robot.cpp utils.h robot.h
+$(BUILDDIR)/robot.o :  robot.cpp utils.h robot.h
 
-config.o : config.cpp config.h
+$(BUILDDIR)/config.o : config.cpp config.h
 
-quaternion.o : quaternion.cpp quaternion.h
+$(BUILDDIR)/quaternion.o : quaternion.cpp quaternion.h
 
-gnugraph.o :  gnugraph.cpp gnugraph.h utils.h robot.h
+$(BUILDDIR)/gnugraph.o :  gnugraph.cpp gnugraph.h utils.h robot.h
 
-comp_dq.o :  comp_dq.cpp utils.h robot.h
+$(BUILDDIR)/comp_dq.o :  comp_dq.cpp utils.h robot.h
 
-comp_dqp.o :  comp_dqp.cpp utils.h robot.h
+$(BUILDDIR)/comp_dqp.o :  comp_dqp.cpp utils.h robot.h
 
-delta_t.o :  delta_t.cpp utils.h robot.h
+$(BUILDDIR)/delta_t.o :  delta_t.cpp utils.h robot.h
 
-dynamics.o :  dynamics.cpp utils.h robot.h
+$(BUILDDIR)/dynamics.o :  dynamics.cpp utils.h robot.h
 
-homogen.o :  homogen.cpp utils.h robot.h
+$(BUILDDIR)/homogen.o :  homogen.cpp utils.h robot.h
 
-invkine.o :  invkine.cpp utils.h robot.h
+$(BUILDDIR)/invkine.o :  invkine.cpp utils.h robot.h
 
-kinemat.o :  kinemat.cpp utils.h robot.h
+$(BUILDDIR)/kinemat.o :  kinemat.cpp utils.h robot.h
 
-sensitiv.o :  sensitiv.cpp utils.h robot.h
+$(BUILDDIR)/sensitiv.o :  sensitiv.cpp utils.h robot.h
 
-utils.o :  utils.cpp utils.h robot.h
+$(BUILDDIR)/utils.o :  utils.cpp utils.h robot.h
diff -urdN ../Tekkotsu_2.2/RemoteProcess/RemoteProcess.cc ./RemoteProcess/RemoteProcess.cc
--- ../Tekkotsu_2.2/RemoteProcess/RemoteProcess.cc	Thu Sep 25 11:27:50 2003
+++ ./RemoteProcess/RemoteProcess.cc	Thu Sep 25 11:27:50 2003
@@ -89,7 +89,7 @@
  * @author alokl (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/RemoteProcess/RemoteProcess.h ./RemoteProcess/RemoteProcess.h
--- ../Tekkotsu_2.2/RemoteProcess/RemoteProcess.h	Thu Sep 25 11:27:50 2003
+++ ./RemoteProcess/RemoteProcess.h	Thu Sep 25 11:27:50 2003
@@ -54,7 +54,7 @@
  * @author alokl (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/Buffer.cc ./Shared/Buffer.cc
--- ../Tekkotsu_2.2/Shared/Buffer.cc	Wed Dec 31 19:00:00 1969
+++ ./Shared/Buffer.cc	Fri Nov 12 17:07:39 2004
@@ -0,0 +1,107 @@
+#include "Buffer.h"
+#include <string.h>
+
+Buffer::Buffer(int size)
+	: data(0), capacity(0), limit(0), position(0) {
+
+	if (size > 0) {
+		data = new char[size];
+		capacity = size;
+	} else {
+		capacity = 0;
+	}
+	limit = capacity;
+}
+
+Buffer::Buffer(const Buffer& rhs)
+	: data(0), capacity(0), limit(0), position(0) {
+		
+	*this = rhs;
+}
+
+Buffer::~Buffer() {
+	delete[] data;
+}
+
+Buffer& Buffer::operator=(const Buffer& rhs) {
+		
+	if (this != &rhs) {
+		if (capacity != rhs.GetCapacity()) {
+			delete[] data;
+			data = 0;
+			capacity = rhs.GetCapacity();
+			data = new char[capacity];
+		}
+		
+		if (capacity > 0) {			
+			memcpy(data, rhs.GetData(), capacity);
+		}
+		
+		position = rhs.GetPosition();
+		limit = rhs.GetLimit();
+	}
+	return *this;
+}
+
+void Buffer::SetPosition(int pos) {
+	if (pos < 0) {
+		position = 0;
+	} else {
+		position = min(pos, limit);
+	}
+}
+
+void Buffer::SetLimit(int lim) {
+	if (lim < 0) {
+		limit = 0;
+	} else {
+		limit = min(lim, capacity);
+	}
+	position = min(position, limit);
+}
+
+void Buffer::SetCapacity(int size) {
+	if (size == capacity) {
+		return;
+	}
+	if (size > 0) {
+		char* newData = new char[size];
+		if (data != 0) {
+			memcpy(newData, data, min(capacity, size)); 
+		}
+		capacity = size;
+		delete[] data;
+		data = newData;
+	} else {
+		capacity = 0;
+		delete[] data;
+		data = 0;
+	}  
+	limit = min(limit, capacity);
+	position = min(position, limit);
+}
+
+bool Buffer::Fill(const char*&src, int& srcLen) {
+	if ((src == 0) || (srcLen < 1)) {
+		return IsFull();
+	}
+	
+	const int charsToRead = limit - position;
+	if (charsToRead < 1) {
+		return true;
+	}
+	
+	if (charsToRead > srcLen) {
+		memcpy(&data[position], src, srcLen);
+		position += srcLen;
+		src += srcLen;
+		srcLen = 0;
+		return false;
+	} else {
+		memcpy(&data[position], src, charsToRead);
+		position += charsToRead;
+		src += charsToRead;
+		srcLen -= charsToRead;
+		return true;
+	}
+}
diff -urdN ../Tekkotsu_2.2/Shared/Buffer.h ./Shared/Buffer.h
--- ../Tekkotsu_2.2/Shared/Buffer.h	Wed Dec 31 19:00:00 1969
+++ ./Shared/Buffer.h	Fri Nov 12 17:07:39 2004
@@ -0,0 +1,55 @@
+//-*-c++-*-
+#ifndef INCLUDED_Buffer_h_
+#define INCLUDED_Buffer_h_
+
+//! Buffer.
+/*! A buffer has three main properties: position, capacity and limit.
+ * Capacity is the real size of the underlying array.
+ * Position is the index of the current element in the buffer (used only by
+ * buffer filling operations at the moment).
+ * Limit is the virtual size of the buffer. Operations such as filling up
+ * the buffer, seeking and so on never go over the limit mark of the buffer. 
+ *
+ * 0 <= position <= limit <= capacity.
+ */
+class Buffer {
+	public:
+	  //! Constructs a new buffer of specified capacity and limit
+		Buffer(int size);
+		//! Constructs a copy of the buffer
+		Buffer(const Buffer& rhs);
+		//! Makes this buffer a copy of the rhs buffer
+		Buffer& operator=(const Buffer& rhs);
+		virtual ~Buffer();
+		
+		//! Gets the pointer to the first element of the underlying array.
+		const char* GetData() const { return data; }
+		//! Gets the pointer to the first element of the underlying array.
+		char* GetData() { return data; }
+		//! Gets the capacity of the buffer.
+		int GetCapacity() const { return capacity; }
+		//! Sets the capacity of the buffer. The underlying array grows and shrinks.
+		void SetCapacity(int size);
+		//! Gets the current position. position <= limit.
+		int GetPosition() const { return position; }
+		//! Gets the limit mark of the buffer. limit <= capacity
+		int GetLimit() const { return limit; }
+		//! Sets the current position.
+		void SetPosition(int pos);
+		//! Sets the limit mark. limit <= capacity
+		void SetLimit(int lim);
+		//! Tries to fill the buffer from current position up to the limit mark. Advances the position, src and srcLen. Returns true if the buffer has been filled.
+		bool Fill(const char*&src, int& srcLen);
+		//! Tries to fill the buffer from current position up to the limit mark. Advances the position, src and srcLen. Returns true if the buffer has been filled.
+		bool Fill(char*& src, int& srcLen) { return Fill((const char*&) src, srcLen); }
+		//! Checks whether the buffer is full, that is position == limit.
+		bool IsFull() const { return (position >= limit); }
+	private:
+		char* data;
+		int capacity;
+		int limit;
+		int position;
+		
+		static int min(int a, int b) { return ((a < b) ? a : b); }
+};
+#endif
diff -urdN ../Tekkotsu_2.2/Shared/CommonInfo.h ./Shared/CommonInfo.h
--- ../Tekkotsu_2.2/Shared/CommonInfo.h	Tue Dec 23 01:33:43 2003
+++ ./Shared/CommonInfo.h	Tue Dec 23 01:33:43 2003
@@ -34,7 +34,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/Config.cc ./Shared/Config.cc
--- ../Tekkotsu_2.2/Shared/Config.cc	Mon Oct 11 18:01:34 2004
+++ ./Shared/Config.cc	Fri Nov 12 17:07:39 2004
@@ -3,7 +3,9 @@
 #include "Vision/RawCameraGenerator.h"
 #include <stdio.h>
 #include <string>
+#include <cstring>
 #include <ctype.h>
+#include "Wireless/Socket.h"
 #ifdef PLATFORM_APERIOS
 #  include <OPENR/OPrimitiveControl.h>
 #  include <OPENR/OPENRAPI.h>
@@ -287,6 +289,14 @@
       } else if (strncasecmp(key,"kinematic_chains",29)==0) {
 				motion.kinematic_chains.push_back(value);
         return &motion.kinematic_chains;
+      } else if (strncasecmp(key,"calibrate:",10)==0) {
+				for(unsigned int i=PIDJointOffset; i<PIDJointOffset+NumPIDJoints; i++)
+					if(strncasecmp(&key[10],outputNames[i],outputNameLen+1)==0) { //+1 to ensure full match
+						motion.calibration[i-PIDJointOffset] = atof(value);
+						return &motion.calibration[i];
+					}
+				std::cout << "WARNING: Could not match '" << (strlen(key)>10?&key[10]:key) << "' as calibration parameter" << std::endl;
+				return NULL;
       } else if (strncasecmp(key,"estop_on_snd",29)==0) {
         strncpy(motion.estop_on_snd,value,49);
         return &motion.estop_on_snd;
@@ -335,6 +345,27 @@
       } else if (strncasecmp(key,"preload",29)==0) {
         sound.preload.push_back(value);
         return &sound.preload ;
+      } else if (strncasecmp(key,"streaming.mic_port",29)==0) {
+        sound.streaming.mic_port = atoi(value);
+        return &sound.streaming.mic_port;
+      } else if (strncasecmp(key,"streaming.mic_sample_rate",29)==0) {
+        sound.streaming.mic_sample_rate = atoi(value);
+        return &sound.streaming.mic_sample_rate;
+      } else if (strncasecmp(key,"streaming.mic_sample_bits",29)==0) {
+        sound.streaming.mic_sample_bits = atoi(value);
+        return &sound.streaming.mic_sample_bits;
+      } else if (strncasecmp(key,"streaming.mic_stereo",29)==0) {
+        sound.streaming.mic_stereo = extractBool(value);
+        return &sound.streaming.mic_stereo;
+      } else if (strncasecmp(key,"streaming.speaker_port",29)==0) {
+        sound.streaming.speaker_port = atoi(value);
+        return &sound.streaming.speaker_port;
+      } else if (strncasecmp(key,"streaming.speaker_frame_length",30)==0) {
+        sound.streaming.speaker_frame_length = atoi(value);
+        return &sound.streaming.speaker_frame_length;
+      } else if (strncasecmp(key,"streaming.speaker_max_delay",29)==0) {
+        sound.streaming.speaker_max_delay = atoi(value);
+        return &sound.streaming.speaker_max_delay;
       }
       break;
     default:
@@ -372,7 +403,7 @@
 	bool ignoring=false;
 	std::vector<std::string> curmodel;
 #ifdef PLATFORM_APERIOS
-	char rdStr[orobotdesignNAME_MAX];
+	char rdStr[orobotdesignNAME_MAX + 1];
 	memset(rdStr, 0, sizeof(rdStr));
 	if (OPENR::GetRobotDesign(rdStr) != oSUCCESS) {
 		printf("OPENR::GetRobotDesign() failed.\n");
@@ -499,9 +530,9 @@
  * @author alokl (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Shared/Config.h ./Shared/Config.h
--- ../Tekkotsu_2.2/Shared/Config.h	Mon Oct 11 18:01:34 2004
+++ ./Shared/Config.h	Fri Nov 12 17:07:39 2004
@@ -147,6 +147,7 @@
 		std::string walk;       //!< the walk parameter file to load by default for new WalkMC's
 		std::string kinematics;  //!< the kinematics description file to load
 		std::vector<std::string> kinematic_chains; //!< list of chains to load from #kinematics
+		float calibration[NumPIDJoints]; //!< multiplier from desired to command for PID joints
 		char estop_on_snd[50];  //!< sound file to use when e-stop turned on
 		char estop_off_snd[50]; //!< sound file to use when e-stop turned off
 		float max_head_tilt_speed; //!< max speed for the head joints, used by HeadPointerMC; rad/s
@@ -166,11 +167,13 @@
 		}
 
 		//!constructor
-		motion_config() : root(), walk(), kinematics(), kinematic_chains(), max_head_tilt_speed(0), max_head_pan_speed(0), max_head_roll_speed(0), console_port(0), stderr_port(0) {
+		motion_config()
+			: root(), walk(), kinematics(), kinematic_chains(), max_head_tilt_speed(0),
+				max_head_pan_speed(0), max_head_roll_speed(0), console_port(0), stderr_port(0)
+		{
 			estop_on_snd[0]=estop_off_snd[0]='\0';
-			max_head_tilt_speed=0;
-			max_head_pan_speed=0;
-			max_head_roll_speed=0;
+			for(unsigned int i=0; i<NumPIDJoints; i++)
+				calibration[i]=1;
 		}
 	} motion;
 
@@ -191,9 +194,26 @@
 			else
 				return root+"/"+name;
 		}
+		
+		//! audio streaming configuration
+		struct streaming_config {
+		  unsigned int mic_port;        //!< port for streaming microphone samples
+			unsigned int mic_sample_rate; //!< sample rate from the microphone
+			unsigned int mic_sample_bits; //!< sample bit depth from the microphone (either 8 or 16)
+			bool mic_stereo; //!< whether to stream stereo or mono from the microphone
+      
+			unsigned int speaker_port;    //!< port for streaming speaker samples
+			unsigned int speaker_frame_length; //<! length of frame sent to the speaker (ms)
+			unsigned int speaker_max_delay; //<! maximum delay (ms) during playback
+
+			streaming_config() : mic_port(0), mic_sample_rate(16000),
+			mic_sample_bits(16), mic_stereo(true),
+			speaker_port(0), speaker_frame_length(64),
+			speaker_max_delay(1000) {}
+		} streaming;
 
 		//!constructor
-		sound_config() : root(), volume(0xF600), sample_rate(0), sample_bits(0), preload() {}
+		sound_config() : root(), volume(0xF600), sample_rate(0), sample_bits(0), preload(), streaming() {}
 	} sound;
 
 	//! call this function when it's time to read the configuration file
@@ -220,10 +240,10 @@
  * @author alokl (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Shared/ERS210Info.h ./Shared/ERS210Info.h
--- ../Tekkotsu_2.2/Shared/ERS210Info.h	Thu Sep 16 14:35:12 2004
+++ ./Shared/ERS210Info.h	Thu Sep 16 14:35:12 2004
@@ -469,7 +469,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/ERS220Info.h ./Shared/ERS220Info.h
--- ../Tekkotsu_2.2/Shared/ERS220Info.h	Fri Sep 17 14:29:54 2004
+++ ./Shared/ERS220Info.h	Fri Sep 17 14:29:54 2004
@@ -573,7 +573,7 @@
  * @author Daishi MORI (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/ERS2xxInfo.h ./Shared/ERS2xxInfo.h
--- ../Tekkotsu_2.2/Shared/ERS2xxInfo.h	Tue Aug 31 15:48:41 2004
+++ ./Shared/ERS2xxInfo.h	Tue Aug 31 15:48:41 2004
@@ -610,7 +610,7 @@
  * @author Daishi MORI (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/ERS7Info.h ./Shared/ERS7Info.h
--- ../Tekkotsu_2.2/Shared/ERS7Info.h	Tue Oct 19 03:37:09 2004
+++ ./Shared/ERS7Info.h	Tue Oct 19 03:37:09 2004
@@ -517,7 +517,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/Factory.h ./Shared/Factory.h
--- ../Tekkotsu_2.2/Shared/Factory.h	Thu Oct 30 18:24:20 2003
+++ ./Shared/Factory.h	Thu Oct 30 18:24:20 2003
@@ -47,7 +47,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/ListMemBuf.h ./Shared/ListMemBuf.h
--- ../Tekkotsu_2.2/Shared/ListMemBuf.h	Thu Sep 25 11:31:53 2003
+++ ./Shared/ListMemBuf.h	Thu Sep 25 11:31:53 2003
@@ -334,7 +334,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/LoadSave.cc ./Shared/LoadSave.cc
--- ../Tekkotsu_2.2/Shared/LoadSave.cc	Thu Mar 25 12:07:44 2004
+++ ./Shared/LoadSave.cc	Thu Mar 25 12:07:44 2004
@@ -161,7 +161,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/LoadSave.h ./Shared/LoadSave.h
--- ../Tekkotsu_2.2/Shared/LoadSave.h	Thu Apr  8 12:28:06 2004
+++ ./Shared/LoadSave.h	Thu Apr  8 12:28:06 2004
@@ -349,7 +349,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/LockScope.h ./Shared/LockScope.h
--- ../Tekkotsu_2.2/Shared/LockScope.h	Thu Sep 25 11:31:53 2003
+++ ./Shared/LockScope.h	Thu Sep 25 11:31:53 2003
@@ -22,7 +22,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/MutexLock.h ./Shared/MutexLock.h
--- ../Tekkotsu_2.2/Shared/MutexLock.h	Thu Feb 12 12:48:59 2004
+++ ./Shared/MutexLock.h	Thu Feb 12 12:48:59 2004
@@ -260,7 +260,7 @@
  * @author ejt (Creator), Edward A. Lycklama, Vassos Hadzilacos (paper from which this was based)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/ProcessID.cc ./Shared/ProcessID.cc
--- ../Tekkotsu_2.2/Shared/ProcessID.cc	Thu Sep 25 11:31:53 2003
+++ ./Shared/ProcessID.cc	Thu Sep 25 11:31:53 2003
@@ -7,7 +7,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/ProcessID.h ./Shared/ProcessID.h
--- ../Tekkotsu_2.2/Shared/ProcessID.h	Thu Sep 25 11:31:53 2003
+++ ./Shared/ProcessID.h	Thu Sep 25 11:31:53 2003
@@ -27,7 +27,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/Profiler.cc ./Shared/Profiler.cc
--- ../Tekkotsu_2.2/Shared/Profiler.cc	Thu Mar 25 12:08:57 2004
+++ ./Shared/Profiler.cc	Thu Mar 25 12:08:57 2004
@@ -163,7 +163,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/Profiler.h ./Shared/Profiler.h
--- ../Tekkotsu_2.2/Shared/Profiler.h	Wed Feb  4 18:06:47 2004
+++ ./Shared/Profiler.h	Wed Feb  4 18:06:47 2004
@@ -204,7 +204,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/ProjectInterface.cc ./Shared/ProjectInterface.cc
--- ../Tekkotsu_2.2/Shared/ProjectInterface.cc	Fri Jul 16 15:25:09 2004
+++ ./Shared/ProjectInterface.cc	Fri Jul 16 15:25:09 2004
@@ -38,7 +38,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/ProjectInterface.h ./Shared/ProjectInterface.h
--- ../Tekkotsu_2.2/Shared/ProjectInterface.h	Fri Jul 16 15:25:10 2004
+++ ./Shared/ProjectInterface.h	Fri Jul 16 15:25:10 2004
@@ -74,7 +74,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/ReferenceCounter.h ./Shared/ReferenceCounter.h
--- ../Tekkotsu_2.2/Shared/ReferenceCounter.h	Mon Feb  9 17:45:28 2004
+++ ./Shared/ReferenceCounter.h	Thu Nov 11 15:35:00 2004
@@ -14,8 +14,8 @@
 	ReferenceCounter() : references(0),RC_autodelete(true) {}
 	//! copy constructor - uses autodelete setting of @a rc, but references will still start at 0
 	ReferenceCounter(const ReferenceCounter& rc) : references(0),RC_autodelete(rc.RC_autodelete) {}
-	//! assignment operator - does nothing
-	ReferenceCounter& operator=(const ReferenceCounter& rc) {return *this;}
+	//! assignment operator - does nothing because the reference count shouldn't be copied
+	ReferenceCounter& operator=(const ReferenceCounter& /*rc*/) {return *this;}
 
 	//! destructor - will std::cout a warning if still has references
 	virtual ~ReferenceCounter() {
@@ -73,10 +73,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Shared/RobotInfo.h ./Shared/RobotInfo.h
--- ../Tekkotsu_2.2/Shared/RobotInfo.h	Mon Feb  9 17:45:28 2004
+++ ./Shared/RobotInfo.h	Mon Feb  9 17:45:28 2004
@@ -41,7 +41,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/SharedObject.h ./Shared/SharedObject.h
--- ../Tekkotsu_2.2/Shared/SharedObject.h	Fri Sep 12 19:42:12 2003
+++ ./Shared/SharedObject.h	Fri Sep 12 19:42:12 2003
@@ -116,7 +116,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/SharedQueue.h ./Shared/SharedQueue.h
--- ../Tekkotsu_2.2/Shared/SharedQueue.h	Sun Jan 18 05:16:58 2004
+++ ./Shared/SharedQueue.h	Sun Jan 18 05:16:58 2004
@@ -134,7 +134,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/SystemUtility.h ./Shared/SystemUtility.h
--- ../Tekkotsu_2.2/Shared/SystemUtility.h	Fri Oct 10 13:46:04 2003
+++ ./Shared/SystemUtility.h	Fri Oct 10 13:46:04 2003
@@ -60,7 +60,7 @@
  * @verbinclude CMPack_license.txt
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/TimeET.cc ./Shared/TimeET.cc
--- ../Tekkotsu_2.2/Shared/TimeET.cc	Thu Sep 25 11:31:53 2003
+++ ./Shared/TimeET.cc	Thu Sep 25 11:31:53 2003
@@ -7,7 +7,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/TimeET.h ./Shared/TimeET.h
--- ../Tekkotsu_2.2/Shared/TimeET.h	Thu Mar 25 12:09:18 2004
+++ ./Shared/TimeET.h	Thu Mar 25 12:09:18 2004
@@ -148,7 +148,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/Util.h ./Shared/Util.h
--- ../Tekkotsu_2.2/Shared/Util.h	Thu Sep 25 11:31:53 2003
+++ ./Shared/Util.h	Thu Sep 25 11:31:53 2003
@@ -300,7 +300,7 @@
  * @endverbatim
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/WMclass.h ./Shared/WMclass.h
--- ../Tekkotsu_2.2/Shared/WMclass.h	Fri Oct 10 13:46:04 2003
+++ ./Shared/WMclass.h	Fri Oct 10 13:46:04 2003
@@ -14,7 +14,7 @@
  *  @author alokl (Ported)
  *  
  *  $Author: ejt $
- *  $Name: HEAD $
+ *  $Name: HEAD $
  *  $Revision: 1.1 $
  *  $State: Exp $
  *  $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/WorldState.cc ./Shared/WorldState.cc
--- ../Tekkotsu_2.2/Shared/WorldState.cc	Fri May  7 23:03:32 2004
+++ ./Shared/WorldState.cc	Thu Nov  4 14:45:17 2004
@@ -13,6 +13,7 @@
 #include "ERS210Info.h"
 #include "ERS220Info.h"
 #include "ERS7Info.h"
+#include "Shared/Config.h"
 
 #define GETD(cpc) (((float)sensor.GetData(cpc)->frame[lastFrame].value) / 1.0E6f) //!< returns value from OPEN-R, converted from micro in int to base in float
 #define GETB(cpc) ((bool)sensor.GetData(cpc)->frame[lastFrame].value) //!< returns value from OPEN-R, as bool
@@ -47,7 +48,7 @@
 
 #ifdef PLATFORM_APERIOS
 	//Thanks Daishi:
-	char robotDesignStr[orobotdesignNAME_MAX];
+	char robotDesignStr[orobotdesignNAME_MAX + 1];
 	memset(robotDesignStr, 0, sizeof(robotDesignStr));
 	if (OPENR::GetRobotDesign(robotDesignStr) != oSUCCESS) {
 		cout << "OPENR::GetRobotDesign() failed." << endl;
@@ -296,6 +297,10 @@
 		sensors[DAccelOffset] = GETD(ERS7Info::CPCSensorAccelUD);
 	}
 
+	//Apply sensor calibrations (currently only joint positions - perhaps IR as well?)
+	for(unsigned int i=0; i<NumPIDJoints; i++)
+		outputs[PIDJointOffset+i]/=config->motion.calibration[i];
+
 	unsigned int dif=curtime-lastSensorUpdateTime;
 	lastSensorUpdateTime=curtime;
 	for(unsigned int i=0; i<evtBuf.size(); i++)
@@ -404,8 +409,8 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
diff -urdN ../Tekkotsu_2.2/Shared/WorldState.h ./Shared/WorldState.h
--- ../Tekkotsu_2.2/Shared/WorldState.h	Tue Jul 27 10:36:50 2004
+++ ./Shared/WorldState.h	Tue Jul 27 10:36:50 2004
@@ -214,7 +214,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/debuget.h ./Shared/debuget.h
--- ../Tekkotsu_2.2/Shared/debuget.h	Thu Sep 25 11:31:53 2003
+++ ./Shared/debuget.h	Thu Sep 25 11:31:53 2003
@@ -73,7 +73,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/get_time.cc ./Shared/get_time.cc
--- ../Tekkotsu_2.2/Shared/get_time.cc	Fri Jul 25 16:18:07 2003
+++ ./Shared/get_time.cc	Fri Jul 25 16:18:07 2003
@@ -19,7 +19,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/get_time.h ./Shared/get_time.h
--- ../Tekkotsu_2.2/Shared/get_time.h	Fri Jul 25 16:18:08 2003
+++ ./Shared/get_time.h	Fri Jul 25 16:18:08 2003
@@ -9,7 +9,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/jpeg-6b/Makefile ./Shared/jpeg-6b/Makefile
--- ../Tekkotsu_2.2/Shared/jpeg-6b/Makefile	Mon Dec  1 14:44:09 2003
+++ ./Shared/jpeg-6b/Makefile	Tue Nov  9 16:26:13 2004
@@ -3,11 +3,14 @@
 # This makefile is suitable for Unix-like systems with non-ANSI compilers.
 # If you have an ANSI compiler, makefile.ansi is a better starting point.
 
-# Read installation instructions before saying "make" !!
-
-# The name of your C compiler:
-OPENRSDK_ROOT ?= /usr/local/OPEN_R_SDK
-CC= $(OPENRSDK_ROOT)/bin/mipsel-linux-gcc
+ifndef TEKKOTSU_ENVIRONMENT_CONFIGURATION
+$(error An error has occured, TEKKOTSU_ENVIRONMENT_CONFIGURATION was not defined)
+endif
+include $(TEKKOTSU_ENVIRONMENT_CONFIGURATION)
+FILTERSYSWARN:=$(patsubst $(TEKKOTSU_ROOT)/%,../../%,$(FILTERSYSWARN))
+COLORFILT:=$(patsubst $(TEKKOTSU_ROOT)/%,../../%,$(COLORFILT))
+BUILDDIR=$(patsubst $(TEKKOTSU_ROOT)/%,../../%,$(TK_BD)/Shared/jpeg-6b)
+SRCSUFFIX=.c
 
 # You may need to adjust these cc options:
 CFLAGS= -O3 -frename-registers -fomit-frame-pointer -ffast-math -fno-common
@@ -34,10 +37,6 @@
 RM= rm -f
 # file rename command
 MV= mv
-# library (.a) file creation command
-AR= $(OPENRSDK_ROOT)/bin/mipsel-linux-ar rc
-# second step in .a creation (use "touch" if not needed)
-AR2= $(OPENRSDK_ROOT)/bin/mipsel-linux-ranlib
 
 # End of configurable options.
 
@@ -93,7 +92,7 @@
         jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \
         jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o
 # These objectfiles are included in libjpeg.a
-LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) $(SONYSOURCES:.c=.o)
+LIBOBJECTS= $(addprefix $(BUILDDIR)/,$(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) $(SONYSOURCES:.c=.o))
 # object files for sample applications (excluding library files)
 COBJECTS= cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o \
         cdjpeg.o
@@ -102,22 +101,28 @@
 TROBJECTS= jpegtran.o rdswitch.o cdjpeg.o transupp.o
 
 
-all: libjpeg.a
+all: $(BUILDDIR)/libjpeg.a
+
+.PHONY: all clean
 
 # This rule [no longer] causes ansi2knr to be invoked.
-.c.o:
-#	./ansi2knr $*.c T$*.c
-	$(CC) $(CFLAGS) -c $*.c
-#	$(RM) T$*.c $*.o
-#	$(MV) T$*.o $*.o
+%.o:
+	@mkdir -p $(dir $@)
+	@src=$(patsubst %.o,%$(SRCSUFFIX),$(patsubst $(BUILDDIR)/%,%,$@)); \
+	echo "Compiling libjpeg::$$src... (Reduced warnings)"; \
+	$(CC) $(CFLAGS) -o $@ -c $$src > $*.log 2>&1; \
+	retval=$$?; \
+	cat $*.log | $(FILTERSYSWARN) | $(COLORFILT) | $(TEKKOTSU_LOGVIEW); \
+	test $$retval -eq 0;
 
 ansi2knr: ansi2knr.c
 	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
 
-libjpeg.a: $(LIBOBJECTS)
-	$(RM) libjpeg.a
-	$(AR) libjpeg.a  $(LIBOBJECTS)
-	$(AR2) libjpeg.a
+$(BUILDDIR)/libjpeg.a: $(LIBOBJECTS)
+	$(RM) $@
+	@echo "Linking $@..."
+	@$(AR) $@  $(LIBOBJECTS)
+	@$(AR2) $@
 
 cjpeg: ansi2knr $(COBJECTS) libjpeg.a
 	$(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) libjpeg.a $(LDLIBS)
@@ -160,72 +165,72 @@
 	cmp testorig.jpg testoutt.jpg
 
 
-jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
-jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
-jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jcmarker.o: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jcmaster.o: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
-jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jctrans.o: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
-jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
-jdcoefct.o: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
-jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
-jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jdmarker.o: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
-jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jdtrans.o: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jerror.o: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
-jfdctflt.o: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
-jfdctfst.o: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
-jfdctint.o: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
-jidctflt.o: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
-jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
-jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
-jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
-jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jutils.o: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
-jmemmgr.o: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
-jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
-jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
-jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
-jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
-jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
-cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
-djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
-jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
-rdjpgcom.o: rdjpgcom.c jinclude.h jconfig.h
-wrjpgcom.o: wrjpgcom.c jinclude.h jconfig.h
-cdjpeg.o: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
-rdcolmap.o: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
-rdswitch.o: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
-transupp.o: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
-rdppm.o: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
-wrppm.o: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
-rdgif.o: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
-wrgif.o: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
-rdtarga.o: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
-wrtarga.o: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
-rdbmp.o: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
-wrbmp.o: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
-rdrle.o: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
-wrrle.o: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+$(BUILDDIR)/jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+$(BUILDDIR)/jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jcmarker.o: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jcmaster.o: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+$(BUILDDIR)/jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jctrans.o: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+$(BUILDDIR)/jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+$(BUILDDIR)/jdcoefct.o: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+$(BUILDDIR)/jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+$(BUILDDIR)/jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jdmarker.o: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+$(BUILDDIR)/jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jdtrans.o: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jerror.o: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+$(BUILDDIR)/jfdctflt.o: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+$(BUILDDIR)/jfdctfst.o: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+$(BUILDDIR)/jfdctint.o: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+$(BUILDDIR)/jidctflt.o: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+$(BUILDDIR)/jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+$(BUILDDIR)/jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+$(BUILDDIR)/jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+$(BUILDDIR)/jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jutils.o: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+$(BUILDDIR)/jmemmgr.o: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+$(BUILDDIR)/jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+$(BUILDDIR)/jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+$(BUILDDIR)/jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+$(BUILDDIR)/jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+$(BUILDDIR)/jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+$(BUILDDIR)/cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h $(BUILDDIR)/jversion.h
+$(BUILDDIR)/djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h $(BUILDDIR)/jversion.h
+$(BUILDDIR)/jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h $(BUILDDIR)/transupp.h jversion.h
+$(BUILDDIR)/rdjpgcom.o: rdjpgcom.c jinclude.h jconfig.h
+$(BUILDDIR)/wrjpgcom.o: wrjpgcom.c jinclude.h jconfig.h
+$(BUILDDIR)/cdjpeg.o: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/rdcolmap.o: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/rdswitch.o: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/transupp.o: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h $(BUILDDIR)/transupp.h
+$(BUILDDIR)/rdppm.o: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/wrppm.o: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/rdgif.o: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/wrgif.o: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/rdtarga.o: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/wrtarga.o: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/rdbmp.o: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/wrbmp.o: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/rdrle.o: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+$(BUILDDIR)/wrrle.o: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
diff -urdN ../Tekkotsu_2.2/Shared/newmat/Makefile ./Shared/newmat/Makefile
--- ../Tekkotsu_2.2/Shared/newmat/Makefile	Tue Oct  5 00:41:02 2004
+++ ./Shared/newmat/Makefile	Tue Nov  9 16:26:13 2004
@@ -3,12 +3,14 @@
 # This makefile is suitable for Unix-like systems with non-ANSI compilers.
 # If you have an ANSI compiler, makefile.ansi is a better starting point.
 
-# Read installation instructions before saying "make" !!
-
-# The name of your C compiler:
-OPENRSDK_ROOT ?= /usr/local/OPEN_R_SDK
-TEKKOTSU_ROOT ?= /usr/local/Tekkotsu
-CXX= $(OPENRSDK_ROOT)/bin/mipsel-linux-gcc
+ifndef TEKKOTSU_ENVIRONMENT_CONFIGURATION
+$(error An error has occured, TEKKOTSU_ENVIRONMENT_CONFIGURATION was not defined)
+endif
+include $(TEKKOTSU_ENVIRONMENT_CONFIGURATION)
+FILTERSYSWARN:=$(patsubst $(TEKKOTSU_ROOT)/%,../../%,$(FILTERSYSWARN))
+COLORFILT:=$(patsubst $(TEKKOTSU_ROOT)/%,../../%,$(COLORFILT))
+BUILDDIR=$(patsubst $(TEKKOTSU_ROOT)/%,../../%,$(TK_BD)/Shared/newmat)
+SRCSUFFIX=.cpp
 
 # You may need to adjust these cc options:
 CXXFLAGS= -fno-inline \
@@ -31,17 +33,10 @@
 RM= rm -f
 # file rename command
 MV= mv
-# library (.a) file creation command
-AR= $(OPENRSDK_ROOT)/bin/mipsel-linux-ar rc
-# second step in .a creation (use "touch" if not needed)
-AR2= $(OPENRSDK_ROOT)/bin/mipsel-linux-ranlib
 
 # End of configurable options.
 
-COLORFILT=$(TEKKOTSU_ROOT)/tools/colorfilt
-FILTERSYSWARN=$(TEKKOTSU_ROOT)/tools/filtersyswarn/filtersyswarn $(OPENRSDK_ROOT)
-
-# source files: JPEG library proper
+# source files:
 LIBSOURCES= bandmat.cpp cholesky.cpp evalue.cpp fft.cpp hholder.cpp \
             jacobi.cpp myexcept.cpp newfft.cpp newmat1.cpp newmat2.cpp \
             newmat3.cpp newmat4.cpp newmat5.cpp newmat6.cpp newmat7.cpp \
@@ -54,71 +49,74 @@
 INCLUDES= boolean.h include.h newmatap.h newmatio.h newmatrc.h precisio.h \
           controlw.h myexcept.h newmat.h newmatnl.h newmatrm.h solution.h
 
-LIBOBJECTS= $(LIBSOURCES:.cpp=.o)
+LIBOBJECTS= $(addprefix $(BUILDDIR)/,$(LIBSOURCES:.cpp=.o))
 # newmat1.o newmat2.o newmat3.o newmat4.o newmat5.o newmat6.o newmat7.o newmat8.o newmat9.o newmatex.o bandmat.o submat.o myexcept.o cholesky.o evalue.o fft.o hholder.o jacobi.o newfft.o sort.o svd.o newmatrm.o newmatnl.o
 
-all: libnewmat.a
+all: $(BUILDDIR)/libnewmat.a
 
 .PHONY: all clean
 
-libnewmat.a: $(LIBOBJECTS)
+$(BUILDDIR)/libnewmat.a: $(LIBOBJECTS)
 	$(RM) $@
-	$(AR) $@  $(LIBOBJECTS)
-	$(AR2) $@
+	@echo "Linking $@..."
+	@$(AR) $@  $(LIBOBJECTS)
+	@$(AR2) $@
 
 clean:
 	$(RM) *.o *.a *.log core
 
 %.o:
-	@echo "Compiling NEWMAT::$<... (Reduced warnings)"; \
-	$(CXX) $(CXXFLAGS) -o $@ -c $< > $*.log 2>&1; \
+	@mkdir -p $(dir $@)
+	@src=$(patsubst %.o,%$(SRCSUFFIX),$(patsubst $(BUILDDIR)/%,%,$@)); \
+	echo "Compiling NEWMAT::$$src... (Reduced warnings)"; \
+	$(CXX) $(CXXFLAGS) -o $@ -c $$src > $*.log 2>&1; \
 	retval=$$?; \
-	cat $*.log | $(FILTERSYSWARN) | $(COLORFILT); \
-	test $$retval -eq 0; \
+	cat $*.log | $(FILTERSYSWARN) | $(COLORFILT) | $(TEKKOTSU_LOGVIEW); \
+	test $$retval -eq 0;
 
-newmat1.o:     	newmat1.cpp newmat.h include.h myexcept.h
+$(BUILDDIR)/newmat1.o:     	newmat1.cpp newmat.h include.h myexcept.h
 
-newmat2.o:     	newmat2.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
+$(BUILDDIR)/newmat2.o:     	newmat2.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
 
-newmat3.o:     	newmat3.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
+$(BUILDDIR)/newmat3.o:     	newmat3.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
 
-newmat4.o:     	newmat4.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
+$(BUILDDIR)/newmat4.o:     	newmat4.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
 
-newmat5.o:     	newmat5.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
+$(BUILDDIR)/newmat5.o:     	newmat5.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
 
-newmat6.o:     	newmat6.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
+$(BUILDDIR)/newmat6.o:     	newmat6.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
 
-newmat7.o:     	newmat7.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
+$(BUILDDIR)/newmat7.o:     	newmat7.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
 
-newmat8.o:     	newmat8.cpp include.h newmat.h newmatrc.h precisio.h myexcept.h controlw.h
+$(BUILDDIR)/newmat8.o:     	newmat8.cpp include.h newmat.h newmatrc.h precisio.h myexcept.h controlw.h
 
-newmat9.o:     	newmat9.cpp include.h newmat.h newmatio.h newmatrc.h myexcept.h controlw.h
+$(BUILDDIR)/newmat9.o:     	newmat9.cpp include.h newmat.h newmatio.h newmatrc.h myexcept.h controlw.h
 
 
-newmatex.o:    	newmatex.cpp include.h newmat.h myexcept.h
+$(BUILDDIR)/newmatex.o:    	newmatex.cpp include.h newmat.h myexcept.h
 
-bandmat.o:     	bandmat.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
+$(BUILDDIR)/vbandmat.o:     	bandmat.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
 
-submat.o:      	submat.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
+$(BUILDDIR)/submat.o:      	submat.cpp include.h newmat.h newmatrc.h myexcept.h controlw.h
 
-myexcept.o:    	myexcept.cpp include.h myexcept.h
+$(BUILDDIR)/myexcept.o:    	myexcept.cpp include.h myexcept.h
 
-cholesky.o:    	cholesky.cpp include.h newmat.h myexcept.h
+$(BUILDDIR)/cholesky.o:    	cholesky.cpp include.h newmat.h myexcept.h
 
-evalue.o:      	evalue.cpp include.h newmatap.h newmatrm.h precisio.h newmat.h myexcept.h
+$(BUILDDIR)/evalue.o:      	evalue.cpp include.h newmatap.h newmatrm.h precisio.h newmat.h myexcept.h
 
-fft.o:         	fft.cpp include.h newmatap.h newmat.h myexcept.h
+$(BUILDDIR)/fft.o:         	fft.cpp include.h newmatap.h newmat.h myexcept.h
 
-hholder.o:     	hholder.cpp include.h newmatap.h newmat.h myexcept.h
+$(BUILDDIR)/hholder.o:     	hholder.cpp include.h newmatap.h newmat.h myexcept.h
 
-jacobi.o:      	jacobi.cpp include.h newmatap.h precisio.h newmatrm.h newmat.h myexcept.h
+$(BUILDDIR)/jacobi.o:      	jacobi.cpp include.h newmatap.h precisio.h newmatrm.h newmat.h myexcept.h
 
-newfft.o:      	newfft.cpp newmatap.h newmat.h include.h myexcept.h
+$(BUILDDIR)/newfft.o:      	newfft.cpp newmatap.h newmat.h include.h myexcept.h
 
-sort.o:        	sort.cpp include.h newmatap.h newmat.h myexcept.h
+$(BUILDDIR)/sort.o:        	sort.cpp include.h newmatap.h newmat.h myexcept.h
 
-svd.o:         	svd.cpp include.h newmatap.h newmatrm.h precisio.h newmat.h myexcept.h
+$(BUILDDIR)/svd.o:         	svd.cpp include.h newmatap.h newmatrm.h precisio.h newmat.h myexcept.h
 
-newmatrm.o:    	newmatrm.cpp newmat.h newmatrm.h include.h myexcept.h
+$(BUILDDIR)/newmatrm.o:    	newmatrm.cpp newmat.h newmatrm.h include.h myexcept.h
 
-newmatnl.o:    	newmatnl.cpp newmatap.h newmatnl.h newmat.h include.h myexcept.h
+$(BUILDDIR)/newmatnl.o:    	newmatnl.cpp newmatap.h newmatnl.h newmat.h include.h myexcept.h
diff -urdN ../Tekkotsu_2.2/Shared/string_util.cc ./Shared/string_util.cc
--- ../Tekkotsu_2.2/Shared/string_util.cc	Wed Jan 14 15:45:28 2004
+++ ./Shared/string_util.cc	Wed Jan 14 15:45:28 2004
@@ -89,7 +89,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Shared/string_util.h ./Shared/string_util.h
--- ../Tekkotsu_2.2/Shared/string_util.h	Wed Jan 14 15:45:28 2004
+++ ./Shared/string_util.h	Wed Jan 14 15:45:28 2004
@@ -24,7 +24,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/SoundPlay/SoundManager.cc ./SoundPlay/SoundManager.cc
--- ../Tekkotsu_2.2/SoundPlay/SoundManager.cc	Thu Oct  7 20:07:25 2004
+++ ./SoundPlay/SoundManager.cc	Thu Nov  4 00:24:03 2004
@@ -17,8 +17,14 @@
 typedef LockScope<ProcessID::NumProcesses> AutoLock;
 
 SoundManager::SoundManager()
-	: sndlist(),playlist(),chanlist(),mix_mode(Fast),queue_mode(Override),max_chan(4),lock()
-{}
+	: mixerBuffer(0), mixerBufferSize(0),
+		sndlist(),playlist(),chanlist(),mix_mode(Fast),queue_mode(Override),max_chan(4),lock()
+{
+}
+
+SoundManager::~SoundManager() {
+	delete[] mixerBuffer;
+}
 
 void
 SoundManager::InitAccess(OSubject* subj) {
@@ -29,6 +35,10 @@
 SoundManager::Snd_ID
 SoundManager::LoadFile(std::string const &name) {
 	AutoLock autolock(lock,ProcessID::getID());
+	if (name.size() == 0) {
+	  cout << "SoundManager::LoadFile() null filename" << endl;
+	  return invalid_Snd_ID;
+	};
 	std::string path(config->sound.makePath(name));
 	Snd_ID id=lookupPath(path);
 	if(id!=invalid_Snd_ID) {
@@ -38,7 +48,7 @@
 		//		cout << "load new file" << endl;
 		struct stat buf;
 		if(stat(path.c_str(),&buf)==-1) {
-			cout << "SoundManager::LoadFile(): Sound file not found " << name << endl;
+			cout << "SoundManager::LoadFile(): Sound file not found: " << path << endl;
 			return invalid_Snd_ID;
 		}
 		byte * sndbuf=new byte[buf.st_size];
@@ -47,7 +57,8 @@
 		WAV wav;
 		WAVError error = wav.Set(sndbuf);
 		if (error != WAV_SUCCESS) {
-			OSYSLOG1((osyslogERROR, "%s : %s %d","SoundManager::LoadFile()","wav.Set() FAILED", error));
+			OSYSLOG1((osyslogERROR, "%s : %s %d: '%s'","SoundManager::LoadFile()","wav.Set() FAILED",
+				  error, path.c_str()));
 			return invalid_Snd_ID;
 		}
 		if(wav.GetSamplingRate()!=config->sound.sample_rate || wav.GetBitsPerSample()!=config->sound.sample_bits) {
@@ -316,188 +327,175 @@
 	return t/bytesPerMS;
 }
 
+void
+SoundManager::MixChannel(Play_ID channelId, void* buf, size_t destSize) {
+	char *dest = (char*) buf;
+	
+	PlayState& channel = playlist[channelId];
+	while (destSize > 0) {
+		const SoundData& buffer = sndlist[channel.snd_id];
+		const char* samples = ((char*) (buffer.data)) + channel.offset;
+		const unsigned int samplesSize = buffer.len - channel.offset;
+		if (samplesSize > destSize) {
+			memcpy(dest, samples, destSize);
+			channel.offset += destSize;
+			dest += destSize;
+			destSize = 0;
+			return;
+		} else {
+			memcpy(dest, samples, samplesSize);
+			channel.offset += samplesSize;
+			dest += samplesSize;
+			destSize -= samplesSize;
+			if (endPlay(channelId)) {
+				break;
+			}
+		}
+	}
+	if (destSize > 0) {
+		memset(dest, 0, destSize);
+	}
+}
+
+void
+SoundManager::MixChannelAdditively(Play_ID channelId, int bitsPerSample, MixMode_t mode,
+                                   short scalingFactor, void* buf, size_t destSize)
+{
+	PlayState& channel = playlist[channelId];
+	while (destSize > 0) {
+		const SoundData& buffer = sndlist[channel.snd_id];
+		const unsigned int samplesSize = buffer.len - channel.offset;
+		const unsigned int mixedSamplesSize =
+			((mode == Fast)
+				? ((samplesSize > destSize) ? destSize : samplesSize)
+				: ((samplesSize > destSize / 2) ? destSize / 2 : samplesSize)); 
+		
+		if (bitsPerSample == 8) {
+			//  8-bit mode
+			const char* samples = (char*) (buffer.data + channel.offset);
+			if (mode == Fast) {
+				// 8-bit mixing
+				char *dest = (char*) buf;
+				for (size_t i = 0; i < mixedSamplesSize; i++) {
+					*dest += samples[i] / scalingFactor;
+					dest++;
+				}
+				destSize -= (char*) dest - (char*) buf;
+				buf = dest;
+			} else {
+				// 16-bit mixing
+				short* dest = (short*) buf;
+				for (size_t i = 0; i < mixedSamplesSize; i++) {
+					*dest += samples[i];
+					*dest++;
+				}
+				destSize -= (char*) dest - (char*) buf;
+				buf = dest;
+			}
+		} else {
+			// 16-bit mode
+			const short* samples = (short*) (buffer.data + channel.offset);
+			if (mode == Fast) {
+				// 16-bit mixing
+				short* dest = (short*) buf;
+				for (size_t i = 0; i < mixedSamplesSize / 2; i++) {
+					*dest += samples[i] / scalingFactor;
+					*dest++;
+				}
+				destSize -= (char*) dest - (char*) buf;
+				buf = dest;
+			} else {
+				// 32-bit mixing
+				int* dest = (int*) buf;
+				for (size_t i = 0; i < mixedSamplesSize / 2; i++) {
+					*dest += samples[i];
+					*dest++;
+				}
+				destSize -= (char*) dest - (char*) buf;
+				buf = dest;
+			}
+		}
+		channel.offset += mixedSamplesSize;
+		if (destSize == 0) {
+			return;
+		} else {
+			if (endPlay(channelId)) {
+				return;
+			}
+		}
+	}
+}
+
 unsigned int
 SoundManager::CopyTo(OSoundVectorData* data) {
 	AutoLock autolock(lock,ProcessID::getID());
 
-	size_t avail  = data->GetInfo(0)->dataSize;	
-	byte*  dest   = data->GetData(0);
-	byte*  end    = dest+avail;
+	size_t destSize = data->GetInfo(0)->dataSize;	
+	void* dest = data->GetData(0);
 	
-	if(chanlist.size()==0) {
-		memset(dest,0,avail);
+	if(chanlist.size() == 0) {
+		memset(dest, 0, destSize);
 		return 0;
 	}
 
-	std::vector<Play_ID> mixs;
-	selectChannels(mixs);
-
-	std::vector<byte*> srcs;
-	std::vector<byte*> ends;
-	for(std::vector<Play_ID>::iterator it=mixs.begin(); it!=mixs.end(); it++) {
-		Snd_ID cursnd=playlist[*it].snd_id;
-		srcs.push_back(sndlist[cursnd].data+playlist[*it].offset);
-		ends.push_back(sndlist[cursnd].data+sndlist[cursnd].len);
-	}
+	std::vector<Play_ID> channels;
+	selectChannels(channels);
 
-	if(mixs.size()==0) { // nothing right now, but one's coming
-		memset(dest,0,avail);
-		return 1;
-	} else if(mixs.size()==1) { // only 1, just copy it directly (most common case)
-		size_t remain=ends.front()-srcs.front();
-		if(remain>=avail) { //just copy a buffer's worth
-			memcpy(dest,srcs.front(),avail);
-			playlist[mixs.front()].offset+=avail;
-			updateChannels(mixs,avail);
-			return 1;
-		} else { //copy what remains, 0 the rest
-			memcpy(dest,srcs.front(),remain);
-			memset(dest+remain,0,avail-remain);
-			playlist[mixs.front()].offset=sndlist[playlist[mixs.front()].snd_id].len;
-			endPlay(mixs.front());
-			return 0;
-		}
-	} else { // do a mix
-		if(mix_mode==Fast) { //essentially the same as quality mode below, but rounds off low order bits early
-			byte* begin=dest;
-			unsigned int stopped=0;
-			if(config->sound.sample_bits==8) { // have to mix, 8 bit
-				char size=srcs.size();
-				//just the first one, set dest
-				for(unsigned int c=0; c<1; c++) {
-					if((size_t)(ends[c]-srcs[c])>avail) {
-						for(dest=begin;dest<end;dest++) {
-							*dest=(*(char*)srcs[c])/size;
-							srcs[c]++;
-						}
-					} else {
-						for(dest=begin;srcs[c]<ends[c];srcs[c]++) {
-							*dest=(*(char*)srcs[c])/size;
-							dest++;
-						}
-						playlist[mixs[c]].offset=sndlist[playlist[mixs[c]].snd_id].len;
-						endPlay(mixs[c]);
-						stopped++;
-						memset(dest,0,end-dest); //zero out the rest
-					}							
-				}
-				//the rest, add to dest
-				for(unsigned int c=1; c<srcs.size(); c++) {
-					if((size_t)(ends[c]-srcs[c])>avail) {
-						for(dest=begin;dest<end;dest++) {
-							*dest+=(*(char*)srcs[c])/size;
-							srcs[c]++;
-						}
-					} else {
-						for(dest=begin;srcs[c]<ends[c];srcs[c]++) {
-							*dest+=(*(char*)srcs[c])/size;
-							dest++;
-						}
-						playlist[mixs[c]].offset=sndlist[playlist[mixs[c]].snd_id].len;
-						endPlay(mixs[c]);
-						stopped++;
-					}							
-				}
-			} else { // have to mix,  16 bit
-				short size=srcs.size();
-				//just the first one, set dest
-				for(unsigned int c=0; c<1; c++) {
-					if((size_t)(ends[c]-srcs[c])>avail) {
-						for(dest=begin;dest<end;dest+=2) {
-							*(short*)dest=(*(short*)srcs[c])/size;
-							srcs[c]+=2;
-						}
-					} else {
-						for(dest=begin;srcs[c]<ends[c];srcs[c]+=2) {
-							*(short*)dest=(*(short*)srcs[c])/size;
-							dest+=2;
-						}
-						playlist[mixs[c]].offset=sndlist[playlist[mixs[c]].snd_id].len;
-						endPlay(mixs[c]);
-						stopped++;
-						memset(dest,0,end-dest); //zero out the rest
-					}
-				}
-				//the rest, add to dest
-				for(unsigned int c=1; c<srcs.size(); c++) {
-					if((size_t)(ends[c]-srcs[c])>avail) {
-						for(dest=begin;dest<end;dest+=2) {
-							*(short*)dest+=(*(short*)srcs[c])/size;
-							srcs[c]+=2;
-						}
-					} else {
-						for(dest=begin;srcs[c]<ends[c];srcs[c]+=2) {
-							*(short*)dest+=(*(short*)srcs[c])/size;
-							dest+=2;
-						}
-						playlist[mixs[c]].offset=sndlist[playlist[mixs[c]].snd_id].len;
-						endPlay(mixs[c]);
-						stopped++;
-					}
-				}
+	if (channels.size() == 0) {
+		// No channels to mix
+		memset(dest, 0, destSize); 
+	} else if (channels.size() == 1) {
+		// One channel to mix
+		MixChannel(channels.front(), dest, destSize);
+	} else {
+		// Several channels to mix	
+		const MixMode_t mode = mix_mode;
+		const int bitsPerSample = config->sound.sample_bits;
+		if (mode == Quality) {
+			// Quality mixing uses an intermediate buffer
+			if ((mixerBuffer == 0) || (mixerBufferSize < destSize * 2)) {
+				delete[] mixerBuffer;
+				mixerBuffer = 0;
+				mixerBufferSize = destSize * 2;
+				mixerBuffer = new int[(mixerBufferSize / 4) + 1]; // makes sure it's int-aligned
 			}
-			for(unsigned int c=0; c<mixs.size(); c++)
-				playlist[mixs[c]].offset+=avail;
-			updateChannels(mixs,avail);
-			return mixs.size()-stopped;
-		} else { //mix_mode==quality
-			if(config->sound.sample_bits==8) { // have to mix, 8 bit
-				for(;dest!=end;dest++) {
-					short total=0;
-					for(unsigned int c=0; c<srcs.size(); c++) {
-						if(srcs[c]==ends[c]) {
-							playlist[mixs[c]].offset=sndlist[playlist[mixs[c]].snd_id].len;
-							if(endPlay(mixs[c])) {
-								std::swap(mixs[c],mixs.back());
-								std::swap(srcs[c],srcs.back());
-								std::swap(ends[c],ends.back());
-								mixs.pop_back();
-								srcs.pop_back();
-								ends.pop_back();
-								if(srcs.size()==0) {
-									memset(dest,0,end-dest);
-									return 0;
-								}
-								continue;
-							}
-						}
-						total+=*(char*)srcs[c];
-						srcs[c]++;
-					}
-					*dest=total/(int)srcs.size();
-				}
-			} else { // have to mix,  16 bit
-				for(;dest!=end;dest+=2) {
-					int total=0;
-					for(unsigned int c=0; c<srcs.size(); c++) {
-						if(srcs[c]==ends[c]) {
-							playlist[mixs[c]].offset=sndlist[playlist[mixs[c]].snd_id].len;
-							if(endPlay(mixs[c])) {
-								std::swap(mixs[c],mixs.back());
-								std::swap(srcs[c],srcs.back());
-								std::swap(ends[c],ends.back());
-								mixs.pop_back();
-								srcs.pop_back();
-								ends.pop_back();
-								if(srcs.size()==0) {
-									memset(dest,0,end-dest);
-									return 0;
-								}
-								continue;
-							}
-						}
-						total+=*(short*)srcs[c];
-						srcs[c]+=2;
-					}
-					*(short*)dest=total/(int)srcs.size();
+			memset(mixerBuffer, 0,  mixerBufferSize);
+			dest = mixerBuffer;
+			destSize *= 2;
+		} else {
+			// Fast mixing does not use the intermeridate buffer
+			memset(dest, 0, destSize);
+		}
+		
+		const int channelCount = channels.size();
+		const short scalingFactor = (short) ((mode == Fast) ? channelCount : 1);  
+		for(std::vector<Play_ID>::iterator i = channels.begin(); i != channels.end(); i++)
+			MixChannelAdditively(*i, bitsPerSample, mode, scalingFactor, dest, destSize);
+		
+		if (mode == Quality) {
+			// Quality mixing uses an intermediate buffer
+			// Scale the buffer
+			destSize /= 2;
+			if (bitsPerSample == 8) {
+				//  8-bit mode
+				char* destChar = (char*) data->GetData(0);
+				short* mixerBufferShort = (short*) mixerBuffer;
+				for (size_t i = 0; i < destSize; i++) {
+					destChar[i] = (char) (mixerBufferShort[i] / channelCount);
+				} 
+			} else {
+				// 16-bit mode
+				short* destShort = (short*) data->GetData(0);
+				const size_t destSampleCount = destSize / 2; 
+				for (size_t i = 0; i < destSampleCount; i++) {
+					destShort[i] = (short) (mixerBuffer[i] / channelCount);
 				}
 			}
-			for(unsigned int c=0; c<mixs.size(); c++)
-				playlist[mixs[c]].offset+=avail;
-			updateChannels(mixs,avail);
-			return mixs.size();
-		} // endif mix_mode==quality
-	} // endif do a mix
+		}
+	}
+	
+	updateChannels(channels, data->GetInfo(0)->dataSize);
+	return channels.size(); 
 }
 
 void
@@ -612,14 +610,26 @@
 				break;
 		}
 		for(;it!=chanlist.end(); it=chanlist.next(it)) {
-			Snd_ID cursnd=playlist[chanlist[it]].snd_id;
-			if(sndlist[cursnd].data!=NULL) {
-				size_t remain = sndlist[cursnd].len-playlist[chanlist[it]].offset;
-				if(remain<used) {
-					playlist[chanlist[it]].offset=sndlist[playlist[chanlist[it]].snd_id].len;
-					endPlay(chanlist[it]);
+			const Play_ID channelId = chanlist[it];
+			PlayState &channel = playlist[channelId];
+			size_t skip = used;
+			while (skip > 0) {
+				SoundData &buffer = sndlist[channel.snd_id];
+				// FIXME: Don't know why the buffer.data != 0 check is done 
+				if (buffer.data != 0) {
+					size_t remain = buffer.len - channel.offset;
+					if (remain < skip) {
+						channel.offset = buffer.len;
+						skip -= buffer.len;
+						if (endPlay(channelId)) {
+							break;
+						}
+					} else {
+						channel.offset += skip;
+						skip = 0;
+					}
 				} else {
-					playlist[chanlist[it]].offset+=used;
+					break;
 				}
 			}
 		}
@@ -665,11 +675,11 @@
  * @brief Implements SoundManager, which provides sound effects and caching services, as well as mixing buffers for the SoundPlay process
  * @author ejt (Creator)
  *
- * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 
diff -urdN ../Tekkotsu_2.2/SoundPlay/SoundManager.h ./SoundPlay/SoundManager.h
--- ../Tekkotsu_2.2/SoundPlay/SoundManager.h	Thu Oct  7 20:07:25 2004
+++ ./SoundPlay/SoundManager.h	Thu Nov  4 00:24:03 2004
@@ -52,6 +52,7 @@
 public:
 	//!constructor
 	SoundManager();
+	virtual ~SoundManager();
 
 	//!This is used for referring to sound data so you can start playing it or release it
 	typedef SoundManagerMsg::Snd_ID Snd_ID;
@@ -68,8 +69,9 @@
 	//!Used to set the mode for mixing multiple sound channels
 	/*!Feel free to add a higher quality mixer if you're an audiophile - I'm pretty new to sound processing*/
 	enum MixMode_t {
-		Fast,    //!< uses bit shifting trick, but can result in reduced volume with more active channels, best if you set max_channels to a power of 2
-		Quality  //!< uses real division to maintain volume level, although still a rather naive (but relatively fast) algorithm
+		// there's some prototype code for a bit-shifting 'Faster' quality level, but it hasn't been finished... 'Fast' is the default for now.
+		Fast,    //!< uses real division to maintain volume level, without increasing intermediary precision, which causes low-order bit error in exchange for less CPU usage
+		Quality  //!< uses real division to maintain volume level, using an intermediary higher precision buffer for mixing
 	};
 
 	enum QueueMode_t {
@@ -170,6 +172,20 @@
 	unsigned int GetNumPlaying() { return chanlist.size(); }
 	
 protected:
+	//!Mixes the channel into the buffer
+	void MixChannel(Play_ID channelId, void* buf, size_t size);
+	
+	//!Mixes the channel into the buffer additively
+	/*!If mode is Quality, then the size of the buffer should be double the normal
+	* size. */
+	void MixChannelAdditively(Play_ID channelId, int bitsPerSample, MixMode_t mode, short scalingFactor, void* buf, size_t size);
+	
+	//!The intermediate mixer buffer used for Quality mode mixing
+	int* mixerBuffer;
+	
+	//!Size (in bytes) of the intermediate mixer buffer
+	size_t mixerBufferSize;
+
 	//!Sets up a shared region to hold a sound - rounds to nearest page size
 	static RCRegion* initRegion(unsigned int size);
 
@@ -245,11 +261,11 @@
  * @brief Describes SoundManager, which provides sound effects and caching services, as well as mixing buffers for the SoundPlay process
  * @author ejt (Creator)
  *
- * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Author: ejt $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/SoundPlay/SoundManagerMsg.h ./SoundPlay/SoundManagerMsg.h
--- ../Tekkotsu_2.2/SoundPlay/SoundManagerMsg.h	Thu Sep 25 11:32:08 2003
+++ ./SoundPlay/SoundManagerMsg.h	Thu Sep 25 11:32:08 2003
@@ -59,7 +59,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/SoundPlay/SoundPlay.cc ./SoundPlay/SoundPlay.cc
--- ../Tekkotsu_2.2/SoundPlay/SoundPlay.cc	Fri Jan 16 18:55:32 2004
+++ ./SoundPlay/SoundPlay.cc	Fri Jan 16 18:55:32 2004
@@ -269,7 +269,7 @@
  * implied warranties of fitness for a particular purpose.
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/SoundPlay/SoundPlay.h ./SoundPlay/SoundPlay.h
--- ../Tekkotsu_2.2/SoundPlay/SoundPlay.h	Tue Dec 23 01:33:44 2003
+++ ./SoundPlay/SoundPlay.h	Tue Dec 23 01:33:44 2003
@@ -84,7 +84,7 @@
  * implied warranties of fitness for a particular purpose.
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/SoundPlay/WAV.cc ./SoundPlay/WAV.cc
--- ../Tekkotsu_2.2/SoundPlay/WAV.cc	Fri Jul 25 16:18:08 2003
+++ ./SoundPlay/WAV.cc	Fri Jul 25 16:18:08 2003
@@ -15,7 +15,7 @@
  * implied warranties of fitness for a particular purpose.
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/SoundPlay/WAV.h ./SoundPlay/WAV.h
--- ../Tekkotsu_2.2/SoundPlay/WAV.h	Fri Jul 25 16:18:08 2003
+++ ./SoundPlay/WAV.h	Fri Jul 25 16:18:08 2003
@@ -15,7 +15,7 @@
  * implied warranties of fitness for a particular purpose.
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/TinyFTPD/FtpMethod.cc ./TinyFTPD/FtpMethod.cc
--- ../Tekkotsu_2.2/TinyFTPD/FtpMethod.cc	Mon Jul 12 15:58:59 2004
+++ ./TinyFTPD/FtpMethod.cc	Tue Nov 16 18:52:10 2004
@@ -87,7 +87,7 @@
 
     if (!strncmp(file, ftpHome, strlen(ftpHome))) {
         if((fp = fopen(file, "wb")) == NULL) {
-            OSYSLOG1((osyslogERROR, "Ftpd::File Open Failed %s.", file));
+            OSYSLOG1((osyslogERROR, "Ftpd::File Open Failed %s. errno=%d", file,errno));
             return false;
         }
     } else {
diff -urdN ../Tekkotsu_2.2/Vision/BallDetectionGenerator.cc ./Vision/BallDetectionGenerator.cc
--- ../Tekkotsu_2.2/Vision/BallDetectionGenerator.cc	Sun Jan 18 05:16:58 2004
+++ ./Vision/BallDetectionGenerator.cc	Tue Nov  9 15:01:49 2004
@@ -18,8 +18,8 @@
 void
 BallDetectionGenerator::processEvent(const EventBase& e) {
 	PROFSECTION("BallDetection::processEvent()",state->mainProfile);
-
-	if(!erouter->hasListeners(getGeneratorID(),getSourceID()))
+	EventGeneratorBase::processEvent(e);
+	if(e.getGeneratorID()!=getListenGeneratorID() || e.getSourceID()!=getListenSourceID())
 		return;
 
 	const SegmentedColorFilterBankEvent * segev=dynamic_cast<const SegmentedColorFilterBankEvent*>(&e);
@@ -276,8 +276,8 @@
  * reviewed the code, so I guess it's all ours...
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
diff -urdN ../Tekkotsu_2.2/Vision/BallDetectionGenerator.h ./Vision/BallDetectionGenerator.h
--- ../Tekkotsu_2.2/Vision/BallDetectionGenerator.h	Mon Feb  9 17:45:28 2004
+++ ./Vision/BallDetectionGenerator.h	Mon Feb  9 17:45:28 2004
@@ -89,7 +89,7 @@
  * reviewed the code, so I guess it's all ours...
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Vision/CDTGenerator.cc ./Vision/CDTGenerator.cc
--- ../Tekkotsu_2.2/Vision/CDTGenerator.cc	Wed Feb 18 16:13:32 2004
+++ ./Vision/CDTGenerator.cc	Tue Nov  9 15:01:49 2004
@@ -23,6 +23,10 @@
  */
 void
 CDTGenerator::processEvent(const EventBase& event) {
+	EventGeneratorBase::processEvent(event);
+	if(event.getGeneratorID()!=getListenGeneratorID() || event.getSourceID()!=getListenSourceID())
+		return;
+
 	typedef DataEvent<const OFbkImageVectorData*> OFbkEvent;
 	const OFbkEvent& fbkevent=dynamic_cast<const OFbkEvent& >(event);
 	OFbkImageVectorData& fbkdat=*const_cast<OFbkImageVectorData*>(fbkevent.getData());
@@ -233,9 +237,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Vision/CDTGenerator.h ./Vision/CDTGenerator.h
--- ../Tekkotsu_2.2/Vision/CDTGenerator.h	Wed Feb 18 16:13:32 2004
+++ ./Vision/CDTGenerator.h	Wed Feb 18 16:13:32 2004
@@ -97,7 +97,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Vision/FilterBankGenerator.cc ./Vision/FilterBankGenerator.cc
--- ../Tekkotsu_2.2/Vision/FilterBankGenerator.cc	Wed Feb 18 16:13:32 2004
+++ ./Vision/FilterBankGenerator.cc	Tue Nov  9 15:01:49 2004
@@ -2,6 +2,8 @@
 #include "Events/FilterBankEvent.h"
 #include "Events/EventRouter.h"
 
+using namespace std;
+
 unsigned char *
 FilterBankGenerator::getImage(unsigned int layer, unsigned int channel) const {
 	//for(int i=0;i<1000;i++)
@@ -33,16 +35,20 @@
 
 void
 FilterBankGenerator::processEvent(const EventBase & event) {
-	const FilterBankEvent& fbkevent=dynamic_cast<const FilterBankEvent& >(event);
-	src=fbkevent.getSource();
-	frameNumber=src->getFrameNumber();
-	setNumImages(src->getNumLayers(),src->getNumChannels());
-	if(numLayers>0 && (src->getWidth(numLayers-1)!=getWidth(numLayers-1) || src->getHeight(numLayers-1)!=getHeight(numLayers-1))) {
-		ASSERT(widths[numLayers-1]==0,"Strange, the image dim changed after initial setting" << widths[numLayers-1] << ' ' << heights[numLayers-1]);
-		setDimensions();
+	if(event.getGeneratorID()==getListenGeneratorID() && event.getSourceID()==getListenSourceID()) {
+		const FilterBankEvent& fbkevent=dynamic_cast<const FilterBankEvent& >(event);
+		src=fbkevent.getSource();
+		frameNumber=src->getFrameNumber();
+		setNumImages(src->getNumLayers(),src->getNumChannels());
+		if(numLayers>0 && (src->getWidth(numLayers-1)!=getWidth(numLayers-1) || src->getHeight(numLayers-1)!=getHeight(numLayers-1))) {
+			ASSERT(widths[numLayers-1]==0,"Strange, the image dim changed after initial setting" << widths[numLayers-1] << ' ' << heights[numLayers-1]);
+			setDimensions();
+		}
+		invalidateCaches();
+		framesProcessed++;
+	} else {
+		EventGeneratorBase::processEvent(event);
 	}
-	invalidateCaches();
-	framesProcessed++;
 }
 
 unsigned int FilterBankGenerator::getBinSize() const {
@@ -158,9 +164,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Vision/FilterBankGenerator.h ./Vision/FilterBankGenerator.h
--- ../Tekkotsu_2.2/Vision/FilterBankGenerator.h	Wed Feb 18 16:13:32 2004
+++ ./Vision/FilterBankGenerator.h	Wed Nov 10 20:45:37 2004
@@ -112,11 +112,6 @@
 class FilterBankGenerator : public EventGeneratorBase, public LoadSave {
 public:
 	//! constructor
-	FilterBankGenerator()
-		: EventGeneratorBase(), src(NULL), numLayers(0), numChannels(0), widths(NULL), heights(NULL), skips(NULL), strides(NULL), increments(NULL), images(NULL), imageValids(NULL), selectedSaveLayer(0), selectedSaveChannel(0), frameNumber(0), framesProcessed(0)
-	{	}
-
-	//! constructor
 	FilterBankGenerator(const std::string& name,EventBase::EventGeneratorID_t srcgid, unsigned int srcsid, EventBase::EventGeneratorID_t mgid, unsigned int msid)
 		: EventGeneratorBase(name,mgid,msid,srcgid,srcsid), src(NULL), numLayers(0), numChannels(0), widths(NULL), heights(NULL), skips(NULL), strides(NULL), increments(NULL), images(NULL), imageValids(NULL), selectedSaveLayer(0), selectedSaveChannel(0), frameNumber(0), framesProcessed(0)
 	{ }
@@ -285,10 +280,10 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/Vision/InterleavedYUVGenerator.cc ./Vision/InterleavedYUVGenerator.cc
--- ../Tekkotsu_2.2/Vision/InterleavedYUVGenerator.cc	Wed Feb 18 16:13:32 2004
+++ ./Vision/InterleavedYUVGenerator.cc	Tue Nov  9 15:01:49 2004
@@ -17,7 +17,8 @@
 void
 InterleavedYUVGenerator::processEvent(const EventBase& event) {
 	FilterBankGenerator::processEvent(event);
-	erouter->postEvent(new FilterBankEvent(this,getGeneratorID(),getSourceID()));
+	if(event.getGeneratorID()==getListenGeneratorID() && event.getSourceID()==getListenSourceID())
+		erouter->postEvent(new FilterBankEvent(this,getGeneratorID(),getSourceID()));
 }
 
 unsigned int
@@ -127,9 +128,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Vision/InterleavedYUVGenerator.h ./Vision/InterleavedYUVGenerator.h
--- ../Tekkotsu_2.2/Vision/InterleavedYUVGenerator.h	Wed Feb 18 16:13:32 2004
+++ ./Vision/InterleavedYUVGenerator.h	Wed Feb 18 16:13:32 2004
@@ -78,7 +78,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Vision/JPEGGenerator.cc ./Vision/JPEGGenerator.cc
--- ../Tekkotsu_2.2/Vision/JPEGGenerator.cc	Wed Feb 18 16:13:32 2004
+++ ./Vision/JPEGGenerator.cc	Tue Nov  9 15:01:49 2004
@@ -47,13 +47,15 @@
 void
 JPEGGenerator::processEvent(const EventBase& event) {
 	FilterBankGenerator::processEvent(event);
-	if(getSourceMode()==SRC_AUTO) { //if not auto, curMode was already set when srcMode was set
-		if(dynamic_cast<const InterleavedYUVGenerator*>(src)!=NULL)
-			curMode=SRC_COLOR;
-		else
-			curMode=SRC_GRAYSCALE;
+	if(event.getGeneratorID()==getListenGeneratorID() && event.getSourceID()==getListenSourceID()) {
+		if(getSourceMode()==SRC_AUTO) { //if not auto, curMode was already set when srcMode was set
+			if(dynamic_cast<const InterleavedYUVGenerator*>(src)!=NULL)
+				curMode=SRC_COLOR;
+			else
+				curMode=SRC_GRAYSCALE;
+		}
+		erouter->postEvent(new FilterBankEvent(this,getGeneratorID(),getSourceID()));
 	}
-	erouter->postEvent(new FilterBankEvent(this,getGeneratorID(),getSourceID()));
 }
 
 unsigned int
@@ -239,9 +241,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Vision/JPEGGenerator.h ./Vision/JPEGGenerator.h
--- ../Tekkotsu_2.2/Vision/JPEGGenerator.h	Wed Feb 18 16:13:32 2004
+++ ./Vision/JPEGGenerator.h	Wed Feb 18 16:13:32 2004
@@ -107,7 +107,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Vision/RLEGenerator.cc ./Vision/RLEGenerator.cc
--- ../Tekkotsu_2.2/Vision/RLEGenerator.cc	Wed Feb 18 16:13:32 2004
+++ ./Vision/RLEGenerator.cc	Tue Nov  9 15:01:49 2004
@@ -13,10 +13,12 @@
 void
 RLEGenerator::processEvent(const EventBase& event) {
 	FilterBankGenerator::processEvent(event);
-	if(const SegmentedColorFilterBankEvent * segsrc=dynamic_cast<const SegmentedColorFilterBankEvent *>(&event))
-		erouter->postEvent(new SegmentedColorFilterBankEvent(this,getGeneratorID(),getSourceID(),*segsrc));
-	else
-		erouter->postEvent(new FilterBankEvent(this,getGeneratorID(),getSourceID()));
+	if(event.getGeneratorID()==getListenGeneratorID() && event.getSourceID()==getListenSourceID()) {
+		if(const SegmentedColorFilterBankEvent * segsrc=dynamic_cast<const SegmentedColorFilterBankEvent *>(&event))
+			erouter->postEvent(new SegmentedColorFilterBankEvent(this,getGeneratorID(),getSourceID(),*segsrc));
+		else
+			erouter->postEvent(new FilterBankEvent(this,getGeneratorID(),getSourceID()));
+	}
 }
 
 unsigned int
@@ -147,9 +149,9 @@
  * @author ejt (reorganized)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Vision/RLEGenerator.h ./Vision/RLEGenerator.h
--- ../Tekkotsu_2.2/Vision/RLEGenerator.h	Wed Feb 18 16:13:32 2004
+++ ./Vision/RLEGenerator.h	Wed Feb 18 16:13:32 2004
@@ -117,7 +117,7 @@
  * @author ejt (reorganized)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Vision/RawCameraGenerator.cc ./Vision/RawCameraGenerator.cc
--- ../Tekkotsu_2.2/Vision/RawCameraGenerator.cc	Wed Feb 18 16:13:32 2004
+++ ./Vision/RawCameraGenerator.cc	Tue Nov  9 15:01:49 2004
@@ -23,6 +23,9 @@
  */
 void
 RawCameraGenerator::processEvent(const EventBase& event) {
+	EventGeneratorBase::processEvent(event);
+	if(event.getGeneratorID()!=getListenGeneratorID() || event.getSourceID()!=getListenSourceID())
+		return;
 	typedef DataEvent<const OFbkImageVectorData*> OFbkEvent;
 	const OFbkEvent& fbkevent=dynamic_cast<const OFbkEvent& >(event);
 	OFbkImageVectorData& fbkdat=*const_cast<OFbkImageVectorData*>(fbkevent.getData());
@@ -422,9 +425,9 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Vision/RawCameraGenerator.h ./Vision/RawCameraGenerator.h
--- ../Tekkotsu_2.2/Vision/RawCameraGenerator.h	Wed Feb 18 16:13:32 2004
+++ ./Vision/RawCameraGenerator.h	Wed Feb 18 16:13:32 2004
@@ -115,7 +115,7 @@
  * @author ejt (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Vision/RegionGenerator.cc ./Vision/RegionGenerator.cc
--- ../Tekkotsu_2.2/Vision/RegionGenerator.cc	Wed Feb 18 16:13:32 2004
+++ ./Vision/RegionGenerator.cc	Tue Nov  9 15:01:49 2004
@@ -24,21 +24,23 @@
 void
 RegionGenerator::processEvent(const EventBase& event) {
 	FilterBankGenerator::processEvent(event);
-	const RLEGenerator * rle=dynamic_cast<const RLEGenerator*>(src);
-	if(NULL==rle) {
-		serr->printf("RegionGenerator's event %s is not from RLEGenerator\n",event.getName().c_str());
-		return;
-	}
-	const SegmentedColorFilterBankEvent * segev=dynamic_cast<const SegmentedColorFilterBankEvent*>(&event);
-	if(NULL==segev) {
-		serr->printf("RegionGenerator's event %s is not SegmentedColorFilterBankEvent\n",event.getName().c_str());
-		return;
+	if(event.getGeneratorID()==getListenGeneratorID() && event.getSourceID()==getListenSourceID()) {
+		const RLEGenerator * rle=dynamic_cast<const RLEGenerator*>(src);
+		if(NULL==rle) {
+			serr->printf("RegionGenerator's event %s is not from RLEGenerator\n",event.getName().c_str());
+			return;
+		}
+		const SegmentedColorFilterBankEvent * segev=dynamic_cast<const SegmentedColorFilterBankEvent*>(&event);
+		if(NULL==segev) {
+			serr->printf("RegionGenerator's event %s is not SegmentedColorFilterBankEvent\n",event.getName().c_str());
+			return;
+		}
+		if(srcNumColors!=segev->getNumColors())
+			freeCaches();
+		srcNumColors=segev->getNumColors();
+		srcColors=segev->getColors();
+		erouter->postEvent(new SegmentedColorFilterBankEvent(this,getGeneratorID(),getSourceID(),*segev));
 	}
-	if(srcNumColors!=segev->getNumColors())
-		freeCaches();
-	srcNumColors=segev->getNumColors();
-	srcColors=segev->getColors();
-	erouter->postEvent(new SegmentedColorFilterBankEvent(this,getGeneratorID(),getSourceID(),*segev));
 }
 
 unsigned int
@@ -237,9 +239,9 @@
  * @author ejt (reorganized)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Vision/RegionGenerator.h ./Vision/RegionGenerator.h
--- ../Tekkotsu_2.2/Vision/RegionGenerator.h	Wed Feb 18 16:13:32 2004
+++ ./Vision/RegionGenerator.h	Wed Feb 18 16:13:32 2004
@@ -74,7 +74,7 @@
  * @author ejt (reorganized)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Vision/SegmentedColorGenerator.cc ./Vision/SegmentedColorGenerator.cc
--- ../Tekkotsu_2.2/Vision/SegmentedColorGenerator.cc	Wed Feb 18 16:13:32 2004
+++ ./Vision/SegmentedColorGenerator.cc	Tue Nov  9 15:01:49 2004
@@ -31,7 +31,8 @@
 void
 SegmentedColorGenerator::processEvent(const EventBase& event) {
 	FilterBankGenerator::processEvent(event);
-	erouter->postEvent(new SegmentedColorFilterBankEvent(this,getGeneratorID(),getSourceID(),this,getNumColors(),getColors(),&colorNames));
+	if(event.getGeneratorID()==getListenGeneratorID() && event.getSourceID()==getListenSourceID())
+		erouter->postEvent(new SegmentedColorFilterBankEvent(this,getGeneratorID(),getSourceID(),this,getNumColors(),getColors(),&colorNames));
 }
 
 unsigned int
@@ -223,9 +224,9 @@
  * @author ejt (reorganized)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
diff -urdN ../Tekkotsu_2.2/Vision/SegmentedColorGenerator.h ./Vision/SegmentedColorGenerator.h
--- ../Tekkotsu_2.2/Vision/SegmentedColorGenerator.h	Fri Jul 16 23:29:24 2004
+++ ./Vision/SegmentedColorGenerator.h	Fri Jul 16 23:29:24 2004
@@ -161,7 +161,7 @@
  * @author ejt (reorganized)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Wireless/DummySocket.h ./Wireless/DummySocket.h
--- ../Tekkotsu_2.2/Wireless/DummySocket.h	Sun Jan 18 05:16:59 2004
+++ ./Wireless/DummySocket.h	Sun Jan 18 05:16:59 2004
@@ -42,7 +42,7 @@
  * @author alokl (Creator)
  * 
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Wireless/Socket.cc ./Wireless/Socket.cc
--- ../Tekkotsu_2.2/Wireless/Socket.cc	Mon Oct  4 16:38:05 2004
+++ ./Wireless/Socket.cc	Mon Oct  4 16:38:05 2004
@@ -172,7 +172,7 @@
  * @author alokl (Creator)
  * 
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Wireless/Socket.h ./Wireless/Socket.h
--- ../Tekkotsu_2.2/Wireless/Socket.h	Mon Oct  4 16:38:05 2004
+++ ./Wireless/Socket.h	Mon Oct  4 16:38:05 2004
@@ -228,7 +228,7 @@
  * @author alokl (Creator)
  * 
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Wireless/Wireless.cc ./Wireless/Wireless.cc
--- ../Tekkotsu_2.2/Wireless/Wireless.cc	Tue Sep 28 18:12:35 2004
+++ ./Wireless/Wireless.cc	Tue Sep 28 18:12:35 2004
@@ -495,7 +495,7 @@
  * @verbinclude CMPack_license.txt
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/Wireless/Wireless.h ./Wireless/Wireless.h
--- ../Tekkotsu_2.2/Wireless/Wireless.h	Wed Mar 24 01:38:21 2004
+++ ./Wireless/Wireless.h	Wed Mar 24 01:38:21 2004
@@ -155,7 +155,7 @@
  * @verbinclude CMPack_license.txt
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/docs/benchmarks/profilerun_ERS210A_2.2.1.txt ./docs/benchmarks/profilerun_ERS210A_2.2.1.txt
--- ../Tekkotsu_2.2/docs/benchmarks/profilerun_ERS210A_2.2.1.txt	Wed Dec 31 19:00:00 1969
+++ ./docs/benchmarks/profilerun_ERS210A_2.2.1.txt	Tue Nov 16 19:03:19 2004
@@ -0,0 +1 @@
+not run
diff -urdN ../Tekkotsu_2.2/docs/benchmarks/profilerun_ERS7_2.2.1.txt ./docs/benchmarks/profilerun_ERS7_2.2.1.txt
--- ../Tekkotsu_2.2/docs/benchmarks/profilerun_ERS7_2.2.1.txt	Wed Dec 31 19:00:00 1969
+++ ./docs/benchmarks/profilerun_ERS7_2.2.1.txt	Tue Nov 16 19:03:19 2004
@@ -0,0 +1 @@
+not run
diff -urdN ../Tekkotsu_2.2/docs/doxygencfg ./docs/doxygencfg
--- ../Tekkotsu_2.2/docs/doxygencfg	Mon Oct 18 12:59:27 2004
+++ ./docs/doxygencfg	Tue Nov 16 19:09:35 2004
@@ -23,7 +23,7 @@
 # This could be handy for archiving the generated documentation or 
 # if some version control system is used.
 
-PROJECT_NUMBER         = 2.2
+PROJECT_NUMBER         = 2.2.1
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
 # base path where the generated documentation will be put. 
@@ -461,9 +461,7 @@
 # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
 # certain files from those directories.
 
-EXCLUDE_PATTERNS       = */Vision/cmv*.h \
-                         */Vision/colors.h \
-                         */docs/*.h \
+EXCLUDE_PATTERNS       = */docs/*.h \
                          */docs/*.cc \
                          */Shared/newmat/* \
                          */Motion/roboop/* \
diff -urdN ../Tekkotsu_2.2/docs/html/index.html ./docs/html/index.html
--- ../Tekkotsu_2.2/docs/html/index.html	Tue Oct 19 04:28:01 2004
+++ ./docs/html/index.html	Tue Nov 16 19:09:35 2004
@@ -124,8 +124,8 @@
 static copies of the documentation, there are two formats:<br>
       </p>
       <ul style="margin-left: 40px;">
-        <li><a href="../media/Tekkotsu_doc_2.2.tar.gz">HTML</a> (v2.2,
-6.4MB)</li>
+        <li><a href="../media/Tekkotsu_doc_2.2.1.tar.gz">HTML</a> (v2.2.1,
+5.9MB)</li>
       </ul>
       <div style="margin-left: 40px;">If you're using the most recent
 version from the <a href="http://cvs.tekkotsu.org/">CVS repository</a>,
diff -urdN ../Tekkotsu_2.2/project/Environment.conf ./project/Environment.conf
--- ../Tekkotsu_2.2/project/Environment.conf	Wed Dec 31 19:00:00 1969
+++ ./project/Environment.conf	Tue Nov 16 14:02:46 2004
@@ -0,0 +1,93 @@
+###########  ENVIRONMENT VARIABLES  ###############
+# If you need to modify these, you should set them as environment
+# variables instead of changing them here - that way other tools (such
+# as mntmem and crashDebug) can use these as well.
+
+# Directory the Tekkotsu framework is stored
+TEKKOTSU_ROOT ?= /usr/local/Tekkotsu
+
+# Location where the memstick will be mounted
+# If you're using cygwin, you probably want something like
+# '/cygdrive/e' instead. 
+MEMSTICK_ROOT ?= /mnt/memstick
+
+# Directory where the OPEN-R SDK was installed
+# See http://www.tekkotsu.org/SDKInstall.html
+# or the OPEN-R website: http://openr.aibo.com/
+OPENRSDK_ROOT ?= /usr/local/OPEN_R_SDK
+
+# in case your memory stick drivers use uppercase, you'll need to
+# set 'FILENAME_CASE' to 'upper'
+FILENAME_CASE ?= lower
+
+# this will delete files from the memory stick that aren't also in
+# your build image - except files at the root level of the memstick,
+# like memstick.ind
+# default: OFF (empty string) - any non-empty string is ON
+STRICT_MEMSTICK_IMAGE ?=
+
+# What model are you targeting?  This will look at the
+# $TEKKOTSU_ROOT/TARGET_MODEL file to find out.  If the file is not
+# found, it is created with the default setting TGT_ERS2xx.  change
+# the target model, make will automatically recompile everything for
+# you.
+# Legal values: TGT_ERS210 TGT_ERS220 TGT_ERS2xx TGT_ERS7
+TEKKOTSU_TARGET_MODEL ?= TGT_ERS7
+
+# What OS is this going to be running under?
+# Choices are:
+#   PLATFORM_APERIOS - the AIBO's OS
+#   PLATFORM_LOCAL - the current desktop environment (*Under development*)
+# If you need to do platform specific stuff in your code, best
+# to check #ifdef PLATFORM_APERIOS, and otherwise assume a UNIX-style
+# environment.  Note that non-Aperios implies no OPEN-R headers.
+TEKKOTSU_TARGET_PLATFORM ?= PLATFORM_APERIOS
+
+# This can be nice if you want to use 'more' to page through errors
+# if they occur.  Otherwise, try using 'cat' instead.
+# The default value below uses 'more', except on Mac OS X which uses 'cat'
+# since 'more' on OS X doesn't handle the console colors.
+TEKKOTSU_LOGVIEW ?= $(if $(findstring Darwin,$(shell uname)),cat,more)
+
+# These control the location that the temporary object files will
+# be stored.
+TEKKOTSU_BUILDDIR ?= $(TEKKOTSU_ROOT)/build
+PROJECT_BUILDDIR ?= build
+# or perhaps you would like one/both of these better:
+# puts build directory in local tmp, but avoids conflicts between
+# multiple frameworks or multiple projects
+#TEKKOTSU_BUILDDIR ?= $(shell echo /tmp/`cd $(TEKKOTSU_ROOT); pwd | tr / _`_build_$(USER) | sed "s/ /\\ /g")
+#PROJECT_BUILDDIR ?= $(shell echo /tmp/`pwd | tr / _`_build_$(USER) | sed "s/ /\\ /g")
+
+
+##########  TOOL SELECTION VARIABLES  #############
+# You probably don't really want to edit these unless you've
+# got something better in mind.
+ifeq ($(TEKKOTSU_TARGET_PLATFORM),PLATFORM_APERIOS)
+  CC=$(OPENRSDK_ROOT)/bin/mipsel-linux-gcc
+  CXX=$(OPENRSDK_ROOT)/bin/mipsel-linux-g++
+  LD=$(OPENRSDK_ROOT)/bin/mipsel-linux-ld
+  STRIP=$(OPENRSDK_ROOT)/bin/mipsel-linux-strip
+  MKBIN=$(OPENRSDK_ROOT)/OPEN_R/bin/mkbin
+  MKBINFLAGS=-p $(OPENRSDK_ROOT)
+  AR=$(OPENRSDK_ROOT)/bin/mipsel-linux-ar rcs
+  AR2=touch
+  FILTERSYSWARN=$(TEKKOTSU_ROOT)/tools/filtersyswarn/filtersyswarn $(OPEN_R_SDK)
+else
+  CC=gcc
+  CXX=g++
+  LD=ld
+  STRIP=strip
+  AR=ar rcs
+  AR2=touch
+  FILTERSYSWARN=$(TEKKOTSU_ROOT)/tools/filtersyswarn/filtersyswarn /usr/include
+endif
+STUBGEN=$(OPENRSDK_ROOT)/OPEN_R/bin/stubgen2
+COLORFILT=$(TEKKOTSU_ROOT)/tools/colorfilt
+
+#These will be the actual build directories used for the current target
+TGT_BD:=$(TEKKOTSU_TARGET_PLATFORM)_$(TEKKOTSU_TARGET_MODEL)
+TK_BD:=$(TEKKOTSU_BUILDDIR)/$(TGT_BD)
+PROJ_BD:=$(PROJECT_BUILDDIR)/$(TGT_BD)
+$(shell mkdir -p $(TK_BD))
+$(shell mkdir -p $(PROJ_BD))
diff -urdN ../Tekkotsu_2.2/project/Makefile ./project/Makefile
--- ../Tekkotsu_2.2/project/Makefile	Thu Oct 14 16:22:51 2004
+++ ./project/Makefile	Tue Nov 16 21:52:45 2004
@@ -4,67 +4,11 @@
 ###################################################
 ##             ENVIRONMENT SETUP                 ##
 ###################################################
-
-
-###########  ENVIRONMENT VARIABLES  ###############
-# If you need to modify these, you should set them as environment
-# variables instead of changing them here - that way other tools (such
-# as mntmem and crashDebug) can use these as well.
-
-# Directory the Tekkotsu framework is stored
-TEKKOTSU_ROOT ?= /usr/local/Tekkotsu
-
-# Location where the memstick will be mounted
-MEMSTICK_ROOT ?= /mnt/memstick
-
-# Directory where the OPEN-R SDK was installed
-# See http://www.tekkotsu.org/SDKInstall.html
-# or the OPEN-R website: http://openr.aibo.com/
-OPENRSDK_ROOT ?= /usr/local/OPEN_R_SDK
-
-# in case your memory stick drivers use uppercase, you'll need to
-# set 'FILENAME_CASE' to 'upper'
-FILENAME_CASE ?= lower
-
-# this will delete files from the memory stick that aren't also in
-# your build image - except files at the root level of the memstick,
-# like memstick.ind
-# default: OFF (empty string) - any non-empty string is ON
-STRICT_MEMSTICK_IMAGE ?=
-
-# What model are you targeting?  This will look at the
-# $TEKKOTSU_ROOT/TARGET_MODEL file to find out.  If the file is not
-# found, it is created with the default setting TGT_ERS2xx.  change
-# the target model, make will automatically recompile everything for
-# you.
-# Legal values: TGT_ERS210 TGT_ERS220 TGT_ERS2xx TGT_ERS7
-TEKKOTSU_TARGET_MODEL ?= TGT_ERS7
-
-# What OS is this going to be running under?
-# Right now, the only choice is Aperios, but in the future we may
-# support running under linux systems, either as simulation for
-# AIBOs, or direct support for linux-based robots.
-TEKKOTSU_TARGET_PLATFORM ?= PLATFORM_APERIOS
-
-# This can be nice if you want to use more to page through errors
-# if they occur.  Otherwise, try using cat instead.
-TEKKOTSU_LOGVIEW ?= $(if $(findstring Darwin,$(shell uname)),cat,more)
-
-# These control the location that the temporary object files will
-# be stored.
-TEKKOTSU_BUILDDIR ?= $(TEKKOTSU_ROOT)/build
-PROJECT_BUILDDIR ?= build
-# or perhaps you would like something like this better:
-#TEKKOTSU_BUILDDIR ?= /tmp/tekkotsu_build_$(USER)
-#PROJECT_BUILDDIR ?= /tmp/project_build_$(USER)
-
+TEKKOTSU_ENVIRONMENT_CONFIGURATION?=$(shell pwd | sed 's/ /\\ /g')/Environment.conf
+include $(TEKKOTSU_ENVIRONMENT_CONFIGURATION)
 
 
 #############  MAKEFILE VARIABLES  ################
-# Change these right here in the Makefile
-
-# Want any other libraries passed to the compiler?  Put them here.
-LIBS=-lObjectComm -lOPENR -lInternet -lantMCOOP -lERA201D1
 
 # Would you like some more compiler flags?  We like lots of warnings.
 # There are some files with exceptions to these flags - MMCombo*.cc
@@ -72,24 +16,27 @@
 # have -Weffc++ and -DOPENR_DEBUG turned off.  If you want to modify
 # these exceptions, look in the middle of the 'Makefile Machinery'
 # section. (grep/search for the file name)
+
+ifeq ($(TEKKOTSU_TARGET_PLATFORM),PLATFORM_APERIOS)
+  PLATFORM_FLAGS= \
+	  -isystem $(OPENRSDK_ROOT)/OPEN_R/include/MCOOP \
+	  -isystem $(OPENRSDK_ROOT)/OPEN_R/include/R4000 \
+	  -isystem $(OPENRSDK_ROOT)/OPEN_R/include \
+	  -DOPENR_DEBUG
+else
+  PLATFORM_FLAGS=
+endif
+
 CXXFLAGS= \
 	-g -pipe -fno-inline \
-  -O2 -frename-registers -fomit-frame-pointer -ffast-math -fno-common \
+	-O2 -frename-registers -fomit-frame-pointer -ffast-math -fno-common \
 	-Wall -W -Wshadow -Wlarger-than-8192 -Wpointer-arith -Wcast-qual \
 	-Woverloaded-virtual -Weffc++ -Wdeprecated -Wnon-virtual-dtor \
-	-I"`pwd`" -I$(TEKKOTSU_ROOT) -I$(TEKKOTSU_ROOT)/Motion/roboop -I$(TEKKOTSU_ROOT)/Shared/newmat \
+	-I$(TEKKOTSU_ROOT) -I$(TEKKOTSU_ROOT)/Motion/roboop \
+	-I$(TEKKOTSU_ROOT)/Shared/newmat \
 	-isystem $(TEKKOTSU_ROOT)/Shared/jpeg-6b \
-	-isystem $(OPENRSDK_ROOT)/OPEN_R/include/MCOOP \
-	-isystem $(OPENRSDK_ROOT)/OPEN_R/include/R4000 \
-	-isystem $(OPENRSDK_ROOT)/OPEN_R/include \
-	-D$(TEKKOTSU_TARGET_PLATFORM) -DDEBUG -DOPENR_DEBUG -D$(TEKKOTSU_TARGET_MODEL) $(GLOBAL_MAP) \
-
-#These will be the actual build directories used for the current target
-TGT_BD:=$(TEKKOTSU_TARGET_PLATFORM)_$(TEKKOTSU_TARGET_MODEL)
-TK_BD:=$(TEKKOTSU_BUILDDIR)/$(TGT_BD)
-PROJ_BD:=$(PROJECT_BUILDDIR)/$(TGT_BD)
-$(shell mkdir -p $(TK_BD))
-$(shell mkdir -p $(PROJ_BD))
+	-D$(TEKKOTSU_TARGET_PLATFORM)  -D$(TEKKOTSU_TARGET_MODEL) \
+	-DDEBUG $(PLATFORM_FLAGS)
 
 
 ###################################################
@@ -106,10 +53,16 @@
 # into MMCombo.
 MAIN_SRCS:=$(PROJ_SRCS)
 
-# We can also link in third-party libraries
-USERLIBS:= $(TEKKOTSU_ROOT)/Shared/jpeg-6b/libjpeg.a \
-           $(TEKKOTSU_ROOT)/Motion/roboop/libroboop.a \
-           $(TEKKOTSU_ROOT)/Shared/newmat/libnewmat.a \
+# We can also link in third-party libraries (path relative to Tekkotsu root)
+# You'll need to specify which processes need which libraries in the next section
+USERLIBS:= $(TK_BD)/Shared/jpeg-6b \
+           $(TK_BD)/Motion/roboop \
+           $(TK_BD)/Shared/newmat \
+
+# These system libs are expected to already be compiled, will be linked
+# into all processes... if you only want to link into a single process,
+# see the *_LIBS variables of the next section
+LIBS=-lObjectComm -lOPENR
 
 
 ###################################################
@@ -125,9 +78,14 @@
 
 # These all are relative to TEKKOTSU_ROOT
 PROCESS_OBJS=MMCombo TinyFTPD SoundPlay
+
+# These specify the components of each process - list either individual
+# object files or entire directories
 MMCombo_COMP=MMCombo MMCombo/MMComboStub.o Behaviors Events Motion Shared SoundPlay/SoundManager.o SoundPlay/WAV.o Vision Wireless
 TinyFTPD_COMP=TinyFTPD TinyFTPD/TinyFTPDStub.o
 SoundPlay_COMP=SoundPlay SoundPlay/SoundPlayStub.o Shared/Config.o Shared/ProcessID.o Events/EventRouter.o Events/EventTranslator.o Events/EventBase.o Events/LocomotionEvent.o Events/TextMsgEvent.o Events/VisionObjectEvent.o Shared/LoadSave.o Shared/get_time.o
+
+# These just set up the automatically generated stub files
 STUB_FILES:=$(addprefix $(TEKKOTSU_ROOT)/,$(addsuffix /stub.cfg,$(PROCESS_OBJS)))
 STUB_CHECK_FILES:=$(addprefix $(TK_BD)/,$(subst /,-,$(STUB_FILES)))
 
@@ -139,56 +97,56 @@
 # vs. make install)
 
 ifeq ($(FILENAME_CASE),lower)
-
-PROCESSES=mmcombo tinyftpd sndplay
-mmcombo_OBJS:=$(addprefix $(PROJ_BD)/,$(MAIN_SRCS:$(SRCSUFFIX)=.o)) $(TK_BD)/MMCombo.o
-mmcombo_OCF:=$(TEKKOTSU_ROOT)/MMCombo/MMCombo.ocf
-tinyftpd_OBJS:=$(TK_BD)/TinyFTPD.o
-tinyftpd_OCF:=$(TEKKOTSU_ROOT)/TinyFTPD/TinyFTPD.ocf
-sndplay_OBJS:=$(TK_BD)/SoundPlay.o
-sndplay_OCF:=$(TEKKOTSU_ROOT)/SoundPlay/SoundPlay.ocf
-CONVERTCASE=$(TEKKOTSU_ROOT)/tools/makelowercase
-
-BINSUFFIX=.bin
-MSIMGDIR=ms
-INSTALLDIR=$(MSIMGDIR)/open-r/mw/objs
-MMCOMBOBIN=mmcombo.bin
-MAINFORK=mainobj.bin
-MOTOFORK=motoobj.bin
-
+  PROCESSES=mmcombo tinyftpd sndplay
+  mmcombo_OBJS:=$(addprefix $(PROJ_BD)/,$(MAIN_SRCS:$(SRCSUFFIX)=.o)) $(TK_BD)/MMCombo/MMComboStub.o
+  mmcombo_LIBS:=$(addprefix $(TK_BD)/,MMCombo.a Motion/roboop/libroboop.a Shared/newmat/libnewmat.a Shared/jpeg-6b/libjpeg.a) -lInternet -lantMCOOP -lERA201D1 
+  mmcombo_OCF:=$(TEKKOTSU_ROOT)/MMCombo/MMCombo.ocf
+  tinyftpd_OBJS:=$(TK_BD)/TinyFTPD/TinyFTPDStub.o
+  tinyftpd_LIBS:=$(addprefix $(TK_BD)/, TinyFTPD.a ) -lInternet -lantMCOOP
+  tinyftpd_OCF:=$(TEKKOTSU_ROOT)/TinyFTPD/TinyFTPD.ocf
+  sndplay_OBJS:=$(TK_BD)/SoundPlay/SoundPlayStub.o
+  sndplay_LIBS:=$(addprefix $(TK_BD)/, SoundPlay.a )
+  sndplay_OCF:=$(TEKKOTSU_ROOT)/SoundPlay/SoundPlay.ocf
+  CONVERTCASE=$(TEKKOTSU_ROOT)/tools/makelowercase
+  BINSUFFIX=.bin
+  MSIMGDIR=ms
+  INSTALLDIR=$(MSIMGDIR)/open-r/mw/objs
+  MMCOMBOBIN=mmcombo.bin
+  MAINFORK=mainobj.bin
+  MOTOFORK=motoobj.bin
 else
-
-PROCESSES=MMCOMBO TINYFTPD SNDPLAY
-MMCOMBO_OBJS:=$(addprefix $(PROJ_BD)/,$(MAIN_SRCS:$(SRCSUFFIX)=.o)) $(TK_BD)/MMCombo.o
-MMCOMBO_OCF:=$(TEKKOTSU_ROOT)/MMCombo/MMCombo.ocf
-TINYFTPD_OBJS:=$(TK_BD)/TinyFTPD.o
-TINYFTPD_OCF:=$(TEKKOTSU_ROOT)/TinyFTPD/TinyFTPD.ocf
-SNDPLAY_OBJS:=$(TK_BD)/SoundPlay.o
-SNDPLAY_OCF:=$(TEKKOTSU_ROOT)/SoundPlay/SoundPlay.ocf
-CONVERTCASE=$(TEKKOTSU_ROOT)/tools/makeuppercase
-
-BINSUFFIX=.BIN
-MSIMGDIR=MS
-INSTALLDIR=$(MSIMGDIR)/OPEN-R/MW/OBJS
-MMCOMBOBIN=MMCOMBO.BIN
-MAINFORK=MAINOBJ.BIN
-MOTOFORK=MOTOOBJ.BIN
-
+  PROCESSES=MMCOMBO TINYFTPD SNDPLAY
+  MMCOMBO_OBJS:=$(addprefix $(PROJ_BD)/,$(MAIN_SRCS:$(SRCSUFFIX)=.o)) $(TK_BD)/MMCombo/MMComboStub.o
+  MMCOMBO_LIBS:=$(addprefix $(TK_BD)/,MMCombo.a Motion/roboop/libroboop.a Shared/newmat/libnewmat.a Shared/jpeg-6b/libjpeg.a) -lInternet -lantMCOOP -lERA201D1 
+  MMCOMBO_OCF:=$(TEKKOTSU_ROOT)/MMCombo/MMCombo.ocf
+  TINYFTPD_OBJS:=$(TK_BD)/TinyFTPD/TinyFTPDStub.o
+  TINYFTPD_LIBS:=$(addprefix $(TK_BD)/, TinyFTPD.a ) -lInternet -lantMCOOP 
+  TINYFTPD_OCF:=$(TEKKOTSU_ROOT)/TinyFTPD/TinyFTPD.ocf
+  SNDPLAY_OBJS:=$(TK_BD)/SoundPlay/SoundPlayStub.o
+  SNDPLAY_LIBS:=$(addprefix $(TK_BD)/, SoundPlay.a )
+  SNDPLAY_OCF:=$(TEKKOTSU_ROOT)/SoundPlay/SoundPlay.ocf
+  CONVERTCASE=$(TEKKOTSU_ROOT)/tools/makeuppercase
+  BINSUFFIX=.BIN
+  MSIMGDIR=MS
+  INSTALLDIR=$(MSIMGDIR)/OPEN-R/MW/OBJS
+  MMCOMBOBIN=MMCOMBO.BIN
+  MAINFORK=MAINOBJ.BIN
+  MOTOFORK=MOTOOBJ.BIN
 endif
 
-# creates process build target names: MMCombo -> build/MMCombo.o
-BUILDS:=$(foreach proc,$(PROCESS_OBJS),$(TK_BD)/$(proc).o)
+# creates process build target names: MMCombo -> build/MMCombo.a
+BUILDS:=$(foreach proc,$(PROCESS_OBJS),$(TK_BD)/$(proc).a)
 
 # Each process build target depends on the component object files that
 # should be linked together.  These live in the $TK_BD directory and
 # should be fairly static unless you're editing the framework itself.
 # The automatic way of creating these dependancies automatically is
 # too messy, just add a rule for each process by hand: (skip lines!)
-$(word 1,$(BUILDS)): $(foreach comp,$($(word 1,$(PROCESS_OBJS))_COMP), $(if $(suffix $(comp)),$(TK_BD)/$(comp),$(patsubst $(TEKKOTSU_ROOT)%.cc,$(TK_BD)%.o,$(shell find $(TEKKOTSU_ROOT)/$(comp) -name "*.cc") )))
+$(word 1,$(BUILDS)): $(foreach comp,$($(word 1,$(PROCESS_OBJS))_COMP), $(if $(suffix $(comp)),$(TK_BD)/$(comp),$(patsubst $(TEKKOTSU_ROOT)%.cc,$(TK_BD)%.o,$(shell find "$(TEKKOTSU_ROOT)/$(comp)" -name "*.cc") )))
 
-$(word 2,$(BUILDS)): $(foreach comp,$($(word 2,$(PROCESS_OBJS))_COMP), $(if $(suffix $(comp)),$(TK_BD)/$(comp),$(patsubst $(TEKKOTSU_ROOT)%.cc,$(TK_BD)%.o,$(shell find $(TEKKOTSU_ROOT)/$(comp) -name "*.cc") )))
+$(word 2,$(BUILDS)): $(foreach comp,$($(word 2,$(PROCESS_OBJS))_COMP), $(if $(suffix $(comp)),$(TK_BD)/$(comp),$(patsubst $(TEKKOTSU_ROOT)%.cc,$(TK_BD)%.o,$(shell find "$(TEKKOTSU_ROOT)/$(comp)" -name "*.cc") )))
 
-$(word 3,$(BUILDS)): $(foreach comp,$($(word 3,$(PROCESS_OBJS))_COMP), $(if $(suffix $(comp)),$(TK_BD)/$(comp),$(patsubst $(TEKKOTSU_ROOT)%.cc,$(TK_BD)%.o,$(shell find $(TEKKOTSU_ROOT)/$(comp) -name "*.cc") )))
+$(word 3,$(BUILDS)): $(foreach comp,$($(word 3,$(PROCESS_OBJS))_COMP), $(if $(suffix $(comp)),$(TK_BD)/$(comp),$(patsubst $(TEKKOTSU_ROOT)%.cc,$(TK_BD)%.o,$(shell find "$(TEKKOTSU_ROOT)/$(comp)" -name "*.cc") )))
 
 # Each of the executable binaries depends on the corresponding
 # framework build target(s) plus any project files which were
@@ -201,11 +159,11 @@
 # hand: (skip lines!)
 PROC_BINS:=$(addprefix $(PROJ_BD)/,$(addsuffix $(BINSUFFIX),$(PROCESSES)))
 
-$(word 1,$(PROC_BINS)): $($(word 1,$(PROCESSES))_OBJS) $($(word 1,$(PROCESSES))_OCF)
+$(word 1,$(PROC_BINS)): $($(word 1,$(PROCESSES))_OBJS) $(filter-out -l%,$($(word 1,$(PROCESSES))_LIBS)) $($(word 1,$(PROCESSES))_OCF)
 
-$(word 2,$(PROC_BINS)): $($(word 2,$(PROCESSES))_OBJS) $($(word 2,$(PROCESSES))_OCF)
+$(word 2,$(PROC_BINS)): $($(word 2,$(PROCESSES))_OBJS) $(filter-out -l%,$($(word 2,$(PROCESSES))_LIBS)) $($(word 2,$(PROCESSES))_OCF)
 
-$(word 3,$(PROC_BINS)): $($(word 3,$(PROCESSES))_OBJS) $($(word 3,$(PROCESSES))_OCF)
+$(word 3,$(PROC_BINS)): $($(word 3,$(PROCESSES))_OBJS) $(filter-out -l%,$($(word 3,$(PROCESSES))_LIBS)) $($(word 3,$(PROCESSES))_OCF)
 
 
 ###################################################
@@ -233,16 +191,7 @@
 # memstick image directory
 INSTALL_BINS:=$(addprefix $(INSTALLDIR)/,$(MAINFORK) $(MOTOFORK) $(addsuffix $(BINSUFFIX),$(filter-out mmcombo MMCOMBO,$(PROCESSES))))
 
-CXX=$(OPENRSDK_ROOT)/bin/mipsel-linux-g++
-LD=$(OPENRSDK_ROOT)/bin/mipsel-linux-ld
-STRIP=$(OPENRSDK_ROOT)/bin/mipsel-linux-strip
-MKBIN=$(OPENRSDK_ROOT)/OPEN_R/bin/mkbin
-STUBGEN=$(OPENRSDK_ROOT)/OPEN_R/bin/stubgen2
-COLORFILT=$(TEKKOTSU_ROOT)/tools/colorfilt
-FILTERSYSWARN=$(TEKKOTSU_ROOT)/tools/filtersyswarn/filtersyswarn $(OPENRSDK_ROOT)
-MKBINFLAGS=-p $(OPENRSDK_ROOT)
-
-.PHONY: all compile install clean cleanDeps cleanProj cleanTemps Tekkotsu reportTarget newstick update docs dox doc cleandoc updateTools checkInstalledTimestamp
+.PHONY: all compile install clean cleanDeps cleanProj cleanTemps Tekkotsu reportTarget newstick update docs dox doc cleandoc updateTools updateLibs $(USERLIBS) checkInstallBinTimestamp test
 
 all: compile
 	@echo "Build successful."
@@ -251,45 +200,46 @@
 	@echo "  or: '$(TEKKOTSU_ROOT)/tools/{ftpinstall,ftpupdate} <ipaddr> ms' might also be useful"
 
 reportTarget:
-	@echo " ** Targeting $(TEKKOTSU_TARGET_MODEL) for build ** ";
+	@echo " ** Targeting $(TEKKOTSU_TARGET_MODEL) for build on $(TEKKOTSU_TARGET_PLATFORM) ** ";
 
 updateTools:
 	cd $(TEKKOTSU_ROOT)/tools && $(MAKE);
 
-updateLibs:
-	@echo "Updating libraries..."
-	@$(foreach x,$(USERLIBS),make -C $(dir $(x)) $(notdir $(x)) && ) true
+updateLibs: $(USERLIBS)
+
+$(USERLIBS):
+	@printf "$(notdir $@): "; \
+	export TEKKOTSU_ENVIRONMENT_CONFIGURATION="$(TEKKOTSU_ENVIRONMENT_CONFIGURATION)"; \
+	$(MAKE) -C $(patsubst $(TK_BD)%,$(TEKKOTSU_ROOT)%,$@)
+
+$(TK_BD)/%.a:
+	@export TEKKOTSU_ENVIRONMENT_CONFIGURATION="$(TEKKOTSU_ENVIRONMENT_CONFIGURATION)"; \
+	$(MAKE) -C $(patsubst $(TK_BD)%,$(TEKKOTSU_ROOT)%,$(dir $@))
 
 #the touch at the end is because memsticks seem to round time to even seconds, which screws up updates.  Grr.
-compile: reportTarget cleanTemps updateTools updateLibs checkInstalledTimestamp $(PROJ_BD)/installed.timestamp
+compile: cleanTemps updateTools updateLibs checkInstallBinTimestamp $(PROJ_BD)/installbin.timestamp
 	@image="$(PROJ_BD)/$(notdir $(MEMSTICK_ROOT))" ; \
-	if [ "$(TEKKOTSU_ROOT)/TARGET_MODEL" -nt "$$image" ] ; then \
-		echo "Deleting old cached OPEN-R binaries"; \
-		rm -rf "$$image" ; \
-	fi; \
 	if [ \! -d "$$image" ] ; then \
 		if [ \! -d "$(SYSTEM_BINARIES)" ] ; then \
-v			echo "Could not find OPEN-R system binaries" ; \
+			echo "Could not find OPEN-R system binaries" ; \
 			exit 1 ; \
 		fi ; \
 		echo "Copying system files..." ; \
 		cp -r "$(SYSTEM_BINARIES)" "$$image" ; \
 		chmod -R u+w "$$image" ; \
-		cur=`pwd`; \
-		cd "$$image"; \
-		$(CONVERTCASE) -r *; \
-		cd "$$cur"; \
+		$(CONVERTCASE) -r $$image/*; \
 		rm -f "$$image/open-r/mw/conf/connect.cfg" "$$image/open-r/mw/conf/object.cfg" "$$image/open-r/system/conf/wlandflt.txt" ; \
 		curt=`date +%Y%m%d%H%M`; \
 		find "$$image" -exec touch -ft $$curt \{\} \; ; \
 	fi;
 
-checkInstalledTimestamp:
+checkInstallBinTimestamp:
 	@for x in $(INSTALL_BINS) ; do \
-		if [ "$$x" -nt "$(PROJ_BD)/installed.timestamp" ] ; then \
+		if [ "$$x" -nt "$(PROJ_BD)/installbin.timestamp" ] ; then \
 			printf "Target switch detected, cleaning binaries..." ; \
 			rm -f $(INSTALL_BINS) ; \
 			printf "done.\n" ; \
+			exit 0; \
 		fi; \
 	done;
 
@@ -410,12 +360,6 @@
 		test $$retval -eq 0; \
 	fi;
 
-#This is for external libraries which we are including, such as libjpeg
-%.a:
-	export OPENRSDK_ROOT=$(OPENRSDK_ROOT) ;\
-	export TEKKOTSU_ROOT=$(TEKKOTSU_ROOT) ;\
-	$(MAKE) -C $(dir $@) $(notdir $@)
-
 #BUILDS:   (framework object files, one per process - resides in framework)
 $(BUILDS):
 	@if [ -r dist_hosts.txt -a -r $(PROJ_BD)/joblist.txt ] ; then \
@@ -429,34 +373,28 @@
 	else \
 		echo "$@ <- $(sort $(foreach comp,$(addprefix $(TK_BD)/,$(filter-out %.a,$($(basename $(notdir $@))_COMP))), $(if $(suffix $(comp)),$(comp),$(shell find $(comp) -name "*.o") )))" | sed 's@$(TK_BD)/@@g'; \
 	fi;
-	@$(LD) -i     $(sort $(foreach comp,$(addprefix $(TK_BD)/,$(filter-out %.a,$($(basename $(notdir $@))_COMP))), $(if $(suffix $(comp)),$(comp),$(shell find $(comp) -name "*.o") ))) -o $@ ; \
-		if [ $$? -ne 0 ] ; then exit 1; fi;
+	@rm -f $@;
+	@$(AR) $@ $(sort $(foreach comp,$(addprefix $(TK_BD)/,$(filter-out %.a,$($(basename $(notdir $@))_COMP))), $(if $(suffix $(comp)),$(comp),$(shell find $(comp) -name "*.o") )));
+	@$(AR2) $@
 
 #PROC_BINS:    (executable binaries, uncompressed)
 # we have to do a couple extra steps to cd into the builddir because
 # mkbin doesn't support -o target in a different directory... drops an
 # intermediate file in . and then complains (as of 1.1.3 anyway)
-$(PROJ_BD)/%$(BINSUFFIX): $(USERLIBS)
+$(PROJ_BD)/%$(BINSUFFIX):
 	@if [ -r dist_hosts.txt -a -r $(PROJ_BD)/joblist.txt ] ; then \
 		echo "Distributing compiles..."; \
 		../tools/pm.pl dist_hosts.txt $(PROJ_BD)/joblist.txt ; \
 	fi
 	@rm -f $(PROJ_BD)/joblist.txt; #this is so we don't rebuild multiple times
 	@echo "Creating executable binary..."
-	@echo "$@ <- $($(basename $(notdir $@))_OBJS), $($(basename $(notdir $@))_OCF), $(LIBS) $(USERLIBS)" | sed 's@ $(PROJ_BD)/@ @g';
-	@#we'll need to do some filtering on USERLIBS below because now we'll be in builddir below
-	@$(LD) -i $($(basename $(notdir $@))_OBJS) -o $(PROJ_BD)/tmp.o
-	@cp $($(basename $(notdir $@))_OCF) $(PROJ_BD)/tmp.ocf
-	@pt=`pwd`;\
-	cd $(PROJ_BD) ; \
-	$(MKBIN) $(MKBINFLAGS) -o $(notdir $@) tmp.o -m tmp.ocf $(LIBS) $(filter /%,$(USERLIBS)) $(addsuffix \",$(addprefix \"$$pt/,$(filter-out /%,$(USERLIBS)))) ; \
+	@echo "$@ <- $($(basename $(notdir $@))_OBJS), $($(basename $(notdir $@))_OCF), $($(basename $(notdir $@))_LIBS) $(LIBS)" | sed 's@ $(PROJ_BD)/@ @g';
+	@$(MKBIN) $(MKBINFLAGS) -o $@ $($(basename $(notdir $@))_OBJS) -m $($(basename $(notdir $@))_OCF) $($(basename $(notdir $@))_LIBS) $(LIBS) ; \
 	if [ $$? -gt 0 ] ; then \
 		echo "Build failed."; \
 		exit 1; \
 	fi; \
-	$(STRIP) $(notdir $@) ; \
-	rm tmp.o tmp.ocf;
-
+	$(STRIP) $@ ;
 
 #INSTALL_BINS:     (compressed executables, in proper location in image directory)
 $(INSTALLDIR)/%$(BINSUFFIX): $(PROJ_BD)/%$(BINSUFFIX)
@@ -485,16 +423,17 @@
 	@$(TEKKOTSU_ROOT)/tools/binstrswap/binstrswap $< MMCombo MotoObj | gzip -c > $@
 #	@sed 's/MMCombo/MotoObj/g;s/mmcombo/motoobj/g' $< | gzip -c > $@
 
-$(PROJ_BD)/installed.timestamp: $(INSTALL_BINS)
+$(PROJ_BD)/installbin.timestamp: $(INSTALL_BINS)
 	@touch $@
 
 install: compile
 	@echo "Installing files to memory stick at $(MEMSTICK_ROOT)"
 	@$(TEKKOTSU_ROOT)/tools/cpymem --all --img $(MSIMGDIR) --tgt $(MEMSTICK_ROOT) --tools $(TEKKOTSU_ROOT)/tools
+	@touch .copiedtomemstick.timestamp
 
 update: compile $(TEKKOTSU_ROOT)/tools/evenmodtime/evenmodtime
 	@echo "Syncing $(MSIMGDIR) and $(MEMSTICK_ROOT)"
-	@$(TEKKOTSU_ROOT)/tools/evenmodtime/evenmodtime `find $(MSIMGDIR)` $(PROJ_BD)/installed.timestamp
+	@$(TEKKOTSU_ROOT)/tools/evenmodtime/evenmodtime `find $(MSIMGDIR)` $(PROJ_BD)/installbin.timestamp
 	@$(TEKKOTSU_ROOT)/tools/mntmem $(MEMSTICK_ROOT)
 	@if [ $(STRICT_MEMSTICK_IMAGE) ] ; then \
 		echo "Strict image copy is on." ; \
@@ -503,6 +442,7 @@
 		rsync -rLtWCv $(MSIMGDIR)/* $(PROJ_BD)/$(notdir $(MEMSTICK_ROOT))/* $(MEMSTICK_ROOT) ; \
 	fi;
 	@$(TEKKOTSU_ROOT)/tools/umntmem $(MEMSTICK_ROOT)
+	@touch .copiedtomemstick.timestamp
 
 newstick:
 	$(TEKKOTSU_ROOT)/tools/mntmem $(MEMSTICK_ROOT)
@@ -523,7 +463,6 @@
 	rm -f $(foreach proc,$(PROCESS_OBJS),$(TEKKOTSU_ROOT)/$(proc)/$(proc)Stub.cc $(TEKKOTSU_ROOT)/$(proc)/$(proc)Stub.h $(TEKKOTSU_ROOT)/$(proc)/def.h $(TEKKOTSU_ROOT)/$(proc)/entry.h)
 	rm -rf $(TEKKOTSU_BUILDDIR)
 	cd $(TEKKOTSU_ROOT)/tools ; $(MAKE) clean
-	$(foreach lib,$(USERLIBS),$(MAKE) -C $(dir $(lib)) clean ;)
 
 cleanDeps:
 	@printf "Cleaning all .d files corresponding to .cc files..."
diff -urdN ../Tekkotsu_2.2/project/StartupBehavior.cc ./project/StartupBehavior.cc
--- ../Tekkotsu_2.2/project/StartupBehavior.cc	Mon Oct 18 13:01:38 2004
+++ ./project/StartupBehavior.cc	Wed Nov 10 20:45:37 2004
@@ -24,7 +24,7 @@
 BehaviorBase& ProjectInterface::startupBehavior=theStartup; //!< used by MMCombo as the init behavior
 
 StartupBehavior::StartupBehavior()
-	: BehaviorBase(), spawned(),setup(),
+	: BehaviorBase("StartupBehavior"), spawned(),setup(),
 		stop_id(MotionManager::invalid_MC_ID),
 		pid_id(MotionManager::invalid_MC_ID)
 {
diff -urdN ../Tekkotsu_2.2/project/StartupBehavior.h ./project/StartupBehavior.h
--- ../Tekkotsu_2.2/project/StartupBehavior.h	Mon Feb  9 17:45:29 2004
+++ ./project/StartupBehavior.h	Wed Nov 10 20:45:37 2004
@@ -49,8 +49,8 @@
 	virtual void DoStart();
 	virtual void DoStop();
 	virtual void processEvent(const EventBase&);
-	virtual std::string getName() const { return "StartupBehavior"; }
 	static std::string getClassDescription() { return "The initial behavior, when run, sets up everything else"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 	//@}
 protected:
 	//! Initializes the Controller menu structure - calls each of the other Setup functions in turn
diff -urdN ../Tekkotsu_2.2/project/StartupBehavior_SetupBackgroundBehaviors.cc ./project/StartupBehavior_SetupBackgroundBehaviors.cc
--- ../Tekkotsu_2.2/project/StartupBehavior_SetupBackgroundBehaviors.cc	Mon Oct 18 19:53:37 2004
+++ ./project/StartupBehavior_SetupBackgroundBehaviors.cc	Mon Nov 15 17:22:36 2004
@@ -16,6 +16,7 @@
 #include "Behaviors/Demos/CameraBehavior.h"
 #include "Behaviors/Demos/MotionStressTestBehavior.h"
 #include "Behaviors/Demos/ASCIIVisionBehavior.h"
+#include "Behaviors/Nodes/TailWagNode.h"
 
 #include "Shared/WorldState.h"
 #include "Shared/ERS210Info.h"
@@ -25,28 +26,29 @@
 	addItem(new ControlBase("Background Behaviors","Background daemons and monitors"));
 	startSubMenu();
 	{ 
-		addItem(new BehaviorSwitchControl<SimpleChaseBallBehavior>("SimpleChaseBallBehavior",false));
-		addItem(new BehaviorSwitchControl<StareAtBallBehavior>("StareAtBallBehavior",false));
-		addItem(new BehaviorSwitchControl<HeadLevelBehavior>("HeadLevelBehavior",false));
+		addItem(new BehaviorSwitchControl<SimpleChaseBallBehavior>("Simple Chase Ball",false));
+		addItem(new BehaviorSwitchControl<StareAtBallBehavior>("Stare at Ball",false));
+		addItem(new BehaviorSwitchControl<HeadLevelBehavior>("Head Level",false));
 		if(state->robotDesign & WorldState::ERS220Mask)
-			addItem(new BehaviorSwitchControl<ToggleHeadLightBehavior>("ToggleHeadLightBehavior",false));
-		addItem(new BehaviorSwitchControl<RelaxBehavior>("RelaxBehavior",false));
-		addItem(new BehaviorSwitchControl<CameraBehavior>("CameraBehavior",false));
-		addItem(new BehaviorSwitchControl<ASCIIVisionBehavior>("ASCIIVisionBehavior",false));
+			addItem(new BehaviorSwitchControl<ToggleHeadLightBehavior>("Toggle Head Light",false));
+		addItem(new BehaviorSwitchControl<TailWagNode>("Wag Tail",false));
+		addItem(new BehaviorSwitchControl<RelaxBehavior>("Relax",false));
+		addItem(new BehaviorSwitchControl<CameraBehavior>("Camera",false));
+		addItem(new BehaviorSwitchControl<ASCIIVisionBehavior>("ASCIIVision",false));
 		addItem(new ControlBase("Debugging Tests","Stress tests"));
 		startSubMenu();
 		{
-			addItem(new BehaviorSwitchControl<MotionStressTestBehavior>("MotionStressTestBehavior",false));
-			addItem(new BehaviorSwitchControl<CrashTestBehavior>("CrashTestBehavior",false));
-			addItem(new BehaviorSwitchControl<FreezeTestBehavior>("FreezeTestBehavior",false));
+			addItem(new BehaviorSwitchControl<MotionStressTestBehavior>("Motion Stress Test",false));
+			addItem(new BehaviorSwitchControl<CrashTestBehavior>("Crash Test",false));
+			addItem(new BehaviorSwitchControl<FreezeTestBehavior>("Freeze Test",false));
 		}
 		endSubMenu();
 		addItem(new ControlBase("System Daemons","Provide some common sensor or event processing"));
 		startSubMenu();
 		{
-			addItem((new BehaviorSwitchControl<AutoGetupBehavior>("AutoGetupBehavior",false)));
-			addItem((new BehaviorSwitchControl<WorldStateVelDaemon>("WorldStateVelDaemon",false))->start());
-			addItem((new BehaviorSwitchControl<BatteryMonitorBehavior>("BatteryMonitorBehavior",false))->start());
+			addItem((new BehaviorSwitchControl<AutoGetupBehavior>("Auto Getup",false)));
+			addItem((new BehaviorSwitchControl<WorldStateVelDaemon>("World State Vel Daemon",false))->start());
+			addItem((new BehaviorSwitchControl<BatteryMonitorBehavior>("Battery Monitor",false))->start());
 		}
 		endSubMenu();
 	}
diff -urdN ../Tekkotsu_2.2/project/StartupBehavior_SetupModeSwitch.cc ./project/StartupBehavior_SetupModeSwitch.cc
--- ../Tekkotsu_2.2/project/StartupBehavior_SetupModeSwitch.cc	Mon Oct 18 15:57:52 2004
+++ ./project/StartupBehavior_SetupModeSwitch.cc	Tue Nov 16 19:01:14 2004
@@ -20,6 +20,7 @@
 #include "Behaviors/Demos/LookForSoundBehavior.h"
 #include "Behaviors/Demos/SimpleChaseBallBehavior.h"
 #include "Behaviors/Demos/StareAtBallBehavior.h"
+#include "Behaviors/Demos/WallTestBehavior.h"
 
 #include "Shared/ProjectInterface.h"
 
@@ -33,32 +34,33 @@
 		BehaviorSwitchControlBase::BehaviorGroup * bg = new BehaviorSwitchControlBase::BehaviorGroup();
 
 		//put behaviors here:
-		addItem(new BehaviorSwitchControl<HelloWorldBehavior>("HelloWorldBehavior",false));
+		addItem(new BehaviorSwitchControl<HelloWorldBehavior>("Hello World",false));
 		if(state->robotDesign&(WorldState::ERS210Mask|WorldState::ERS7Mask)) //this one only really works on the 210 or 7
-			addItem(new BehaviorSwitchControl<AlanBehavior>("AlanBehavior",bg,false));
-		addItem(new BehaviorSwitchControl<FollowHeadBehavior>("FollowHeadBehavior",bg,false));
-		addItem(new BehaviorSwitchControl<StareAtBallBehavior>("StareAtBallBehavior",false));
-		addItem(new BehaviorSwitchControl<SimpleChaseBallBehavior>("SimpleChaseBallBehavior",false));
-		addItem(new BehaviorSwitchControl<ChaseBallBehavior>("ChaseBallBehavior",bg,false));
-		addItem(new BehaviorSwitchControl<SoundTestBehavior>("SoundTestBehavior",bg,false));
-		addItem(new BehaviorSwitchControl<LookForSoundBehavior>("LookForSoundBehavior",bg,false));
+			addItem(new BehaviorSwitchControl<AlanBehavior>("Alan's Behavior",bg,false));
+		addItem(new BehaviorSwitchControl<FollowHeadBehavior>("Follow Head",bg,false));
+		addItem(new BehaviorSwitchControl<StareAtBallBehavior>("Stare at Pink Ball",false));
+		addItem(new BehaviorSwitchControl<SimpleChaseBallBehavior>("Simple Chase Ball",false));
+		addItem(new BehaviorSwitchControl<ChaseBallBehavior>("Chase Ball",bg,false));
+		addItem(new BehaviorSwitchControl<SoundTestBehavior>("Sound Test",bg,false));
+		addItem(new BehaviorSwitchControl<LookForSoundBehavior>("Look at Sound",bg,false));
 		addItem(new ControlBase("State Machine Demos","More fully developed demo applications"));
 		startSubMenu();
 		{
 			addItem(new BehaviorSwitchControlBase(new WalkToTargetMachine(ProjectInterface::visPinkBallSID),bg));
-			addItem(new BehaviorSwitchControl<BanditMachine>("BanditMachine",bg,false));
-			addItem(new BehaviorSwitchControl<ExploreMachine>("ExploreMachine",bg,false));
-			addItem(new BehaviorSwitchControl<PaceTargetsMachine>("PaceTargetsMachine",bg,false));
+			addItem(new BehaviorSwitchControl<BanditMachine>("Bandit State Machine",bg,false));
+			addItem(new BehaviorSwitchControl<ExploreMachine>("Explore State Machine",bg,false));
+			addItem(new BehaviorSwitchControl<PaceTargetsMachine>("Pace Targets State Machine",bg,false));
 		}
 		endSubMenu();
 		addItem(new ControlBase("Kinematics Demos","Showcases some of the newly developed kinematics code"));
 		startSubMenu();
 		{
-			addItem(new BehaviorSwitchControl<KinematicSampleBehavior>("KinematicSampleBehavior",bg,false));
-			addItem(new BehaviorSwitchControl<KinematicSampleBehavior2>("KinematicSampleBehavior2",bg,false));
-			addItem(new BehaviorSwitchControl<StareAtPawBehavior>("StareAtPawBehavior",bg,false));
-			addItem(new BehaviorSwitchControl<StareAtPawBehavior2>("StareAtPawBehavior2",bg,false));
-			addItem(new BehaviorSwitchControl<GroundPlaneBehavior>("GroundPlaneBehavior",bg,false));
+			addItem(new BehaviorSwitchControl<KinematicSampleBehavior>("Kinematic Sample 1",bg,false));
+			addItem(new BehaviorSwitchControl<KinematicSampleBehavior2>("Kinematic Sample 2",bg,false));
+			addItem(new BehaviorSwitchControl<StareAtPawBehavior>("Stare at Paw (pre-2.2)",bg,false));
+			addItem(new BehaviorSwitchControl<StareAtPawBehavior2>("New Stare at Paw",bg,false));
+			addItem(new BehaviorSwitchControl<GroundPlaneBehavior>("Ground Plane Test",bg,false));
+			addItem(new BehaviorSwitchControl<WallTestBehavior>("Wall Test",bg,false));
 		}
 		endSubMenu();
 	}
diff -urdN ../Tekkotsu_2.2/project/StartupBehavior_SetupStatusReports.cc ./project/StartupBehavior_SetupStatusReports.cc
--- ../Tekkotsu_2.2/project/StartupBehavior_SetupStatusReports.cc	Tue Dec 23 01:33:44 2003
+++ ./project/StartupBehavior_SetupStatusReports.cc	Thu Nov 11 15:35:00 2004
@@ -7,12 +7,14 @@
 #include "Behaviors/Controls/ProfilerCheckControl.h"
 #include "Behaviors/Controls/EventLogger.h"
 #include "Behaviors/Controls/SensorObserverControl.h"
+#include "Behaviors/Controls/BehaviorReportControl.h"
 
 ControlBase*
 StartupBehavior::SetupStatusReports() {
 	addItem(new ControlBase("Status Reports","Displays information about the runtime environment on the console"));
 	startSubMenu();
-	{ 
+	{
+		addItem(new BehaviorReportControl());
 		addItem(new BatteryCheckControl());
 		addItem(new ProfilerCheckControl());
 		addItem(new EventLogger());
diff -urdN ../Tekkotsu_2.2/project/StartupBehavior_SetupTekkotsuMon.cc ./project/StartupBehavior_SetupTekkotsuMon.cc
--- ../Tekkotsu_2.2/project/StartupBehavior_SetupTekkotsuMon.cc	Tue Aug 24 21:09:18 2004
+++ ./project/StartupBehavior_SetupTekkotsuMon.cc	Fri Nov 12 17:07:39 2004
@@ -12,6 +12,8 @@
 #include "Behaviors/Mon/RawCamBehavior.h"
 #include "Behaviors/Mon/SegCamBehavior.h"
 #include "Behaviors/Mon/WorldStateSerializerBehavior.h"
+#include "Behaviors/Mon/MicrophoneServer.h"
+#include "Behaviors/Mon/SpeakerServer.h"
 
 ControlBase*
 StartupBehavior::SetupTekkotsuMon() {
@@ -24,9 +26,11 @@
 		addItem((new BehaviorSwitchControl<WMMonitorBehavior>("Watchable Memory Monitor",false))->start());
 		addItem((new BehaviorSwitchControl<Aibo3DControllerBehavior>("Aibo 3D",false)));
 		addItem((new BehaviorSwitchControl<WorldStateSerializerBehavior>("World State Serializer",false)));
-		addItem((new BehaviorSwitchControl<RawCamBehavior>("RawCamServer",false)));
-		addItem((new BehaviorSwitchControl<SegCamBehavior>("SegCamServer",false)));
+		addItem((new BehaviorSwitchControl<RawCamBehavior>("Raw Cam Server",false)));
+		addItem((new BehaviorSwitchControl<SegCamBehavior>("Seg Cam Server",false)));
 		addItem((new BehaviorSwitchControlBase(new EStopControllerBehavior(stop_id)))->start());
+		addItem(new BehaviorSwitchControlBase(MicrophoneServer::GetInstance()));
+		addItem(new BehaviorSwitchControlBase(SpeakerServer::GetInstance()));
 	}
 	return endSubMenu();
 }
diff -urdN ../Tekkotsu_2.2/project/StartupBehavior_SetupWalkEdit.cc ./project/StartupBehavior_SetupWalkEdit.cc
--- ../Tekkotsu_2.2/project/StartupBehavior_SetupWalkEdit.cc	Fri May 14 03:18:19 2004
+++ ./project/StartupBehavior_SetupWalkEdit.cc	Fri May 14 03:18:19 2004
@@ -9,7 +9,7 @@
  * @author PA Gov. School for the Sciences 2003 Team Project - Motion group: Haoqian Chen, Yantian Martin, Jon Stahlman (creators)
  * 
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/project/ms/config/ers210.kin ./project/ms/config/ers210.kin
--- ../Tekkotsu_2.2/project/ms/config/ers210.kin	Mon Oct 18 19:11:05 2004
+++ ./project/ms/config/ers210.kin	Tue Nov 16 22:37:00 2004
@@ -721,10 +721,10 @@
 
 [IR_LINK3]
 joint_type: 0
-theta:     -1.570796326794895
+theta:      1.570796326794895
 d:         48.0
 a:          0.0
-alpha:     -1.570796326794895
+alpha:      1.570796326794895
 theta_min: -1.616175
 theta_max:  1.616175
 m:          0.0
@@ -741,10 +741,10 @@
 
 [IR_LINK4]
 joint_type: 0
-theta:     -2.02003
+theta:      1.12156
 d:         26.5
-a:          0.0
-alpha:     16.2027
+a:         16.2027
+alpha:      0.0
 theta_min: -0.558505
 theta_max:  0.558505
 m:          0.0
@@ -762,7 +762,7 @@
 [IR_LINK5]
 joint_type: 0
 immobile:   1
-theta:      1.26156
+theta:      1.20771
 d:          0.0
 a:          0.0
 alpha:     -0.0215808
diff -urdN ../Tekkotsu_2.2/project/ms/config/ers220.kin ./project/ms/config/ers220.kin
--- ../Tekkotsu_2.2/project/ms/config/ers220.kin	Mon Oct 18 19:11:05 2004
+++ ./project/ms/config/ers220.kin	Tue Nov 16 22:37:00 2004
@@ -611,10 +611,10 @@
 
 [IR_LINK3]
 joint_type: 0
-theta:     -1.570796326794895
+theta:      1.570796326794895
 d:         48.0
 a:          0.0
-alpha:     -1.570796326794895
+alpha:      1.570796326794895
 theta_min: -1.616175
 theta_max:  1.616175
 m:          0.0
@@ -631,10 +631,10 @@
 
 [IR_LINK4]
 joint_type: 0
-theta:     -2.02003
+theta:      1.12156
 d:         26.5
-a:          0.0
-alpha:     16.2027
+a:         16.2027
+alpha:      0.0
 theta_min: -0.558505
 theta_max:  0.558505
 m:          0.0
@@ -652,7 +652,7 @@
 [IR_LINK5]
 joint_type: 0
 immobile:   1
-theta:      1.26156
+theta:      1.20771
 d:          0.0
 a:          0.0
 alpha:     -0.0215808
diff -urdN ../Tekkotsu_2.2/project/ms/config/tekkotsu.cfg ./project/ms/config/tekkotsu.cfg
--- ../Tekkotsu_2.2/project/ms/config/tekkotsu.cfg	Mon Oct 18 17:57:13 2004
+++ ./project/ms/config/tekkotsu.cfg	Tue Nov 16 22:37:00 2004
@@ -1,6 +1,10 @@
-################################################################
-###################   Tekkotsu config   ########################
-################################################################
+##################################################################
+######################   Tekkotsu config   #######################
+##################################################################
+##################### $Name: HEAD $ ######################
+####################### $Revision: 1.1 $ ########################
+################## $Date: 2004/11/17 04:36:48 $ ##################
+##################################################################
 #
 # Format:
 #
@@ -30,9 +34,6 @@
 #     how it is being used...
 #
 ##################################################################
-####################### $Revision: 1.1 $ ########################
-################## $Date: 2004/11/17 04:36:48 $ ##################
-##################################################################
 
 
 
@@ -225,8 +226,18 @@
 [Motion]
 ##################################################################
 ##################################################################
+
+# Any motion related paths which are not absolute (i.e. do not
+# start with '/') will be assumed to be relative to this directory
 root=/ms/data/motion
+
+# This is the default set of walk parameters
 walk=walk.prm
+
+# The file specified by "kinematics" should define the kinematic
+# chains which form your robot.
+# "kinematic_chains" lists the names of the chains which should be
+# loaded from that file
 <ERS-2*>
 <ERS-210>
 kinematics=/ms/config/ers210.kin
@@ -250,6 +261,34 @@
 kinematic_chains=RBk
 kinematic_chains=Camera
 
+# These calibration parameters should specify the value to multiply a
+# desired position by in order to cause the joint to actually reach
+# that position.  This is then used both to calibrate joint values
+# which are sent to the system, and also sensor values which are
+# received back.
+# An unspecified joint is by default '1' which will then pass values
+# through unmodified.  Only PID joints are calibrated (i.e. LEDs and
+# ears are not)
+<ERS-7>
+#Only the knees and rotors have been calibrated
+#This is just kind of a rough calibration since
+#I don't know how well it will generalize across
+#individual robots anyway.
+calibrate:LFr:rotor=0.972
+calibrate:LFr:knee~=0.944
+calibrate:RFr:rotor=0.972
+calibrate:RFr:knee~=0.944
+calibrate:LBk:rotor=0.972
+calibrate:LBk:knee~=0.944
+calibrate:RBk:rotor=0.972
+calibrate:RBk:knee~=0.944
+</ERS-7>
+<ERS-2*>
+#ERS-2xx seems to be fairly well calibrated by system, but
+#you can always try to do better...
+</ERS-2*>
+
+# Sounds to play when turning estop on and off
 estop_on_snd=skid.wav
 estop_off_snd=yap.wav
 
@@ -292,4 +331,19 @@
 preload=skid.wav
 preload=yap.wav
 
+# Audio streaming settings
+# Audio from the AIBO's microphones
+streaming.mic_port=10070
+streaming.mic_sample_rate=16000
+streaming.mic_bits=16
+streaming.mic_stereo=true
+
+# Audio to the AIBO's speakers
+streaming.speaker_port=10071
+# Length of the speaker streaming buffer (ms)
+# Streamed samples are sent to the sound manager in packets of this length
+streaming.speaker_frame_length=64
+# Maximum delay (ms) during playback of received samples
+# If the playback queue gets longer it is emptied.
+streaming.speaker_max_delay=1000
 
diff -urdN ../Tekkotsu_2.2/project/templates/behavior_header.h ./project/templates/behavior_header.h
--- ../Tekkotsu_2.2/project/templates/behavior_header.h	Tue Aug 24 21:09:24 2004
+++ ./project/templates/behavior_header.h	Thu Nov 11 15:35:00 2004
@@ -12,7 +12,7 @@
 class CLASSNAME : public BehaviorBase {
 public:
 	//! constructor
-	CLASSNAME() : BehaviorBase() {}
+	CLASSNAME() : BehaviorBase("CLASSNAME") {}
 
 	virtual void DoStart() {
 		BehaviorBase::DoStart(); // do this first
@@ -29,9 +29,8 @@
 		// you can delete this function if you don't use any events...
 	}
 
-	virtual std::string getName() const { return "CLASSNAME"; }
-
 	static std::string getClassDescription() { return "DESCRIPTION"; }
+	virtual std::string getDescription() const { return getClassDescription(); }
 	
 protected:
 	
@@ -42,10 +41,10 @@
  * @author YOURNAMEHERE (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
- * $Revision: 1.1 $
+ * $Name: HEAD $
+ * $Revision: 1.1 $
  * $State: Exp $
- * $Date: 2004/11/17 04:36:48 $
+ * $Date: 2004/11/17 04:36:48 $
  */
 
 #endif
diff -urdN ../Tekkotsu_2.2/project/templates/header.h ./project/templates/header.h
--- ../Tekkotsu_2.2/project/templates/header.h	Tue Aug 24 21:09:24 2004
+++ ./project/templates/header.h	Tue Aug 24 21:09:24 2004
@@ -15,7 +15,7 @@
  * @author YOURNAMEHERE (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/project/templates/implementation.cc ./project/templates/implementation.cc
--- ../Tekkotsu_2.2/project/templates/implementation.cc	Tue Aug 24 21:09:24 2004
+++ ./project/templates/implementation.cc	Tue Aug 24 21:09:24 2004
@@ -5,7 +5,7 @@
  * @author YOURNAMEHERE (Creator)
  *
  * $Author: ejt $
- * $Name: HEAD $
+ * $Name: HEAD $
  * $Revision: 1.1 $
  * $State: Exp $
  * $Date: 2004/11/17 04:36:48 $
diff -urdN ../Tekkotsu_2.2/tools/buildRelease ./tools/buildRelease
--- ../Tekkotsu_2.2/tools/buildRelease	Mon Oct 18 20:47:44 2004
+++ ./tools/buildRelease	Tue Nov 16 22:36:00 2004
@@ -29,7 +29,8 @@
 rm -rf Tekkotsu_memstick_$1
 rm -rf Tekkotsu_memstick_$1.tar.gz
 
-cvs export -r ${newtag} -d Tekkotsu_$1 Tekkotsu
+echo "Exporting source for ${newtag}..."
+cvs -q export -r ${newtag} -d Tekkotsu_$1 Tekkotsu
 if [ ! -d Tekkotsu_$1 ] ; then
 	echo "cvs export failed"
 	exit 1;
@@ -75,17 +76,29 @@
 curt=`date +%Y%m%d%H%M`;
 find project/ms -exec touch -ft $curt \{\} \; ;
 
+echo "Building Tekkotsu_$1.tar.gz..."
 cd ${tmp};
-tar -cvzf Tekkotsu_$1.tar.gz Tekkotsu_$1;
+tar -czf Tekkotsu_$1.tar.gz Tekkotsu_$1;
 
 
 
 #build patch files
 
 echo "Building patch files..."
-cd ${tmp}
-cvs rdiff -N -d -r ${oldtag} -r ${newtag} Tekkotsu > Tekkotsu_patch_$2_to_$1.diff;
-cvs rdiff -N -d -r ${oldtag} -r ${newtag} Tekkotsu/project > Tekkotsu_patch_project_$2_to_$1.diff;
+cd ${tmp};
+cvs -q export -r ${oldtag} -d Tekkotsu_$2 Tekkotsu
+cd Tekkotsu_$1;
+diff -urdN ../Tekkotsu_$2 . > "${tmp}/Tekkotsu_patch_$2_to_$1.diff";
+if [ "`head -n 1 "${tmp}/Tekkotsu_patch_$2_to_$1.diff" | sed 's/ .*//'`" != "diff" ] ; then
+	echo "Framework patch file failed"
+	exit 1;
+fi;
+cd project;
+diff -urdN ../../Tekkotsu_$2/project . > "${tmp}/Tekkotsu_patch_project_$2_to_$1.diff"
+if [ "`head -n 1 "${tmp}/Tekkotsu_patch_project_$2_to_$1.diff" | sed 's/ .*//'`" != "diff" ] ; then
+	echo "Project patch file failed"
+	exit 1;
+fi;
 
 
 
diff -urdN ../Tekkotsu_2.2/tools/convertmot/Makefile ./tools/convertmot/Makefile
--- ../Tekkotsu_2.2/tools/convertmot/Makefile	Wed Dec 31 19:00:00 1969
+++ ./tools/convertmot/Makefile	Tue Nov  9 17:15:03 2004
@@ -0,0 +1,85 @@
+
+
+#if you want to change the target model, it is recommended
+#to set the TEKKOTSU_TARGET_MODEL environment variable
+
+.PHONY: all tk_bd
+
+# We use this TK_RT instead of TEKKOTSU_ROOT so things will
+# still work if TEKKOTSU_ROOT is a relative path
+TK_RT:=../..
+
+TEMPLATE_PROJECT:=$(TK_RT)/project
+TEKKOTSU_ENVIRONMENT_CONFIGURATION?=$(TEMPLATE_PROJECT)/Environment.conf
+TEKKOTSU_TARGET_PLATFORM = PLATFORM_LOCAL
+include $(TEKKOTSU_ENVIRONMENT_CONFIGURATION)
+FILTERSYSWARN:=$(patsubst $(TEKKOTSU_ROOT)/%,$(TK_RT)/%,$(FILTERSYSWARN))
+COLORFILT:=$(patsubst $(TEKKOTSU_ROOT)/%,$(TK_RT)/%,$(COLORFILT))
+
+BIN:=convertmot_$(shell echo $(patsubst TGT_%,%,$(TEKKOTSU_TARGET_MODEL)) | tr [:upper:] [:lower:])
+
+SRCSUFFIX=.cc
+
+PROJ_OBJ:= \
+	$(PROJ_BD)/convertmot.o \
+
+TK_TGTS:= \
+	$(TK_BD)/Events/EventBase.o \
+	$(TK_BD)/Events/EventRouter.o \
+	$(TK_BD)/Motion/MotionManager.o \
+	$(TK_BD)/Motion/MotionSequenceMC.o \
+	$(TK_BD)/Motion/PostureEngine.o \
+	$(TK_BD)/Motion/Kinematics.o \
+	$(TK_BD)/Motion/OldKinematics.o \
+	$(TK_BD)/Shared/get_time.o \
+	$(TK_BD)/Shared/LoadSave.o \
+	$(TK_BD)/Shared/Config.o \
+	$(TK_BD)/Shared/Profiler.o \
+	$(TK_BD)/Shared/TimeET.o \
+	$(TK_BD)/Shared/WorldState.o \
+	$(TK_BD)/Wireless/Socket.o \
+	$(TK_BD)/Shared/newmat/libnewmat.a \
+	$(TK_BD)/Motion/roboop/libroboop.a
+
+LIBS:= $(TK_BD)/Motion/roboop/libroboop.a $(TK_BD)/Shared/newmat/libnewmat.a
+
+DEPENDS:=$(PROJ_OBJ:.o=.d)
+
+CXXFLAGS=-g -Wall -O2 \
+         -I$(TK_RT)  \
+         -D$(TEKKOTSU_TARGET_PLATFORM) -D$(TEKKOTSU_TARGET_MODEL) 
+
+
+all: $(BIN)
+
+$(BIN): tk_bd $(PROJ_OBJ)
+	@echo "Linking $@..."
+	@g++ $(PROJ_OBJ) $(patsubst $(TEKKOTSU_ROOT)/%,$(TK_RT)/%,$(TK_TGTS) $(LIBS)) -o $@
+
+ifeq ($(findstring clean,$(MAKECMDGOALS)),)
+-include $(DEPENDS)
+endif
+
+%.d :
+	@mkdir -p $(dir $@)
+	@src=$(patsubst %.d,%.cc,$(patsubst $(PROJ_BD)/%,%,$@)); \
+	echo "$@..." | sed 's@.*$(TGT_BD)/@Generating @'; \
+	$(CXX) $(CXXFLAGS) -MP -MG -MT "$@" -MT "$(@:.d=.o)" -MM "$$src" > $@
+
+tk_bd:
+	@echo "Making Tekkotsu files..."
+	@export TEKKOTSU_TARGET_PLATFORM=PLATFORM_LOCAL && $(MAKE) -C $(TEMPLATE_PROJECT) $(TK_TGTS)
+
+
+%.o:
+	@mkdir -p $(dir $@)
+	@src=$(patsubst %.o,%$(SRCSUFFIX),$(patsubst $(PROJ_BD)/%,%,$@)); \
+	echo "Compiling $$src..."; \
+	$(CXX) $(CXXFLAGS) -o $@ -c $$src > $*.log 2>&1; \
+	retval=$$?; \
+	cat $*.log | $(FILTERSYSWARN) | $(COLORFILT) | $(TEKKOTSU_LOGVIEW); \
+	test $$retval -eq 0; \
+
+clean:
+	rm -f $(BIN) $(PROJ_OBJ) $(DEPENDS) *~
+
diff -urdN ../Tekkotsu_2.2/tools/convertmot/README.txt ./tools/convertmot/README.txt
--- ../Tekkotsu_2.2/tools/convertmot/README.txt	Wed Dec 31 19:00:00 1969
+++ ./tools/convertmot/README.txt	Fri Apr 16 16:20:56 2004
@@ -0,0 +1,12 @@
+This tool converts CMPack'02 (and possibly later) motion files to the
+Tekkotsu format.
+     http://www.tekkotsu.org/dox/classMotionSequence.html
+
+The included motion files are little endian - the format the Aibo and x86
+machines use.  However, you will not be able to directly convert these
+files when running on a different architecture (i.e. Mac)
+
+If you do not have access to an x86, you can obtain the CMPack'02 release,
+futz with the genmot code (agent/Motion/genmot) and have it recreate the
+motion files for your architecture.
+
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/dance.mot and ./tools/convertmot/cmpack02-littleendian/dance.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/gu_back.mot and ./tools/convertmot/cmpack02-littleendian/gu_back.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/gu_front.mot and ./tools/convertmot/cmpack02-littleendian/gu_front.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/gu_side.mot and ./tools/convertmot/cmpack02-littleendian/gu_side.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/k_bump.mot and ./tools/convertmot/cmpack02-littleendian/k_bump.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/k_dive.mot and ./tools/convertmot/cmpack02-littleendian/k_dive.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/k_fwd.mot and ./tools/convertmot/cmpack02-littleendian/k_fwd.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/k_head.mot and ./tools/convertmot/cmpack02-littleendian/k_head.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/k_heads.mot and ./tools/convertmot/cmpack02-littleendian/k_heads.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/k_hold.mot and ./tools/convertmot/cmpack02-littleendian/k_hold.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/k_punch.mot and ./tools/convertmot/cmpack02-littleendian/k_punch.mot differ
diff -urdN ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/readme.txt ./tools/convertmot/cmpack02-littleendian/readme.txt
--- ../Tekkotsu_2.2/tools/convertmot/cmpack02-littleendian/readme.txt	Wed Dec 31 19:00:00 1969
+++ ./tools/convertmot/cmpack02-littleendian/readme.txt	Fri Apr 16 16:21:23 2004
@@ -0,0 +1,34 @@
+The included motion files were generated directly from CMPack'02
+genmot and fall under their license:
+*   Misc: dance.mot
+* Getups: gu_back.mot gu_front.mot gu_side.mot 
+*  Kicks: k_bump.mot k_diag.mot k_dive.mot k_fwd.mot k_grab.mot
+          k_head.mot k_heads.mot k_hold.mot k_punch.mot
+
+  LICENSE:
+  =========================================================================
+    CMPack'02 Source Code Release for OPEN-R SDK v1.0
+    Copyright (C) 2002 Multirobot Lab [Project Head: Manuela Veloso]
+    School of Computer Science, Carnegie Mellon University
+  -------------------------------------------------------------------------
+    This software is distributed under the GNU General Public License,
+    version 2.  If you do not have a copy of this licence, visit
+    www.gnu.org, or write: Free Software Foundation, 59 Temple Place,
+    Suite 330 Boston, MA 02111-1307 USA.  This program is distributed
+    in the hope that it will be useful, but WITHOUT ANY WARRANTY,
+    including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  -------------------------------------------------------------------------
+    Additionally licensed to Sony Corporation under the following terms:
+
+    This software is provided by the copyright holders AS IS and any
+    express or implied warranties, including, but not limited to, the
+    implied warranties of merchantability and fitness for a particular
+    purpose are disclaimed.  In no event shall authors be liable for
+    any direct, indirect, incidental, special, exemplary, or consequential
+    damages (including, but not limited to, procurement of substitute
+    goods or services; loss of use, data, or profits; or business
+    interruption) however caused and on any theory of liability, whether
+    in contract, strict liability, or tort (including negligence or
+    otherwise) arising in any way out of the use of this software, even if
+    advised of the possibility of such damage.
+  =========================================================================
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/b_gcntr.mot and ./tools/convertmot/cmpack03-littleendian/b_gcntr.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/b_gdive.mot and ./tools/convertmot/cmpack03-littleendian/b_gdive.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/b_supp.mot and ./tools/convertmot/cmpack03-littleendian/b_supp.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/bw_back.mot and ./tools/convertmot/cmpack03-littleendian/bw_back.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/chicken_dance.mot and ./tools/convertmot/cmpack03-littleendian/chicken_dance.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/dance1.mot and ./tools/convertmot/cmpack03-littleendian/dance1.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/dance2.mot and ./tools/convertmot/cmpack03-littleendian/dance2.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/dance3.mot and ./tools/convertmot/cmpack03-littleendian/dance3.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/enter_field.mot and ./tools/convertmot/cmpack03-littleendian/enter_field.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/gu_back.mot and ./tools/convertmot/cmpack03-littleendian/gu_back.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/gu_front.mot and ./tools/convertmot/cmpack03-littleendian/gu_front.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/gu_side.mot and ./tools/convertmot/cmpack03-littleendian/gu_side.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_bump.mot and ./tools/convertmot/cmpack03-littleendian/k_bump.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_bw.mot and ./tools/convertmot/cmpack03-littleendian/k_bw.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_diag.mot and ./tools/convertmot/cmpack03-littleendian/k_diag.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_dive.mot and ./tools/convertmot/cmpack03-littleendian/k_dive.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_fwd.mot and ./tools/convertmot/cmpack03-littleendian/k_fwd.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_fwd1.mot and ./tools/convertmot/cmpack03-littleendian/k_fwd1.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_fwd2.mot and ./tools/convertmot/cmpack03-littleendian/k_fwd2.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_grab.mot and ./tools/convertmot/cmpack03-littleendian/k_grab.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_head.mot and ./tools/convertmot/cmpack03-littleendian/k_head.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_headh.mot and ./tools/convertmot/cmpack03-littleendian/k_headh.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_heads.mot and ./tools/convertmot/cmpack03-littleendian/k_heads.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_hold.mot and ./tools/convertmot/cmpack03-littleendian/k_hold.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_ldive.mot and ./tools/convertmot/cmpack03-littleendian/k_ldive.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_punch.mot and ./tools/convertmot/cmpack03-littleendian/k_punch.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_rdive.mot and ./tools/convertmot/cmpack03-littleendian/k_rdive.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_sdive.mot and ./tools/convertmot/cmpack03-littleendian/k_sdive.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_spin.mot and ./tools/convertmot/cmpack03-littleendian/k_spin.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_swing.mot and ./tools/convertmot/cmpack03-littleendian/k_swing.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_swing1.mot and ./tools/convertmot/cmpack03-littleendian/k_swing1.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_10.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_10.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_11.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_11.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_12_front.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_12_front.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_13.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_13.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_14_power_chunky.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_14_power_chunky.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_15.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_15.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_17_lightning.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_17_lightning.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_18.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_18.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_4_chest.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_4_chest.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_5.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_5.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_6.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_6.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_8.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_8.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/k_unsw_9.mot and ./tools/convertmot/cmpack03-littleendian/k_unsw_9.mot differ
diff -urdN ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/readme.txt ./tools/convertmot/cmpack03-littleendian/readme.txt
--- ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/readme.txt	Wed Dec 31 19:00:00 1969
+++ ./tools/convertmot/cmpack03-littleendian/readme.txt	Fri Apr 16 16:21:41 2004
@@ -0,0 +1,30 @@
+The included motion files were generated directly from CMPack'03
+genmot and fall under their license:
+
+  LICENSE:
+  =========================================================================
+    CMPack'02 Source Code Release for OPEN-R SDK v1.0
+    Copyright (C) 2002 Multirobot Lab [Project Head: Manuela Veloso]
+    School of Computer Science, Carnegie Mellon University
+  -------------------------------------------------------------------------
+    This software is distributed under the GNU General Public License,
+    version 2.  If you do not have a copy of this licence, visit
+    www.gnu.org, or write: Free Software Foundation, 59 Temple Place,
+    Suite 330 Boston, MA 02111-1307 USA.  This program is distributed
+    in the hope that it will be useful, but WITHOUT ANY WARRANTY,
+    including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  -------------------------------------------------------------------------
+    Additionally licensed to Sony Corporation under the following terms:
+
+    This software is provided by the copyright holders AS IS and any
+    express or implied warranties, including, but not limited to, the
+    implied warranties of merchantability and fitness for a particular
+    purpose are disclaimed.  In no event shall authors be liable for
+    any direct, indirect, incidental, special, exemplary, or consequential
+    damages (including, but not limited to, procurement of substitute
+    goods or services; loss of use, data, or profits; or business
+    interruption) however caused and on any theory of liability, whether
+    in contract, strict liability, or tort (including negligence or
+    otherwise) arising in any way out of the use of this software, even if
+    advised of the possibility of such damage.
+  =========================================================================
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/sad.mot and ./tools/convertmot/cmpack03-littleendian/sad.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/sb_climb.mot and ./tools/convertmot/cmpack03-littleendian/sb_climb.mot differ
Binary files ../Tekkotsu_2.2/tools/convertmot/cmpack03-littleendian/warmup.mot and ./tools/convertmot/cmpack03-littleendian/warmup.mot differ
diff -urdN ../Tekkotsu_2.2/tools/convertmot/convertmot.cc ./tools/convertmot/convertmot.cc
--- ../Tekkotsu_2.2/tools/convertmot/convertmot.cc	Wed Dec 31 19:00:00 1969
+++ ./tools/convertmot/convertmot.cc	Mon Nov  8 16:48:19 2004
@@ -0,0 +1,279 @@
+//This code uses portions of CMPack'02 for loading their motion files.
+//See license below.
+
+/*LICENSE:
+  =========================================================================
+    CMPack'02 Source Code Release for OPEN-R SDK v1.0
+    Copyright (C) 2002 Multirobot Lab [Project Head: Manuela Veloso]
+    School of Computer Science, Carnegie Mellon University
+  -------------------------------------------------------------------------
+    This software is distributed under the GNU General Public License,
+    version 2.  If you do not have a copy of this licence, visit
+    www.gnu.org, or write: Free Software Foundation, 59 Temple Place,
+    Suite 330 Boston, MA 02111-1307 USA.  This program is distributed
+    in the hope that it will be useful, but WITHOUT ANY WARRANTY,
+    including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  -------------------------------------------------------------------------
+    Additionally licensed to Sony Corporation under the following terms:
+
+    This software is provided by the copyright holders AS IS and any
+    express or implied warranties, including, but not limited to, the
+    implied warranties of merchantability and fitness for a particular
+    purpose are disclaimed.  In no event shall authors be liable for
+    any direct, indirect, incidental, special, exemplary, or consequential
+    damages (including, but not limited to, procurement of substitute
+    goods or services; loss of use, data, or profits; or business
+    interruption) however caused and on any theory of liability, whether
+    in contract, strict liability, or tort (including negligence or
+    otherwise) arising in any way out of the use of this software, even if
+    advised of the possibility of such damage.
+  ========================================================================= */
+
+
+#include <iostream>
+#include <stdio.h>
+#include <string>
+#include <algorithm>
+#include "Motion/DynamicMotionSequence.h"
+#include "Motion/Geometry.h"
+#include "Motion/OldKinematics.h"
+#include "Shared/Config.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+using namespace std;
+
+unsigned int simulator_time;
+
+#define ATTR_ANGLES   1
+#define ATTR_POSITION 2
+
+struct LegState{
+  long attr,reserved;
+  point3d pos;
+  double angles[3];
+};
+
+struct HeadState{
+  long attr,reserved;
+  vector3d target;
+  double angles[3];
+};
+
+struct BodyState{
+  BodyPosition pos;
+  LegState leg[4];
+  HeadState head;
+};
+
+struct BodyStateMotion{
+  BodyState body;
+  long time; // ms
+  long reserved;
+};
+
+int usage(unsigned int argc, const char** argv) {
+	const char* name;
+	if(strchr(argv[0],'/')!=NULL)
+		name=strrchr(argv[0],'/')+1;
+	else
+		name=argv[0];
+	cerr << "Usage:\t" << argv[0] << " [-rad] [-deg] [-compress] [-conv] [-skip <n>] <in-file> <out-file>" << endl;
+	cerr << "\t" << argv[0] << " [-rad] [-deg] [-compress] [-conv] [-skip <n>] <in-files> <out-directory>" << endl;
+	cerr << endl;
+	cerr << '`' <<name << "' converts CM-Pack'02 (and possibly newer) posture sequences into " << endl;
+	cerr << "Tekkotsu format motion scripts.  Unfortunately, both types use .mot extensions, " << endl;
+	cerr << "so you'll need to do some renaming/relocating." << endl;
+	cerr << endl;
+	cerr << "The first usage converts one single file.  With the second usage, `" << name << "'" << endl;
+	cerr << "expects the last argument to be the directory to store the converted files " << endl;
+	cerr << "into. (with the same name)" << endl;
+	cerr << endl;
+	cerr << "-deg will cause files to save using degrees.  Default is radians." << endl;
+	cerr << endl;
+	cerr << "-compress will call MotionSequence's compress() function before saving." << endl;
+	cerr << endl;
+	cerr << "-conv will read buggy motion files which were written using degrees instead of " << endl;
+	cerr << "radians.  Shouldn't be necessary, but just in case." << endl;
+	cerr << endl;
+	cerr << "-skip <n> will skip the first n frames of the input. (default 1)" << endl;
+	cerr << endl;
+	cerr << "Be aware the resulting MotionSequence files may need a little tweaking by hand " << endl;
+	cerr << "to remove \"unused\" joints since this can't be determined from the CM-Pack'02 " << endl;
+	cerr << "posture sequence file." << endl;
+	return 2;
+}
+
+int load_cmpack_mot(const char* filename, MotionSequence& ms);
+void Complete(BodyState &body);
+void convert(const BodyStateMotion* frame, unsigned int num_frames, MotionSequence& ms);
+
+bool convertDeg=false;
+bool compress=false;
+unsigned int skip=1;
+
+int main(unsigned int argc, const char** argv) {
+	if(argc<3)
+		return usage(argc,argv);
+	config=new Config("tekkotsu.cfg");
+	unsigned int used=1;
+	bool isRad=true;
+	while(used<argc) {
+		if(strcmp("-deg",argv[used])==0) {
+			used++;
+			isRad=false;
+			cout << "storing as degrees..." << endl;
+			continue;
+		}
+		if(strcmp("-rad",argv[used])==0) {
+			used++;
+			isRad=true;
+			cout << "storing as radians..." << endl;
+			continue;
+		}
+		if(strcmp("-conv",argv[used])==0) {
+			used++;
+			convertDeg=true;
+			cout << "converting degrees..." << endl;
+			continue;
+		}
+		if(strcmp("-compress",argv[used])==0) {
+			used++;
+			compress=true;
+			cout << "compression on..." << endl;
+			continue;
+		}
+		if(strcmp("-skip",argv[used])==0) {
+			used++;
+			char * end;
+			skip=strtol(argv[used],&end,0);
+			if(*end!='\0')
+				return usage(argc,argv);
+			used++;
+		}
+		break;
+	}
+	struct stat s;
+	int ret=stat(argv[argc-1],&s);
+	//cout << argv[argc-1] << ' ' << ret << ' ' << (void*)s.st_mode << ' ' << (void*)s.st_rdev << endl;
+	if(ret==0 && s.st_mode&S_IFDIR) {
+		for(unsigned int i=used; i<argc-1; i++) {
+			string path=argv[argc-1];
+			if(strchr(argv[i],'/')!=NULL)
+				path+=strrchr(argv[i],'/');
+			else {
+				path+="/";
+				path+=argv[i];
+			}
+			DynamicMotionSequence ms;
+			if(isRad)
+				ms.setSaveRadians();
+			else
+				ms.setSaveDegrees();
+			load_cmpack_mot(argv[i],ms);
+			if(compress)
+				ms.compress();
+			ms.SaveFile(path.c_str());
+		}
+		used=argc;
+	} else if(argc-used==2) {
+		DynamicMotionSequence ms;
+		if(isRad)
+			ms.setSaveRadians();
+		else
+			ms.setSaveDegrees();
+		load_cmpack_mot(argv[used],ms);
+		if(compress)
+			ms.compress();
+		ms.SaveFile(argv[used+1]);
+		used=argc;
+	} else
+		return usage(argc,argv);
+	cout << endl;
+	return 0;
+}
+
+
+int load_cmpack_mot(const char* filename, MotionSequence& ms) {
+	unsigned int num;
+	FILE * in = fopen(filename,"rb");
+	if(!in) {
+		cout << '\'' << filename << "' could not be opened." << endl;
+		return 0;
+	}
+	
+	BodyStateMotion * frame;
+	fread(&num,sizeof(int),1,in);
+	if(num<=0 || num>=64) return(false);
+
+	frame = new BodyStateMotion[num];//(BodyStateMotion*)malloc(sizeof(BodyStateMotion)*num);
+	if(!frame) {
+		cout << "Memory allocation error" << endl;
+		return 0;
+	}
+	fread(frame,sizeof(BodyStateMotion),num,in);
+	fclose(in);
+	for(uint i=0; i<num; i++){
+		Complete(frame[i].body);
+	}
+	printf("Loaded Motion '%s'\t frames=%d\n",filename,num);
+
+	convert(frame,num,ms);
+	printf("Converted\n");
+	return 1;
+}
+
+
+void Complete(BodyState &body) {
+	int attr,i;
+
+	// legs
+	for(i=0; i<4; i++){
+		attr = body.leg[i].attr;
+		if(!(attr & ATTR_ANGLES) && (attr & ATTR_POSITION)){
+			GetLegAngles(body.leg[i].angles,body.leg[i].pos,body.pos,i);
+			body.leg[i].attr |= ATTR_ANGLES;
+
+			/*
+			printf("%d (%8.2f %8.2f %8.2f)\n",i,
+						 body.leg[i].pos.x,
+						 body.leg[i].pos.y,
+						 body.leg[i].pos.z);
+			*/
+		}
+	}
+
+	// head
+	attr = body.head.attr;
+	if(!(attr & ATTR_ANGLES) && (attr & ATTR_POSITION)){
+		GetHeadAngles(body.head.angles,body.head.target,
+									body.pos.angle.y,body.pos.loc.z);
+		body.head.attr |= ATTR_ANGLES;
+	}
+}
+
+void convert(const BodyStateMotion* frame, unsigned int num, MotionSequence& ms) {
+	//	long initdelay=frame[0].time;
+	ms.setPlayTime(0);
+	for(unsigned int f=skip; f<num; f++) {
+		int c=0;
+		ms.setPlayTime(ms.getPlayTime()+std::max(frame[f].time,1l));
+		for(int leg=0; leg<4; leg++) //4 legs, 3 joints
+			for(int a=0; a<3; a++)
+				ms.setOutputCmd(c++,frame[f].body.leg[leg].angles[a]*(convertDeg?M_PI/180:1));
+		for(int a=0; a<3; a++) // 1 head, 3 joints
+			ms.setOutputCmd(c++,frame[f].body.head.angles[a]*(convertDeg?M_PI/180:1));
+		
+		//The following aren't actually recorded in source file
+		//included below just for completeness
+/*		for(int a=0; a<2; a++) // 1 tail, 2 joints
+			ms.setOutputCmd(c++,OutputCmd(0,0));
+		ms.setOutputCmd(c++,OutputCmd(0,0)); // 1 mouth, 1 joint
+		for(uint a=0; a<NumLEDs; a++)
+			ms.setOutputCmd(c++,OutputCmd(0,0));
+		for(int a=0; a<2; a++) // 2 ears, 1 joint
+			ms.setOutputCmd(c++,OutputCmd(0,0)); */
+	}
+}
+
diff -urdN ../Tekkotsu_2.2/tools/convertmot/tekkotsu.cfg ./tools/convertmot/tekkotsu.cfg
--- ../Tekkotsu_2.2/tools/convertmot/tekkotsu.cfg	Wed Dec 31 19:00:00 1969
+++ ./tools/convertmot/tekkotsu.cfg	Mon Nov  8 16:48:19 2004
@@ -0,0 +1,128 @@
+##################################################################
+################   Tekkotsu::convertmot config   #################
+##################################################################
+##################### $Name: HEAD $ ######################
+####################### $Revision: 1.1 $ ########################
+################## $Date: 2004/11/17 04:36:48 $ ##################
+##################################################################
+#
+# Format:
+#
+# * Comments are any line beginning with '#'
+#
+# * Model specific regions can be denoted with <MODELNAME>...</MODELNAME>
+#   - Wildcards can also be used: <ERS-2*>...</ERS-2*>
+#   - Anything not within a model region is read by all models (i.e. <*>..</*>)
+#   - Don't get fancy with the "tags" - one per line, the parser's not that smart
+#     (feel free to hack it if you want - it's in Config.cc)
+#
+# * Sections are demarcated with [SECTIONNAME]
+#   - A section is only ended by another section beginning
+#   - Section transitions within a model region will only be read by that model
+#   - Section names are case insensitive
+#
+# * Otherwise, each line is interpreted as: variable=value
+#   - this should correspond to Config::curSectionName_config::variable
+#   - interpretation is up to the code in Config.cc
+#   - some variables are lists (additional assignments push on the list),
+#     others are simply overwritten if a new value is assigned.
+#   - variable names are case insensitive
+#
+# * You can override these at run time from the Controller using the command:
+#   !set section_name.variable=value
+#   - Of course, whether or not the new value will be picked up depends on
+#     how it is being used...
+#
+##################################################################
+
+
+
+##################################################################
+##################################################################
+[Motion]
+##################################################################
+##################################################################
+
+# Any motion related paths which are not absolute (i.e. do not
+# start with '/') will be assumed to be relative to this directory
+root=.
+
+# This is the default set of walk parameters
+walk=walk.prm
+
+# The file specified by "kinematics" should define the kinematic
+# chains which form your robot.
+# "kinematic_chains" lists the names of the chains which should be
+# loaded from that file
+<ERS-2*>
+<ERS-210>
+kinematics=/ms/config/ers210.kin
+kinematic_chains=Mouth
+</ERS-210>
+<ERS-220>
+kinematics=/ms/config/ers220.kin
+</ERS-220>
+kinematic_chains=IR
+</ERS-2*>
+<ERS-7>
+kinematics=/ms/config/ers7.kin
+kinematic_chains=Mouth
+kinematic_chains=NearIR
+kinematic_chains=FarIR
+kinematic_chains=ChestIR
+</ERS-7>
+kinematic_chains=LFr
+kinematic_chains=RFr
+kinematic_chains=LBk
+kinematic_chains=RBk
+kinematic_chains=Camera
+
+# These calibration parameters should specify the value to multiply a
+# desired position by in order to cause the joint to actually reach
+# that position.  This is then used both to calibrate joint values
+# which are sent to the system, and also sensor values which are
+# received back.
+# An unspecified joint is by default '1' which will then pass values
+# through unmodified.  Only PID joints are calibrated (i.e. LEDs and
+# ears are not)
+<ERS-7>
+#Only the knees and rotors have been calibrated
+#This is just kind of a rough calibration since
+#I don't know how well it will generalize across
+#individual robots anyway.
+calibrate:LFr:rotor=0.972
+calibrate:LFr:knee~=0.944
+calibrate:RFr:rotor=0.972
+calibrate:RFr:knee~=0.944
+calibrate:LBk:rotor=0.972
+calibrate:LBk:knee~=0.944
+calibrate:RBk:rotor=0.972
+calibrate:RBk:knee~=0.944
+</ERS-7>
+<ERS-2*>
+#ERS-2xx seems to be fairly well calibrated by system, but
+#you can always try to do better...
+</ERS-2*>
+
+# Sounds to play when turning estop on and off
+estop_on_snd=skid.wav
+estop_off_snd=yap.wav
+
+# These values are used by some behaviors to limit the
+# speed of the head to reduce wear on the joints
+# Units: radians per second
+<ERS-2*>
+max_head_tilt_speed=2.1
+max_head_pan_speed=3.0
+max_head_roll_speed=3.0
+</ERS-2*>
+<ERS-7>
+#the pan speed is revised down from Sony's maximum a bit
+max_head_tilt_speed=3.18522588
+max_head_pan_speed=5.78140315
+max_head_roll_speed=5.78140315
+</ERS-7>
+
+console_port=10003
+stderr_port=10004
+
diff -urdN ../Tekkotsu_2.2/tools/crashDebug ./tools/crashDebug
--- ../Tekkotsu_2.2/tools/crashDebug	Mon Oct 11 15:31:36 2004
+++ ./tools/crashDebug	Fri Nov 12 16:55:47 2004
@@ -8,9 +8,6 @@
 	echo "       -mipal will use the Mi-Pal tools from Griffith University";
 	echo "              mi-pal_options (if any) are passed to StackedIt";
 	echo "       If no options are given, '-q -mipal -2' is assumed.";
-	echo "       This command will read the value of the MEMSTICK_ROOT, TEKKOTSU_ROOT,";
-	echo "       and FILENAME_CASE environment variables to find the emon.log file";
-	echo "       and other tools.";
 	echo "       This should be run from within the project directory";
 	echo "       which caused the crash";
 fi;
@@ -19,16 +16,35 @@
 	exit 2;
 fi;
 
-BUILDDIR=`grep "^PROJECT_BUILDDIR.*=" Makefile | cut -f 2- -d =`;
-if [ ! "$BUILDDIR" ] ; then
-	BUILDDIR=build;
-	echo "WARNING: could not find PROJECT_BUILDDIR specification in Makefile.";
-	echo "         Defaulting to '$BUILDDIR'.";
+#First lets find out where the environment configuration is
+# Note that this value we're about to pull out might not be a direct
+# file name - can (and does by default) involve makefile functions, so
+# we can't easily directly interpret it.
+TEKKOTSU_ENVIRONMENT_CONFIGURATION=`grep "^TEKKOTSU_ENVIRONMENT_CONFIGURATION.*=" Makefile | cut -f 2- -d =`;
+if [ ! "$TEKKOTSU_ENVIRONMENT_CONFIGURATION" ] ; then
+	TEKKOTSU_ENVIRONMENT_CONFIGURATION=Environment.conf;
+	echo "WARNING: could not find TEKKOTSU_ENVIRONMENT_CONFIGURATION specification in Makefile.";
+	echo "         Defaulting to '$TEKKOTSU_ENVIRONMENT_CONFIGURATION'.";
 fi;
-if [ ! "$TEKKOTSU_TARGET_MODEL" ] ; then
-	TEKKOTSU_TARGET_MODEL=TGT_ERS2xx;
+
+#This monstrosity will con make into parsing the environment configuration for us
+eval `make -f - <<EOF
+include $TEKKOTSU_ENVIRONMENT_CONFIGURATION
+.PHONY: all
+all:
+	@echo BUILDDIR=\\"\\\$(PROJ_BD)\\"
+	@echo TEKKOTSU_ROOT=\\"\\\$(TEKKOTSU_ROOT)\\"
+	@echo OPENRSDK_ROOT=\\"\\\$(OPENRSDK_ROOT)\\"
+	@echo MEMSTICK_ROOT=\\"\\\$(MEMSTICK_ROOT)\\"
+	@echo FILENAME_CASE=\\"\\\$(FILENAME_CASE)\\"
+EOF`
+
+#Now we'll check the values that we just pulled out are sane
+if [ ! "$BUILDDIR" ] ; then
+	BUILDDIR=build/PLATFORM_APERIOS_TGT_ERS7;
+	echo "WARNING: could not find PROJECT_BD specification in your project's";
+	echo "         Makefile environment configuration. Defaulting to '$BUILDDIR'.";
 fi;
-BUILDDIR=`echo $BUILDDIR/PLATFORM_APERIOS_$TEKKOTSU_TARGET_MODEL`; #echo removes leading spaces
 
 if [ ! -d "$BUILDDIR" ] ; then
 	echo "ERROR: Build directory '$BUILDDIR' does not exist";
@@ -38,6 +54,43 @@
 	exit 1;
 fi;
 
+if [ -z "$TEKKOTSU_ROOT" ] ; then
+	TEKKOTSU_ROOT=/usr/local/Tekkotsu;
+	echo "WARNING: No TEKKOTSU_ROOT value, defaulting to $TEKKOTSU_ROOT"
+fi;
+if [ ! -d "$TEKKOTSU_ROOT" ] ; then
+	echo "ERROR: Could not find TEKKOTSU_ROOT: $TEKKOTSU_ROOT";
+	exit 1;
+fi;
+export TEKKOTSU_ROOT;
+
+if [ -z "$OPENRSDK_ROOT" ] ; then
+	OPENRSDK_ROOT=/usr/local/OPEN_R_SDK;
+	echo "WARNING: No OPENRSDK_ROOT value, defaulting to $OPENRSDK_ROOT"
+fi;
+if [ ! -d "$OPENRSDK_ROOT" ] ; then
+	echo "ERROR: Could not find OPENRSDK_ROOT: $OPENRSDK_ROOT";
+	exit 1;
+fi;
+export OPENRSDK_ROOT;
+
+if [ -z "$MEMSTICK_ROOT" ] ; then
+	MEMSTICK_ROOT=/mnt/memstick;
+	echo "WARNING: No MEMSTICK_ROOT value, defaulting to $MEMSTICK_ROOT"
+fi;
+export MEMSTICK_ROOT;
+
+if [ -z "FILENAME_CASE" ] ; then
+	FILENAME_CASE=lower;
+	echo "WARNING: No FILENAME_CASE value, defaulting to $FILENAME_CASE"
+fi;
+export FILENAME_CASE;
+
+echo "Processing from build directory: \`$BUILDDIR'"
+echo
+
+# On with the show!
+
 runquick=;
 if [ "$1" = "-q" ] ; then
 	runquick=true;
@@ -69,22 +122,6 @@
 	options=-2;
 fi;
 
-if [ -z "$TEKKOTSU_ROOT" ] ; then
-	TEKKOTSU_ROOT=/usr/local/Tekkotsu;
-fi;
-if [ ! -d "$TEKKOTSU_ROOT" ] ; then
-	echo "ERROR: Could not find TEKKOTSU_ROOT: $TEKKOTSU_ROOT";
-	exit 1;
-fi;
-
-if [ -z "$MEMSTICK_ROOT" ] ; then
-	MEMSTICK_ROOT=/mnt/memstick;
-fi;
-
-if [ -z "FILENAME_CASE" ] ; then
-	FILENAME_CASE=lower;
-fi;
-
 cd "$BUILDDIR"
 
 if [ "$FILENAME_CASE"="lower" ] ; then
@@ -118,6 +155,7 @@
 
 if [ "$runquick" ] ; then
 	grep "exception code:" ${emonfile}
+	printf "** Running '${TEKKOTSU_ROOT}/tools/emonLogParser',\n** taken and modified from the Sony samples...\n"
 	${TEKKOTSU_ROOT}/tools/emonLogParser ${emonfile} > quick-out.txt;
 	file=`sed -n '/object:/s/object:	*//p' quick-out.txt`;
 	${TEKKOTSU_ROOT}/tools/emonLogParser ${emonfile} ${file}.nosnap.elf;
diff -urdN ../Tekkotsu_2.2/tools/emonLogParser ./tools/emonLogParser
--- ../Tekkotsu_2.2/tools/emonLogParser	Mon Sep 30 15:06:28 2002
+++ ./tools/emonLogParser	Fri Nov 12 16:34:12 2004
@@ -11,8 +11,8 @@
 #
 # Installation:
 #
-#    Before running this program, add /usr/local/OPEN_R_SDK/bin
-#    directory to your PATH.
+#    If your OPEN-R SDK installation is not /usr/local/OPEN_R_SDK,
+#    set the OPENRSDK_ROOT environment variable accordingly
 #
 # Usage:
 #
@@ -64,6 +64,11 @@
 my $sHexRe = "([0-9a-zA-Z]+)";
 my $lHexRe = "0x$sHexRe";
 
+my $OPENRSDK_ROOT="/usr/local/OPEN_R_SDK";
+if($ENV{'OPENRSDK_ROOT'}) {
+	$OPENRSDK_ROOT=$ENV{'OPENRSDK_ROOT'};
+}
+
 if (@ARGV < 1 || @ARGV > 3) {
     usage();
     exit(1);
@@ -114,7 +119,7 @@
 my $gpReg = readHex($emonLog, "gp:r28: ");
 print "gp:\t\t$gpReg\n";
 
-my $gpGrep = run("mipsel-linux-readelf -s $nosnapFile | grep '_gp\$'");
+my $gpGrep = run("$OPENRSDK_ROOT/bin/mipsel-linux-readelf -s $nosnapFile | grep '_gp\$'");
 if ($gpGrep !~ /^\s*\S+:\s*$sHexRe\s+.*_gp/) {
     die "INTERNAL ERROR: unexpected \$gpGrep: $gpGrep\n";
 }
@@ -124,7 +129,7 @@
 my $staticAddr = hex($target) - hex($gpReg) + hex($gpSym);
 printf("static addr:\t%08x\n", $staticAddr);
 
-my $command = "mipsel-linux-nm -C $nosnapFile | sort |";
+my $command = "$OPENRSDK_ROOT/bin/mipsel-linux-nm -C $nosnapFile | sort |";
 open(SYMS, $command)
     || die "ERROR: can't open pipe: $command: $!\n";
 
diff -urdN ../Tekkotsu_2.2/tools/ftpinstall ./tools/ftpinstall
--- ../Tekkotsu_2.2/tools/ftpinstall	Tue Jul 13 21:19:40 2004
+++ ./tools/ftpinstall	Tue Nov 16 18:52:32 2004
@@ -36,7 +36,6 @@
 makecopylist(".");
 
 login();
-open (ST, "> ".$ENV{"HOME"}."/.tekkotsu_ftplist");
 for ($i = 0; $i < $numoflist; $i++) {
 	if ($LIST[$i] =~ /\/$/) {
 		ftpmkdir($LIST[$i]);
@@ -52,12 +51,11 @@
 			connectData();
 		}
 		ftpput($LIST[$i]);
-
-		print ST $LIST[$i]."|$mtime\n";
+		
 	}
 }
 logout();
-close(ST);
+$ans=`touch "$copiedtimestamp"`;
 
 #----- sub -----
 sub makecopylist {
diff -urdN ../Tekkotsu_2.2/tools/ftpupdate ./tools/ftpupdate
--- ../Tekkotsu_2.2/tools/ftpupdate	Tue Jul 13 21:19:40 2004
+++ ./tools/ftpupdate	Tue Nov 16 18:52:32 2004
@@ -31,22 +31,14 @@
 die $message if @ARGV <= 1;
 $hostname = shift(@ARGV);
 $localdir = shift(@ARGV);
+$numoflist=0;
 
-chdir($localdir);
-makecopylist(".");
-
-open (ST, $ENV{"HOME"}."/.tekkotsu_ftplist");
-%oldlist={};
-while (<ST>) {
-  chomp;
-  ($file, $lmtime) = split(/\|/);
-  $oldlist{$file}=$lmtime;
-}
-close (ST);
-login();
+$copiedtimestamp = ".copiedtomemstick.timestamp";
 
-open (ST, "> ".$ENV{"HOME"}."/.tekkotsu_ftplist");
+makecopylist($localdir);
 
+chdir($localdir);
+login();
 for ($i = 0; $i < $numoflist; $i++) {
 	if ($LIST[$i] =~ /\/$/) {
 		ftpmkdir($LIST[$i]);
@@ -55,46 +47,34 @@
 		 $atime,$mtime,$ctime,$blksize,$blocks)
 			= stat($LIST[$i]);
 
-		if ($mtime==$oldlist{$LIST[$i]}) {
+		print "$LIST[$i]";
+		if ($opt_a) {
+			listenData();
 		} else {
-			print "$LIST[$i]";
-			if ($opt_a) {
-				listenData();
-			} else {
-				connectData();
-			}
-			ftpput($LIST[$i]);
+			connectData();
 		}
-
-		print ST $LIST[$i]."|$mtime\n";
+		ftpput($LIST[$i]);
+		
 	}
 }
 logout();
-close(ST);
+$ans=`touch "$copiedtimestamp"`;
 
 #----- sub -----
 sub makecopylist {
 	my $directory = shift(@_);
-	my $numofdir;
-	my @DIRLIST;
-	my $i;
-
-	opendir(DIR, $directory);
-	while ($filename = readdir(DIR)) {
-		next if ($filename =~ /^\./);
-		next if ($filename =~ /^CVS$/);
-		$path = "$directory/$filename";
-		$LIST[$numoflist++] = $path if -f $path;
-		if (-d $path) {
-			$LIST[$numoflist++] = "$path/";
-			$DIRLIST[$numofdir++] = $path;
-		}
-	}
-	close(DIR);
+	my $filelist = "/tmp/ftpupdate.filelist.txt";
+	my $ans = `find "$directory" -newer "$copiedtimestamp" > "$filelist"`;
 
-	for ($i = 0; $i < $numofdir; $i++) {
-		makecopylist($DIRLIST[$i]);
+	open(ST,$filelist);
+	while(chomp($path = readline(ST))) {
+		next if ($path =~ /\/\./);
+		next if ($path =~ /\/CVS\//);
+		$localpath=`printf "$path" | sed 's~$directory/~~'`;
+		$LIST[$numoflist++] = "$localpath" if -f $path;
+		$LIST[$numoflist++] = "$localpath/" if -d $path;
 	}
+	close(ST);
 }
 
 sub login {
@@ -231,9 +211,9 @@
 	binmode(FILE);
 
 #	print "sending data\n";
-	while (read(FILE, $tmp, 1024)) {
-#		print ".";
-		print IN "$tmp";
+	while (sysread(FILE, $tmp, 51200)) {
+		print ".";
+		syswrite(IN,$tmp)
 	}
 	print "\n";
 #	print "closing up\n";
diff -urdN ../Tekkotsu_2.2/tools/makelowercase ./tools/makelowercase
--- ../Tekkotsu_2.2/tools/makelowercase	Fri May  7 00:44:24 2004
+++ ./tools/makelowercase	Tue Nov 16 18:52:32 2004
@@ -9,10 +9,13 @@
 fi;
 
 for x in $* ; do
-	if [ -r "$x" ] ; then
-		conv="`echo $x | tr '[A-Z]' '[a-z]'`";
-		if [ "$x" != "$conv" ] ; then
-			if [ -e "$conv" -a ! "$x" -ef "$conv" ] ; then
+	dir=`echo "$x" | sed 's@\(.*\)/.*@\1@'`;
+	file=`echo "$x" | sed 's@\(.*\)/@@'`;
+	pushd "$dir" > /dev/null;
+	if [ -r "$file" ] ; then
+		conv="`echo $file | tr '[A-Z]' '[a-z]'`";
+		if [ "$file" != "$conv" ] ; then
+			if [ -e "$conv" -a ! "$file" -ef "$conv" ] ; then
 				echo "ERROR: $conv already exists (from $x)";
 				echo "exiting..."
 				exit 1;
@@ -20,11 +23,12 @@
 			#wish i could do this:
 			# mv "$x" "$conv";
 			#but cygwin doesn't like that...
-			mv "$x" "$x"_tmp;
-			mv "$x"_tmp "$conv";
+			mv "$file" "$file"_tmp;
+			mv "$file"_tmp "$conv";
 		fi;
 		if [ $recurse -gt 0 -a -d "$conv" ] ; then
 			"$0" -r "$conv"/*;
 		fi;
 	fi;
+	popd > /dev/null;
 done;
diff -urdN ../Tekkotsu_2.2/tools/makeuppercase ./tools/makeuppercase
--- ../Tekkotsu_2.2/tools/makeuppercase	Fri May  7 00:44:24 2004
+++ ./tools/makeuppercase	Tue Nov 16 18:52:32 2004
@@ -9,10 +9,13 @@
 fi;
 
 for x in $* ; do
-	if [ -r "$x" ] ; then
-		conv="`echo $x | tr '[a-z]' '[A-Z]'`";
-		if [ "$x" != "$conv" ] ; then
-			if [ -e "$conv" -a ! "$x" -ef "$conv" ] ; then
+	dir=`echo "$x" | sed 's@\(.*\)/.*@\1@'`;
+	file=`echo "$x" | sed 's@\(.*\)/@@'`;
+	pushd "$dir" > /dev/null;
+	if [ -r "$file" ] ; then
+		conv="`echo $file | tr '[a-z]' '[A-Z]'`";
+		if [ "$file" != "$conv" ] ; then
+			if [ -e "$conv" -a ! "$file" -ef "$conv" ] ; then
 				echo "ERROR: $conv already exists (from $x)";
 				echo "exiting..."
 				exit 1;
@@ -20,11 +23,12 @@
 			#wish i could do this:
 			# mv "$x" "$conv";
 			#but cygwin doesn't like that...
-			mv "$x" "$x"_tmp;
-			mv "$x"_tmp "$conv";
+			mv "$file" "$file"_tmp;
+			mv "$file"_tmp "$conv";
 		fi;
 		if [ $recurse -gt 0 -a -d "$conv" ] ; then
 			"$0" -r "$conv"/*;
 		fi;
 	fi;
+	popd > /dev/null;
 done;
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/ControllerGUI.java ./tools/mon/org/tekkotsu/mon/ControllerGUI.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/ControllerGUI.java	Wed Sep  1 18:37:11 2004
+++ ./tools/mon/org/tekkotsu/mon/ControllerGUI.java	Mon Nov 15 15:53:05 2004
@@ -263,11 +263,11 @@
 			estop.open();
 		} else if(evt.getActionCommand().equals("raw") || evt.getActionCommand().equals("rle")) {
 			if(evt.getActionCommand().equals("raw")) {
-				comm.sendInput("!root \"TekkotsuMon\" \"RawCamServer\"");
-				comm.dynObjSrcs.put("RawVisionGUI","\"TekkotsuMon\" \"RawCamServer\"");
+				comm.sendInput("!root \"TekkotsuMon\" \"Raw Cam Server\"");
+				comm.dynObjSrcs.put("RawVisionGUI","\"TekkotsuMon\" \"Raw Cam Server\"");
 			} else {
-				comm.sendInput("!root \"TekkotsuMon\" \"SegCamServer\"");
-				comm.dynObjSrcs.put("SegVisionGUI","\"TekkotsuMon\" \"SegCamServer\"");
+				comm.sendInput("!root \"TekkotsuMon\" \"Seg Cam Server\"");
+				comm.dynObjSrcs.put("SegVisionGUI","\"TekkotsuMon\" \"Seg Cam Server\"");
 			}
 		} else if(evt.getActionCommand().equals("addbookmark")) {
 			int sel=comm.firstSelected();
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/ControllerListener.java ./tools/mon/org/tekkotsu/mon/ControllerListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/ControllerListener.java	Wed Sep  1 18:37:11 2004
+++ ./tools/mon/org/tekkotsu/mon/ControllerListener.java	Fri Nov 12 17:07:39 2004
@@ -138,6 +138,7 @@
 		try {
 			sin=socket.getInputStream();
 			_out=new PrintStream(socket.getOutputStream());
+			fireConnected();
 			_out.println("!hello");
 			_out.println("!refresh");
 			while (true) {
@@ -270,7 +271,12 @@
 						System.out.println("null listener");
 				}
 			}
-		} catch (Exception e) {if((SocketException)e==null) e.printStackTrace(); }
+		} catch (SocketException e) {
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			fireDisconnected();
+		}
 		
 		try { socket.close(); } catch (Exception ex) { }
 
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/EStopListener.java ./tools/mon/org/tekkotsu/mon/EStopListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/EStopListener.java	Thu Dec 11 00:49:39 2003
+++ ./tools/mon/org/tekkotsu/mon/EStopListener.java	Fri Nov 12 17:07:40 2004
@@ -21,8 +21,8 @@
 		public void estopUpdated(EStopListener mc);
 	}
 
-	void addUpdatedListener(UpdatedListener mcl) { listeners.add(mcl); }
-	void removeUpdatedListener(UpdatedListener mcl) {
+	public void addUpdatedListener(UpdatedListener mcl) { listeners.add(mcl); }
+	public	void removeUpdatedListener(UpdatedListener mcl) {
 		listeners.remove(mcl);
 		if(listeners.size()==0)
 			kill();
@@ -36,11 +36,12 @@
   // Connect to control socket
   public void connected(Socket socket) {
     mysock = socket;
-		fireUpdated();
     try {
       out = new PrintStream(mysock.getOutputStream());
+			fireUpdated();
 			out.print("refresh\n");
 			InputStream sin=socket.getInputStream();
+			fireConnected();
 			while (true) {
 				String msgtype=readLine(sin);
 				if(!_isConnected) break;
@@ -58,7 +59,12 @@
 					System.out.println("Estop Unknown message: "+msgtype);
 				}
 			}
-    } catch(Exception e) {if((SocketException)e==null) e.printStackTrace();}
+    } catch (SocketException e) {
+    } catch (Exception e) {
+      e.printStackTrace();
+    } finally {
+      fireDisconnected();
+    }
 
 		try { socket.close(); } catch (Exception ex) { }
 
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/HeadPointListener.java ./tools/mon/org/tekkotsu/mon/HeadPointListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/HeadPointListener.java	Wed Oct  1 22:08:08 2003
+++ ./tools/mon/org/tekkotsu/mon/HeadPointListener.java	Fri Nov 12 17:07:40 2004
@@ -42,11 +42,17 @@
     try {
       out = mysock.getOutputStream();
 			InputStream sin=socket.getInputStream();
+			fireConnected();
 			while (true) { //not that we expect input, but will block until the socket is closed
 				String msgtype=readLine(sin);
 				if(!_isConnected) break;
 			}
-    } catch(Exception e) {if((SocketException)e==null) e.printStackTrace();}
+    } catch(SocketException e) {
+    } catch(Exception e) {
+      e.printStackTrace();
+    } finally {
+      fireDisconnected();
+    }
 
 		try { socket.close(); } catch (Exception ex) { }
 
@@ -77,6 +83,9 @@
   // Send a headPoint command
   public void sendCommand(String command, double param) {
 		
+    if (out == null) {
+      return;
+    }
     // Extract command byte
     byte cmdbytes[] = command.getBytes();
 		if(cmdbytes[0]=='t')
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/JointRelay.java ./tools/mon/org/tekkotsu/mon/JointRelay.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/JointRelay.java	Tue Feb 24 16:13:27 2004
+++ ./tools/mon/org/tekkotsu/mon/JointRelay.java	Fri Nov 12 17:07:40 2004
@@ -15,6 +15,7 @@
     _outd=new Joints();
     try {
       InputStream in=socket.getInputStream();
+      fireConnected();
       while (true) {
         _data.timestamp=readInt(in);
 	int count;
@@ -45,7 +46,10 @@
 	  }
         }
       }
-    } catch (Exception ex) { }
+    } catch (Exception ex) {
+    } finally {
+      fireDisconnected();
+    }
 
     try { socket.close(); } catch (Exception ex) { }
     _isConnected=false;
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/Listener.java ./tools/mon/org/tekkotsu/mon/Listener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/Listener.java	Mon Nov 24 16:22:30 2003
+++ ./tools/mon/org/tekkotsu/mon/Listener.java	Fri Nov 12 17:07:40 2004
@@ -6,11 +6,116 @@
 import java.io.OutputStream;
 import java.io.IOException;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public abstract class Listener implements Runnable {
 	public Listener() { _port=-1; _isConnected=false; }
 	public Listener(int port) { this(); setPort(port); }
 	public Listener(String host, int port) { this(); setHostPort(host, port); }
 
+	protected long bytesRead = 0;
+	protected long bytesWritten = 0;
+	private boolean countersEnabled = true; 
+  
+	private static final ConnectionListener[] EMPTY_LISTENER_ARRAY =
+		new ConnectionListener[0];
+	private final List listeners = new ArrayList();
+	private ConnectionListener[] cachedListeners = EMPTY_LISTENER_ARRAY;
+
+	/**
+	 * Notifies of connection state change.
+	 */
+	public interface ConnectionListener {
+		/**
+		 * Fires when connection has been established. 
+		 */
+		void onConnected();
+		
+		/**
+		 * Fires when connection has been closed.
+		 */
+		void onDisconnected();
+	}
+	
+	/**
+	 * Adds a connection listener.
+	 * 
+	 * @param listener listener to add.
+	 */
+	public void addConnectionListener(ConnectionListener listener) {
+		listeners.add(listener);
+		cachedListeners = 
+			(ConnectionListener[]) listeners.toArray(EMPTY_LISTENER_ARRAY);
+	}
+	
+	/**
+	 * Removes a connection listener.
+	 *
+	 * @param listener listener to remove.
+	 */
+	public void removeConnectionListener(ConnectionListener listener) {
+		while (listeners.remove(listener)) {}
+		cachedListeners =
+			(ConnectionListener[]) listeners.toArray(EMPTY_LISTENER_ARRAY);
+	}
+	
+	/**
+	 * Notifies listeners that the connection has been established. 
+	 */
+	protected void fireConnected() {
+		for (int i = 0, len = cachedListeners.length; i < len; i++) {
+			cachedListeners[i].onConnected();
+		}
+	}
+	
+	/**
+	 * Notifies listeners that the connection has been closed. 
+	 */
+	protected void fireDisconnected() {
+		for (int i = 0, len = cachedListeners.length; i < len; i++) {
+			cachedListeners[i].onDisconnected();
+		}
+	}
+	
+	/**
+	 * Counts the number of bytes read so far.
+	 * 
+	 * @return number of bytes read.
+	 */
+	public long getBytesRead() {
+		return bytesRead;
+	}
+	
+	/**
+	 * Counts the number of bytes written so far.
+	 * 
+	 * @return number of bytes written.
+	 */
+	public long getBytesWritten() {
+		return bytesWritten;
+	}
+
+	/**
+	 * Enables/disables read/write counters.
+	 * 
+	 * @param enabled <code>true</code> to enable counters, <code>false</code> --
+	 *				to disable.
+	 */
+	public void setReadWriteCountersEnabled(boolean enabled) {
+		this.countersEnabled = enabled;
+	}
+	
+	/**
+	 * Checks whether read/write counters are enabled.
+	 *
+	 * @return <code>true</code> if the counters are enabled, <code>false</code>
+	 *				 otherwise.
+	 */
+	public boolean isReadWriteCountersEnabled() {
+		return countersEnabled;
+	}
+	
 	public void setPort(int port) {
 		_isServer=true;
 		_port=port;
@@ -69,10 +174,7 @@
 	public long readLong(InputStream in) throws IOException {
 		int read=0;
 		int last=0;
-		byte[] buf=new byte[8];
-		while (read<8 && last>=0) { last=in.read(buf,read,8-read); read+=last; }
-		if(last<0)
-			_isConnected=false;
+		byte[] buf  = readBytes(in, 8);
 		return (b2l(buf[7])<<56) | (b2l(buf[6])<<48) |
 					 (b2l(buf[5])<<40) | (b2l(buf[4])<<32) |
 					 (b2l(buf[3])<<24) | (b2l(buf[2])<<16) |
@@ -83,8 +185,8 @@
 		int bytelen=8;
 		byte[] buf=new byte[bytelen];
 		for(int i=0; i<bytelen; i++)
-			buf[i]=(new Long((x>>(8*i)) & 0xff)).byteValue();
-		out.write(buf,0,bytelen);
+			buf[i]= (byte) ((x>>(8*i)) & 0xff);
+		writeBytes(out, buf);
 	}
 
 	public float readFloat(InputStream in) throws IOException {
@@ -98,20 +200,39 @@
 	public int readInt(InputStream in) throws IOException {
 		int read=0;
 		int last=0;
-		byte[] buf=new byte[4];
-		while (read<4 && last>=0) { last=in.read(buf,read,4-read); read+=last; }
-		if(last<0)
-			_isConnected=false;
+		byte[] buf=readBytes(in, 4);
 		return (b2i(buf[3])<<24) | (b2i(buf[2])<<16) |
 					 (b2i(buf[1])<< 8) | b2i(buf[0]);
 	}
 	
+	public short readShort(InputStream in) throws IOException {
+		int read=0;
+		int last=0;
+		byte[] buf=readBytes(in, 2);
+		return (short) ((b2i(buf[1])<< 8) | b2i(buf[0]));
+	}
+	
+	public void writeShort(OutputStream out, short x) throws IOException {
+		int bytelen=2;
+		byte[] buf=new byte[bytelen];
+		for(int i=0; i<bytelen; i++)
+			buf[i]= (byte) ((x>>(8*i)) & 0xff);
+		writeBytes(out, buf);
+	}
+	
 	public void writeInt(OutputStream out, int x) throws IOException {
 		int bytelen=4;
 		byte[] buf=new byte[bytelen];
 		for(int i=0; i<bytelen; i++)
-			buf[i]=(new Integer((x>>(8*i)) & 0xff)).byteValue();
-		out.write(buf,0,bytelen);
+			buf[i]= (byte) ((x>>(8*i)) & 0xff);
+		writeBytes(out, buf);
+	}
+	
+	public void writeBytes(OutputStream out, byte[] buf) throws IOException {
+		out.write(buf);
+		if (isReadWriteCountersEnabled()) {
+			bytesWritten += buf.length;
+		}
 	}
 
   public byte[] readBytes(InputStream in, int bytes) throws IOException {
@@ -123,20 +244,49 @@
 	public void readBytes(byte[] buf, InputStream in, int bytes) throws IOException {
 		int read=0;
 		int last=0;
-		while (read<bytes && last>=0) {
+		while (read<bytes) {
 			last=in.read(buf, read, bytes-read);
+			if (last == -1) {
+				_isConnected = false;
+				break;
+			}
 			read+=last;
+			if (isReadWriteCountersEnabled()) {
+				bytesRead += last;
+			}
+		}
+	}
+	
+	public byte readByte(InputStream in) throws IOException {
+		final int value = in.read();
+		if (value == -1) {
+			throw new IOException("Failed to read: end of stream detected");
+		}
+		if (isReadWriteCountersEnabled()) {
+			bytesRead++;
+		}
+		return (byte) value;
+	}
+	
+	public void writeByte(OutputStream out, byte b) throws IOException {
+		out.write(b);
+		if (isReadWriteCountersEnabled()) {
+			bytesWritten++;
 		}
-		if(last<0)
-			_isConnected=false;
 	}
 
 	public char readChar(InputStream in) throws IOException {
+		if (isReadWriteCountersEnabled()) {
+			bytesRead++;
+		}
 		return (char)in.read();
 	}
 
 	public void writeChar(OutputStream out, char c) throws IOException {
 		out.write(c);
+		if (isReadWriteCountersEnabled()) {
+			bytesWritten++;
+		}
 	}
 
 	public String readLine(InputStream in) throws java.io.IOException{
@@ -150,6 +300,9 @@
 		while(c!='\n') {
 			sbuf.append(c);
 			x=in.read();
+			if (isReadWriteCountersEnabled()) {
+				bytesRead++;
+			}
 			if(x==-1) {
 				_isConnected=false;
 				return sbuf.toString();
@@ -162,8 +315,8 @@
 	public int b2i(byte b) { return (b>=0)?(int)b:((int)b)+256; }
 	public long b2l(byte b) { return (b>=0)?(long)b:((long)b)+256; }
 
-	public abstract void runServer();
-	public abstract void runConnect();
+	protected abstract void runServer();
+	protected abstract void runConnect();
 	public abstract void close();
 
 	public boolean _isServer;
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/MechaController.java ./tools/mon/org/tekkotsu/mon/MechaController.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/MechaController.java	Wed Oct  1 22:08:08 2003
+++ ./tools/mon/org/tekkotsu/mon/MechaController.java	Fri Nov 12 17:07:40 2004
@@ -44,11 +44,17 @@
     try {
       out = mysock.getOutputStream();
 			InputStream sin=socket.getInputStream();
+			fireConnected();
 			while (true) { //not that we expect input, but will block until the socket is closed
 				String msgtype=readLine(sin);
 				if(!_isConnected) break;
 			}
-    } catch(Exception e) {if((SocketException)e==null) e.printStackTrace();}
+    } catch (SocketException e) {
+    } catch (Exception e) {
+      e.printStackTrace();
+    } finally {
+      fireDisconnected();
+    }
 
 		try { socket.close(); } catch (Exception ex) { }
 
@@ -79,6 +85,9 @@
 
   // Send a mecha command
   public void sendCommand(String command, double param) {
+		if (out == null) {
+			return;
+		}
 		t.restart();
 		
     // Extract command byte
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/MicrophoneClient.java ./tools/mon/org/tekkotsu/mon/MicrophoneClient.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/MicrophoneClient.java	Wed Dec 31 19:00:00 1969
+++ ./tools/mon/org/tekkotsu/mon/MicrophoneClient.java	Fri Nov 12 17:07:40 2004
@@ -0,0 +1,179 @@
+package org.tekkotsu.mon;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Streams audio from the AIBO's microphones.
+ *
+ * Every packet of audio received contains information about sample rate, bit
+ * depth and the number of channels. The parameters are on the mercy of the
+ * server and can change during streaming.
+ *
+ * @author Alexander Klyubin
+ */
+public class MicrophoneClient extends TCPListener {
+  private final List audioListeners = new ArrayList();
+  private static final AudioListener[] EMPTY_AUDIO_LISTENER_ARRAY =
+    new AudioListener[0];
+  private AudioListener[] cachedAudioListeners = EMPTY_AUDIO_LISTENER_ARRAY;
+
+  /**
+   * Notifies of arrival of streamed audio packets.
+   */
+  public interface AudioListener {
+    /**
+     * Notifies that an audio packet has been received.
+     * @param samples samples (PCM-encoded).
+     * @param sampleRate sample rate.
+     * @param bitsPerSample bits per sample (usually <code>8</code> or
+     *        <code>16</code>).
+     * @param stereo <code>true</code> if <code>samples</code> contain two
+     *        channels (stereo), <code>false</code> if <code>samples</code>
+     *        contain only one channel (mono).
+     */
+    void onSamplesReceived(
+      byte[] samples,
+      int sampleRate,
+      int bitsPerSample,
+      boolean stereo);
+  }
+	
+  /**
+   * Adds an audio listener.
+   *
+   * @param listener listener to add.
+   */
+  public void addAudioListener(AudioListener listener) {
+    audioListeners.add(listener);
+    cachedAudioListeners =
+      (AudioListener[]) audioListeners.toArray(EMPTY_AUDIO_LISTENER_ARRAY);
+  }
+  
+  /**
+   * Removes an audio listener.
+   *
+   * @param listener listener to remove.
+   */
+  public void removeAudioListener(AudioListener listener) {
+    while (audioListeners.remove(listener)) {}
+    cachedAudioListeners =
+      (AudioListener[]) audioListeners.toArray(EMPTY_AUDIO_LISTENER_ARRAY);
+  }
+  
+  /**
+   * Notifies listeners that an audio packet has been received from the
+   * microphone.
+   *
+   * @param samples samples (PCM-encoded).
+   * @param sampleRate sample rate.
+   * @param bitsPerSample bits per sample (usually <code>8</code> or
+   *        <code>16</code>).
+   * @param stereo <code>true</code> if <code>samples</code> contain two
+   *        channels (stereo), <code>false</code> if <code>samples</code>
+   *        contain only one channel (mono).
+   */
+  protected void fireSamplesReceived(
+    byte[] samples,
+    int sampleRate,
+    int bitsPerSample,
+    boolean stereo) {
+      
+    for (int i = 0, len = cachedAudioListeners.length; i < len; i++) {
+      cachedAudioListeners[i].onSamplesReceived(
+        samples,
+        sampleRate,
+        bitsPerSample,
+        stereo);
+    }
+  }
+  
+  /**
+   * Handles a connection.
+   *
+   * @param socket socket connected to the microphone server. 
+   */
+  protected void connected(Socket socket) {
+    InputStream in  = null; 
+		try {
+			in = socket.getInputStream();
+      fireConnected();
+			while (true) {
+        if (!_isConnected) {
+					break;
+        }
+				consumeFrame(in);
+				if (!_isConnected) {
+					break;
+        }
+			}
+		} catch (Exception e) {
+      e.printStackTrace();
+    } finally {
+      if (in != null) {
+        try {
+          in.close();
+        } catch (IOException e) {
+          e.printStackTrace();
+        }
+        in = null;
+      }
+      fireDisconnected();
+    }
+		
+		try { socket.close(); } catch (IOException e) {}
+	}
+  
+  /**
+   * Converts a signed <code>short</code> into unsigned form.
+   * 
+   * @param value value to convert.
+   *
+   * @return unsigned version of the <code>value</code>.
+   */
+  private static int unsignedShort(short value) {
+    return ((value >= 0) ? value : 65536 + value);
+  }
+  
+  /**
+   * Consumes an audio frame from the stream.
+   * 
+   * @param in input stream to consume the frame from.
+   * @throws IOException if an I/O exception occurs.
+   */
+  protected void consumeFrame(InputStream in) throws IOException {
+    // HEADER (4 bytes)
+    //   unsigned short: size
+    //   unsigned short: type
+    // DATA (size)
+    final int size = unsignedShort(readShort(in));
+    final int type = unsignedShort(readShort(in));
+    if (type == 0) {
+      // PCM frame
+      // HEADER (4 bytes)
+      //   unsigned short: sampleRate
+      //   byte:           bitsPerSample
+      //   byte:           stereo
+      // PCM DATA (size - 4)
+      final int sampleRate = unsignedShort(readShort(in));
+      final byte bitsPerSample = readByte(in);
+      final boolean stereo = (readByte(in) == 1);
+      final byte[] frame = readBytes(in, size - 4);
+      fireSamplesReceived(frame, sampleRate, bitsPerSample, stereo);
+    } else {
+      System.err.println("Unknown microphone frame type: " + type
+        + ", size = " + size);
+      // Skip the frame
+      readBytes(in, size);
+    }
+  }
+  
+  /**
+   * Constructs a new <code>MicrophoneClient</code> instance.
+   */
+  public MicrophoneClient() {}
+}
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/SketchPanel.java ./tools/mon/org/tekkotsu/mon/SketchPanel.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/SketchPanel.java	Thu Apr 22 20:02:53 2004
+++ ./tools/mon/org/tekkotsu/mon/SketchPanel.java	Fri Nov 12 17:07:40 2004
@@ -24,7 +24,7 @@
 		super(listener);
 		gui = _gui;
 		isCam = _isCam;
-		listener.runConnect();
+		listener.run();
 	}	
 	
 	protected void drawImage(Graphics _g, BufferedImage img, int x, int y, 
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/SpeakerClient.java ./tools/mon/org/tekkotsu/mon/SpeakerClient.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/SpeakerClient.java	Wed Dec 31 19:00:00 1969
+++ ./tools/mon/org/tekkotsu/mon/SpeakerClient.java	Fri Nov 12 17:07:40 2004
@@ -0,0 +1,112 @@
+package org.tekkotsu.mon;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.Socket;
+
+/**
+ * Streams audio to the AIBO's speaker.
+ *
+ * Each packet sent contains sample rate and bit depth information which is
+ * used by the server to resample it to the correct format used by the AIBO
+ * internally.
+ *
+ * @author Alexander Klyubin
+ */
+public class SpeakerClient extends TCPListener {
+  /** Output stream for communication with the server. */
+  OutputStream out = null;
+  
+  /**
+   * Handles a connection.
+   *
+   * @param socket socket connected to the speaker server. 
+   */
+  protected void connected(Socket socket) {
+    InputStream in  = null; 
+		try {
+      out = socket.getOutputStream();
+			in = socket.getInputStream();
+      fireConnected();
+			while (true) {
+        if (!_isConnected) {
+					break;
+        }
+        if (in.read() == -1) {
+          break;
+        } 
+			}
+		} catch (Exception e) {
+      e.printStackTrace();
+    } finally {
+      if (in != null) {
+        try {
+          in.close();
+        } catch (IOException e) {
+          e.printStackTrace();
+        }
+        in = null;
+      }
+      if (out != null) {
+        try {
+          out.close();
+        } catch (IOException e) {
+          e.printStackTrace();
+        }
+        out = null;
+      }
+      fireDisconnected();
+    }
+		
+		try { socket.close(); } catch (IOException e) {}
+	}
+  
+  /**
+   * Sends a frame of audio to the speaker.
+   * 
+   * @param samples samples (PCM-encoded, 16-bit signed or 8-bit unsigned).
+   * @param sampleRate sample rate (Hz).
+   * @param bitsPerSample bits per sample (usually <code>8</code> or
+   *        <code>16</code>).
+   *
+   * @throws IOException if an I/O exception occurs.
+   */
+  public void sendFrame(
+    byte[] samples,
+    int sampleRate,
+    int bitsPerSample) throws IOException {
+      
+    if (samples.length > 65530) {
+      throw new IllegalArgumentException(
+        "Frame too long. Maximum length: 65530");
+    }
+    
+    if ((!_isConnected) || (out == null)) {
+      throw new IOException("Not connected");
+    }
+    
+    // HEADER (4 bytes)
+    //   unsigned short: size
+    //   unsigned short: type
+    // DATA (size)
+    writeShort(out, (short) (samples.length + 4));
+    writeShort(out, (short) 0); // PCM
+    // PCM frame
+    // HEADER (4 bytes)
+    //   unsigned short: sampleRate
+    //   byte:           bitsPerSample
+    //   byte:           padding
+    // PCM DATA (size - 4)
+    writeShort(out, (short) sampleRate);
+    writeByte(out, (byte) bitsPerSample);
+    writeByte(out, (byte) 0);
+    writeBytes(out, samples);
+    out.flush();
+  }
+  
+  /**
+   * Constructs a new <code>SpeakerClient</code>.
+   */
+  public SpeakerClient() {}
+}
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/TCPListener.java ./tools/mon/org/tekkotsu/mon/TCPListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/TCPListener.java	Wed Oct  1 22:08:08 2003
+++ ./tools/mon/org/tekkotsu/mon/TCPListener.java	Fri Nov 12 17:07:40 2004
@@ -4,9 +4,9 @@
 import java.net.Socket;
 
 public abstract class TCPListener extends Listener {
-	public abstract void connected(Socket socket);
+	protected abstract void connected(Socket socket);
 
-	public void runServer() {
+	protected void runServer() {
 		Thread me = Thread.currentThread();
 		try { _serverSocket=new ServerSocket(_port); }
 		catch (Exception ex) {
@@ -22,7 +22,7 @@
 		}
 	}
 
-	public void runConnect() {
+	protected void runConnect() {
 		int attempts=0;
 		Thread me = Thread.currentThread();
 		while (me==_listenerThread && !destroy) {
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/TCPVisionListener.java ./tools/mon/org/tekkotsu/mon/TCPVisionListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/TCPVisionListener.java	Tue Sep 28 14:56:12 2004
+++ ./tools/mon/org/tekkotsu/mon/TCPVisionListener.java	Fri Nov 12 17:07:40 2004
@@ -351,6 +351,7 @@
 					System.err.println("Unrecognized type: "+type);
 					break;
 				}
+				fireConnected();
 				format=readInt(in);
 				if(!_isConnected) break; //System.out.println("Got format="+format);
 				compression=readInt(in);
@@ -435,27 +436,27 @@
 							isJPEG=false;
 							isIndex=false;
 							int useChan=(channels==1)?i:chan_id;
-							if(!readChannel(in,useChan,chanwidth,chanheight)) { failed=true; break; }
+							if(!readChannel(in,useChan,chanwidth,chanheight)) { failed=true; System.err.println("TCPVisionListener channel read failed"); break; }
 						} else if(fmt.equals("JPEGGrayscale")) {
 							isIndex=false;
 							int useChan=(channels==1)?i:chan_id;
-							if(!readJPEGChannel(in,useChan,chanwidth,chanheight)) { failed=true; break; }
+							if(!readJPEGChannel(in,useChan,chanwidth,chanheight)) { failed=true; System.err.println("TCPVisionListener JPEGGreyscale channel read failed"); break; }
 							isJPEG=(channels==1);
 						} else if(fmt.equals("JPEGColor")) {
 							isIndex=false;
 							if(format==ENCODE_SINGLE_CHANNEL)
 								System.err.println("WTF? ");
-							if(!readJPEG(in,chanwidth,chanheight)) { failed=true; break; }
+							if(!readJPEG(in,chanwidth,chanheight)) { failed=true; System.err.println("TCPVisionListener JPEGColor channel read failed"); break; }
 							i=channels;
 							isJPEG=true;
 						} else if(fmt.equals("SegColorImage")) {
 							isJPEG=false;
 							isIndex=true;
-							if(!readIndexedColor(in,chanwidth,chanheight)) { failed=true; break; }
+							if(!readIndexedColor(in,chanwidth,chanheight)) { failed=true; System.err.println("TCPVisionListener SegColor read failed"); break; }
 						} else if(fmt.equals("RLEImage")) {
 							isJPEG=false;
 							isIndex=true;
-							if(!readRLE(in,chanwidth,chanheight)) { failed=true; break; }
+							if(!readRLE(in,chanwidth,chanheight)) { failed=true; System.err.println("TCPVisionListener RLEImage read failed"); break; }
 						} else {
 							isJPEG=false;
 							isIndex=false;
@@ -464,8 +465,10 @@
 						}
 					}
 				}
-				if(failed || !_isConnected)
+				if(failed || !_isConnected) {
+					System.err.println("TCPVisionListener connection lost");
 					break;
+				}
 				
 				synchronized(_outd) {
 					byte[] temp=_data;
@@ -484,7 +487,10 @@
 				}
 				fireVisionUpdate();
 			}
-		} catch (Exception ex) { }
+		} catch (Exception ex) {
+		} finally {
+			fireDisconnected();
+		}
 		
 		try { socket.close(); } catch (Exception ex) { }
 		_isConnected=false;
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/TextListener.java ./tools/mon/org/tekkotsu/mon/TextListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/TextListener.java	Wed Oct  1 22:08:08 2003
+++ ./tools/mon/org/tekkotsu/mon/TextListener.java	Fri Nov 12 17:07:40 2004
@@ -15,12 +15,16 @@
       BufferedReader in=new BufferedReader(new InputStreamReader(
                           socket.getInputStream()));
       _out=new PrintStream(socket.getOutputStream());
+      fireConnected();
       while (true) {
         String read=in.readLine();
         if (read==null) break;
         synchronized (_data) { _data=_data+read+"\n"; }
       }
-    } catch (Exception ex) { }
+    } catch (Exception ex) {
+    } finally {
+      fireDisconnected();
+    }
 
     try { socket.close(); } catch (Exception ex) { }
     _isConnected=false;
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/UDPListener.java ./tools/mon/org/tekkotsu/mon/UDPListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/UDPListener.java	Mon Sep 27 18:48:36 2004
+++ ./tools/mon/org/tekkotsu/mon/UDPListener.java	Fri Nov 12 17:07:40 2004
@@ -5,12 +5,12 @@
 
 
 public abstract class UDPListener extends Listener {
-  public abstract void connected(DatagramSocket socket);
+  protected abstract void connected(DatagramSocket socket);
 
   String message = new String("connection request");
   byte[] buf = message.getBytes();
 
-  public void runServer() {
+  protected void runServer() {
     try {
       _socket=new DatagramSocket(_port);
 
@@ -32,7 +32,7 @@
     }
   }
 
-  public void runConnect() {
+  protected void runConnect() {
     try {
       _socket=new DatagramSocket(_port);
 
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/UDPVisionListener.java ./tools/mon/org/tekkotsu/mon/UDPVisionListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/UDPVisionListener.java	Tue Sep 28 18:12:38 2004
+++ ./tools/mon/org/tekkotsu/mon/UDPVisionListener.java	Fri Nov 12 17:07:40 2004
@@ -358,6 +358,7 @@
 					System.err.println("Unrecognized type: "+type);
 					break;
 				}
+        fireConnected();
 				format=readInt(in);
 				if(!_isConnected) break; //System.out.println("Got format="+format);
 				compression=readInt(in);
@@ -493,9 +494,14 @@
 				}
 				fireVisionUpdate();
 			}
-		} catch (Exception ex) { }
+		} catch (Exception ex) {
+    } finally {
+      fireDisconnected();
+    }
 		
+		try { mysock.close(); } catch (Exception ex) { }
 		_isConnected=false;
+		fireVisionUpdate();
 	}
 	
 	public byte[] getData() {
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/VisionGUI.java ./tools/mon/org/tekkotsu/mon/VisionGUI.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/VisionGUI.java	Tue Sep 28 14:56:12 2004
+++ ./tools/mon/org/tekkotsu/mon/VisionGUI.java	Tue Nov  2 00:23:41 2004
@@ -70,7 +70,7 @@
 				return "";
 		}
 		public String fpsReport() {
-				if(connected) {
+				if(connected && gui.mspf>.001) {
 					int rnd=(int)(10000/gui.mspf);
 					return rnd/10.0f+" fps";
 				} else
@@ -295,7 +295,7 @@
 			tmp2.add(Box.createHorizontalStrut(strutsize));
 			{
 				Box tmp3=Box.createVerticalBox();
-				if(isRaw) {
+				if(!isRLE) {
 					Box tmp4=Box.createHorizontalBox();
 					ButtonGroup group=new ButtonGroup();
 					JRadioButton tmpRad;
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/VisionListener.java ./tools/mon/org/tekkotsu/mon/VisionListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/VisionListener.java	Tue Sep 28 14:56:12 2004
+++ ./tools/mon/org/tekkotsu/mon/VisionListener.java	Fri Nov 12 17:07:40 2004
@@ -34,8 +34,12 @@
 	static int defRawPort=10011;
 	static int defRLEPort=10012;
 
-	void addListener(VisionUpdatedListener l);
-	void removeListener(VisionUpdatedListener l);
+	public void addListener(VisionUpdatedListener l);
+	public void removeListener(VisionUpdatedListener l);
+
+	void addConnectionListener(Listener.ConnectionListener listener);
+	void removeConnectionListener(Listener.ConnectionListener listener);
+
 	void fireVisionUpdate();
 	public boolean isConnected();
 
@@ -64,9 +68,9 @@
 	public void startThread();
 	public void kill();
 	public void run();
-	public void runServer();
-	public void runConnect();
 	public void close();
 	public void setPort(int port);
 	public void setHostPort(String host, int port);
+
+	public long getBytesRead(); 
 }
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/WM2DMListener.java ./tools/mon/org/tekkotsu/mon/WM2DMListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/WM2DMListener.java	Wed Oct  1 22:08:08 2003
+++ ./tools/mon/org/tekkotsu/mon/WM2DMListener.java	Fri Nov 12 17:07:40 2004
@@ -21,6 +21,7 @@
     try {
       // CONNECT
       InputStream in=socket.getInputStream();
+      fireConnected();
       // READ FOREVER
       for(;;) {
 	// read in all WM2 data
@@ -39,7 +40,10 @@
 	  _updatedFlag = true;
 	}
       }
-    } catch(Exception e) {}
+    } catch(Exception e) {
+    } finally {
+      fireDisconnected();
+    }
 
     // DISCONNECT
     try { socket.close(); } catch(Exception e) {}
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/WM2FSListener.java ./tools/mon/org/tekkotsu/mon/WM2FSListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/WM2FSListener.java	Wed Oct  1 22:08:08 2003
+++ ./tools/mon/org/tekkotsu/mon/WM2FSListener.java	Fri Nov 12 17:07:40 2004
@@ -21,6 +21,7 @@
     try {
       // CONNECT
       InputStream in=socket.getInputStream();
+      fireConnected();
       // READ FOREVER
       for(;;) {
 	// read in all particle positions
@@ -54,7 +55,10 @@
 	  _updatedFlag = true;
 	}
       }
-    } catch(Exception e) {}
+    } catch(Exception e) {
+    } finally {
+      fireDisconnected();
+    }
 
     // DISCONNECT
     try { socket.close(); } catch(Exception e) {}
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/WM2HMListener.java ./tools/mon/org/tekkotsu/mon/WM2HMListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/WM2HMListener.java	Wed Oct  1 22:08:08 2003
+++ ./tools/mon/org/tekkotsu/mon/WM2HMListener.java	Fri Nov 12 17:07:40 2004
@@ -21,6 +21,7 @@
     try {
       // CONNECT
       InputStream in=socket.getInputStream();
+      fireConnected();
       // READ FOREVER
       for(;;) {
 	// read in all WM2 data
@@ -40,7 +41,10 @@
 	  _updatedFlag = true;
 	}
       }
-    } catch(Exception e) {}
+    } catch(Exception e) {
+    } finally {
+      fireDisconnected();
+    }
 
     // DISCONNECT
     try { socket.close(); } catch(Exception e) {}
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/WatchableMemoryListener.java ./tools/mon/org/tekkotsu/mon/WatchableMemoryListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/WatchableMemoryListener.java	Fri Apr 16 16:23:03 2004
+++ ./tools/mon/org/tekkotsu/mon/WatchableMemoryListener.java	Fri Nov 12 17:07:40 2004
@@ -14,6 +14,7 @@
     try {
       InputStream in=socket.getInputStream();
       _out = new PrintStream(socket.getOutputStream());
+      fireConnected();
       while (true) {
         int format=readInt(in);
         if (format!=PACKET_WMCLASS)
@@ -28,7 +29,10 @@
         synchronized(changesList) { changesList.add(wmvar); }
 				//System.out.println(var_type+" "+var_name);
       }
-    } catch (Exception ex) { if((SocketException)ex==null) ex.printStackTrace(); }
+    } catch (Exception ex) { if((SocketException)ex==null) ex.printStackTrace();
+    } finally {
+      fireDisconnected();
+    }
 
     try { socket.close(); } catch (Exception ex) { }
     _isConnected=false;
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/WorldStateJointsListener.java ./tools/mon/org/tekkotsu/mon/WorldStateJointsListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/WorldStateJointsListener.java	Fri Apr 16 01:51:29 2004
+++ ./tools/mon/org/tekkotsu/mon/WorldStateJointsListener.java	Fri Nov 12 17:07:40 2004
@@ -14,6 +14,7 @@
     _outd=new Joints();
     try {
       InputStream in=socket.getInputStream();
+      fireConnected();
       while (true) {
         _data.timestamp=readInt(in);
 				//System.out.println("time="+_data.timestamp);
@@ -43,7 +44,10 @@
           _updatedFlag=true;
         }
       }
-    } catch (Exception ex) { }
+    } catch (Exception ex) {
+    } finally {
+      fireDisconnected();
+    }
 
     try { socket.close(); } catch (Exception ex) { }
     _isConnected=false;
diff -urdN ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/WorldStatePIDsListener.java ./tools/mon/org/tekkotsu/mon/WorldStatePIDsListener.java
--- ../Tekkotsu_2.2/tools/mon/org/tekkotsu/mon/WorldStatePIDsListener.java	Wed Oct  1 22:08:08 2003
+++ ./tools/mon/org/tekkotsu/mon/WorldStatePIDsListener.java	Fri Nov 12 17:07:40 2004
@@ -14,6 +14,7 @@
     _outd=new PIDs();
     try {
       InputStream in=socket.getInputStream();
+      fireConnected();
       while (true) {
         _data.timestamp=readInt(in);
         for (int i=0; i<18; i++)
@@ -30,7 +31,10 @@
           _updatedFlag=true;
         }
       }
-    } catch (Exception ex) { }
+    } catch (Exception ex) {
+    } finally {
+      fireDisconnected();
+    }
 
     try { socket.close(); } catch (Exception ex) { }
     _isConnected=false;
diff -urdN ../Tekkotsu_2.2/tools/safemot/Makefile ./tools/safemot/Makefile
--- ../Tekkotsu_2.2/tools/safemot/Makefile	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/Makefile	Tue Nov  9 17:15:03 2004
@@ -0,0 +1,84 @@
+
+
+#if you want to change the target model, it is recommended
+#to set the TEKKOTSU_TARGET_MODEL environment variable
+
+.PHONY: all tk_bd
+
+# We use this TK_RT instead of TEKKOTSU_ROOT so things will
+# still work if TEKKOTSU_ROOT is a relative path
+TK_RT:=../..
+
+TEMPLATE_PROJECT:=$(TK_RT)/project
+TEKKOTSU_ENVIRONMENT_CONFIGURATION?=$(TEMPLATE_PROJECT)/Environment.conf
+TEKKOTSU_TARGET_PLATFORM = PLATFORM_LOCAL
+include $(TEKKOTSU_ENVIRONMENT_CONFIGURATION)
+FILTERSYSWARN:=$(patsubst $(TEKKOTSU_ROOT)/%,$(TK_RT)/%,$(FILTERSYSWARN))
+COLORFILT:=$(patsubst $(TEKKOTSU_ROOT)/%,$(TK_RT)/%,$(COLORFILT))
+
+BIN:=safemot_$(shell echo $(patsubst TGT_%,%,$(TEKKOTSU_TARGET_MODEL)) | tr [:upper:] [:lower:])
+
+SRCSUFFIX=.cc
+
+PROJ_OBJ:= \
+	$(PROJ_BD)/safemot.o \
+
+TK_TGTS:= \
+	$(TK_BD)/Events/EventBase.o \
+	$(TK_BD)/Events/EventRouter.o \
+	$(TK_BD)/Motion/MotionManager.o \
+	$(TK_BD)/Motion/MotionSequenceMC.o \
+	$(TK_BD)/Motion/PostureEngine.o \
+	$(TK_BD)/Motion/Kinematics.o \
+	$(TK_BD)/Shared/get_time.o \
+	$(TK_BD)/Shared/LoadSave.o \
+	$(TK_BD)/Shared/Config.o \
+	$(TK_BD)/Shared/Profiler.o \
+	$(TK_BD)/Shared/TimeET.o \
+	$(TK_BD)/Shared/WorldState.o \
+	$(TK_BD)/Wireless/Socket.o \
+	$(TK_BD)/Shared/newmat/libnewmat.a \
+	$(TK_BD)/Motion/roboop/libroboop.a \
+
+LIBS:= $(TK_BD)/Motion/roboop/libroboop.a $(TK_BD)/Shared/newmat/libnewmat.a
+
+DEPENDS:=$(PROJ_OBJ:.o=.d)
+
+CXXFLAGS=-g -Wall -O2 \
+         -I$(TK_RT) \
+         -D$(TEKKOTSU_TARGET_PLATFORM) -D$(TEKKOTSU_TARGET_MODEL) 
+
+
+all: $(BIN)
+
+$(BIN): tk_bd $(PROJ_OBJ)
+	@echo "Linking $@..."
+	@g++ $(PROJ_OBJ) $(patsubst $(TEKKOTSU_ROOT)/%,$(TK_RT)/%,$(TK_TGTS) $(LIBS)) -o $@
+
+ifeq ($(findstring clean,$(MAKECMDGOALS)),)
+-include $(DEPENDS)
+endif
+
+%.d :
+	@mkdir -p $(dir $@)
+	@src=$(patsubst %.d,%.cc,$(patsubst $(PROJ_BD)/%,%,$@)); \
+	echo "$@..." | sed 's@.*$(TGT_BD)/@Generating @'; \
+	$(CXX) $(CXXFLAGS) -MP -MG -MT "$@" -MT "$(@:.d=.o)" -MM "$$src" > $@
+
+tk_bd:
+	@echo "Making Tekkotsu files..."
+	@export TEKKOTSU_TARGET_PLATFORM=PLATFORM_LOCAL && $(MAKE) -C $(TEMPLATE_PROJECT) $(TK_TGTS)
+
+
+%.o:
+	@mkdir -p $(dir $@)
+	@src=$(patsubst %.o,%$(SRCSUFFIX),$(patsubst $(PROJ_BD)/%,%,$@)); \
+	echo "Compiling $$src..."; \
+	$(CXX) $(CXXFLAGS) -o $@ -c $$src > $*.log 2>&1; \
+	retval=$$?; \
+	cat $*.log | $(FILTERSYSWARN) | $(COLORFILT) | $(TEKKOTSU_LOGVIEW); \
+	test $$retval -eq 0; \
+
+clean:
+	rm -f $(BIN) $(PROJ_OBJ) $(DEPENDS) *~
+
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/dance.mot ./tools/safemot/from_cmpack02/dance.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/dance.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/dance.mot	Fri May  2 00:57:52 2003
@@ -0,0 +1,148 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	300
+LFr:rotor	-0.253956
+LFr:elvtr	-0.131986
+LFr:knee~	0.470636
+RFr:rotor	-0.257699
+RFr:elvtr	-0.139626
+RFr:knee~	0.478557
+LBk:rotor	-1.16085
+LBk:elvtr	-0.168714
+LBk:knee~	2.27771
+RBk:rotor	-1.16723
+RBk:elvtr	-0.162013
+RBk:knee~	2.27329
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	300
+LFr:rotor	-0.263956
+LFr:elvtr	-0.141986
+LFr:knee~	0.484838
+RFr:rotor	-0.269413
+RFr:elvtr	-0.145443
+RFr:knee~	0.484187
+LBk:rotor	-1.16639
+LBk:elvtr	-0.168714
+LBk:knee~	2.27196
+RBk:rotor	-1.1657
+RBk:elvtr	-0.162013
+RBk:knee~	2.27489
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	300
+LFr:rotor	-0.853081
+LFr:elvtr	-0.133808
+LFr:knee~	0.237025
+RFr:rotor	-0.855093
+RFr:elvtr	-0.139626
+RFr:knee~	0.230833
+LBk:rotor	-1.74301
+LBk:elvtr	0.412529
+LBk:knee~	2.56563
+RBk:rotor	-1.74534
+RBk:elvtr	0.412627
+RBk:knee~	2.56563
+NECK:tilt	-0.3
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	-0.848842
+LFr:elvtr	-0.133808
+LFr:knee~	0.231227
+RFr:rotor	-0.849236
+RFr:elvtr	-0.139626
+RFr:knee~	0.230833
+LBk:rotor	-1.74747
+LBk:elvtr	0.418229
+LBk:knee~	2.56563
+RBk:rotor	-1.74415
+RBk:elvtr	0.415625
+RBk:knee~	2.56563
+NECK:tilt	-0.5
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	-1.24884
+LFr:elvtr	-0.193808
+LFr:knee~	0.231227
+RFr:rotor	-1.24924
+RFr:elvtr	-0.199626
+RFr:knee~	0.230833
+LBk:rotor	-0.851861
+LBk:elvtr	0.215208
+LBk:knee~	1.75089
+RBk:rotor	-0.851249
+RBk:elvtr	0.214532
+RBk:knee~	1.75006
+NECK:tilt	-0.5
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	2.004
+LFr:elvtr	-0.005817
+LFr:knee~	0.007958
+RFr:rotor	2.00571
+RFr:elvtr	-0.003084
+RFr:knee~	0.005634
+LBk:rotor	-0.851861
+LBk:elvtr	0.215208
+LBk:knee~	1.75089
+RBk:rotor	-0.851249
+RBk:elvtr	0.214532
+RBk:knee~	1.75006
+NECK:tilt	-0.5
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	0.05999
+LFr:elvtr	0.005817
+LFr:knee~	2.60796
+RFr:rotor	0.055711
+RFr:elvtr	0.003084
+RFr:knee~	2.60563
+LBk:rotor	-0.851861
+LBk:elvtr	0.215208
+LBk:knee~	1.75089
+RBk:rotor	-0.851249
+RBk:elvtr	0.214532
+RBk:knee~	1.75006
+NECK:tilt	-0.5
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	2.004
+LFr:elvtr	-0.005817
+LFr:knee~	0.007958
+RFr:rotor	2.00571
+RFr:elvtr	-0.003084
+RFr:knee~	0.005634
+LBk:rotor	-0.851861
+LBk:elvtr	0.215208
+LBk:knee~	1.75089
+RBk:rotor	-0.851249
+RBk:elvtr	0.214532
+RBk:knee~	1.75006
+NECK:tilt	-0.5
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	0
+LFr:elvtr	-0
+LFr:knee~	2.6
+RFr:rotor	0
+RFr:elvtr	-0
+RFr:knee~	2.6
+LBk:rotor	-0.85
+LBk:elvtr	0.21
+LBk:knee~	1.75
+RBk:rotor	-0.85
+RBk:elvtr	0.21
+RBk:knee~	1.75
+NECK:tilt	-0.5
+NECK:pan~	0
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/gu_back.mot ./tools/safemot/from_cmpack02/gu_back.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/gu_back.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/gu_back.mot	Fri May  2 00:57:52 2003
@@ -0,0 +1,52 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	500
+LFr:rotor	0
+LFr:elvtr	0
+LFr:knee~	0
+RFr:rotor	0
+RFr:elvtr	0
+RFr:knee~	0
+LBk:rotor	0
+LBk:elvtr	0
+LBk:knee~	0
+RBk:rotor	0
+RBk:elvtr	0
+RBk:knee~	0
+NECK:tilt	-1.5708
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	0
+LFr:elvtr	0
+LFr:knee~	0
+RFr:rotor	0
+RFr:elvtr	0
+RFr:knee~	0
+LBk:rotor	-1.8
+LBk:elvtr	0
+LBk:knee~	2.5
+RBk:rotor	-1.8
+RBk:elvtr	0
+RBk:knee~	2.5
+NECK:tilt	-1.5708
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	1
+LFr:elvtr	0
+LFr:knee~	0.5
+RFr:rotor	1
+RFr:elvtr	0
+RFr:knee~	0.5
+LBk:rotor	-1.2
+LBk:elvtr	0
+LBk:knee~	2.5
+RBk:rotor	-1.2
+RBk:elvtr	0
+RBk:knee~	2.5
+NECK:tilt	-1.5708
+NECK:pan~	0
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/gu_front.mot ./tools/safemot/from_cmpack02/gu_front.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/gu_front.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/gu_front.mot	Fri May  2 00:57:52 2003
@@ -0,0 +1,84 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	500
+LFr:rotor	0
+LFr:elvtr	0
+LFr:knee~	0
+RFr:rotor	0
+RFr:elvtr	0
+RFr:knee~	0
+LBk:rotor	0
+LBk:elvtr	0
+LBk:knee~	0
+RBk:rotor	0
+RBk:elvtr	0
+RBk:knee~	0
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	0
+LFr:elvtr	1.6
+LFr:knee~	0
+RFr:rotor	0
+RFr:elvtr	1.6
+RFr:knee~	0
+LBk:rotor	1
+LBk:elvtr	0
+LBk:knee~	2.5
+RBk:rotor	1
+RBk:elvtr	0
+RBk:knee~	2.5
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	1.8
+LFr:elvtr	1.6
+LFr:knee~	0
+RFr:rotor	1.8
+RFr:elvtr	1.6
+RFr:knee~	0
+LBk:rotor	-1.8
+LBk:elvtr	0
+LBk:knee~	2.5
+RBk:rotor	-1.8
+RBk:elvtr	0
+RBk:knee~	2.5
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	1.8
+LFr:elvtr	0
+LFr:knee~	2.5
+RFr:rotor	1.8
+RFr:elvtr	0
+RFr:knee~	2.5
+LBk:rotor	-1.8
+LBk:elvtr	0
+LBk:knee~	2.5
+RBk:rotor	-1.8
+RBk:elvtr	0
+RBk:knee~	2.5
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	1
+LFr:elvtr	0
+LFr:knee~	0.5
+RFr:rotor	1
+RFr:elvtr	0
+RFr:knee~	0.5
+LBk:rotor	-1.2
+LBk:elvtr	0
+LBk:knee~	2.5
+RBk:rotor	-1.2
+RBk:elvtr	0
+RBk:knee~	2.5
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/gu_side.mot ./tools/safemot/from_cmpack02/gu_side.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/gu_side.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/gu_side.mot	Fri May  2 00:57:53 2003
@@ -0,0 +1,68 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	500
+LFr:rotor	0
+LFr:elvtr	0
+LFr:knee~	0
+RFr:rotor	0
+RFr:elvtr	0
+RFr:knee~	0
+LBk:rotor	0
+LBk:elvtr	0
+LBk:knee~	0
+RBk:rotor	0
+RBk:elvtr	0
+RBk:knee~	0
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	300
+LFr:rotor	2
+LFr:elvtr	0
+LFr:knee~	2.5
+RFr:rotor	2
+RFr:elvtr	0
+RFr:knee~	2.5
+LBk:rotor	2
+LBk:elvtr	0
+LBk:knee~	2.5
+RBk:rotor	2
+RBk:elvtr	0
+RBk:knee~	2.5
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	700
+LFr:rotor	2
+LFr:elvtr	1.6
+LFr:knee~	2.5
+RFr:rotor	2
+RFr:elvtr	1.6
+RFr:knee~	2.5
+LBk:rotor	2
+LBk:elvtr	1.6
+LBk:knee~	2.5
+RBk:rotor	2
+RBk:elvtr	1.6
+RBk:knee~	2.5
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	1
+LFr:elvtr	0
+LFr:knee~	0.5
+RFr:rotor	1
+RFr:elvtr	0
+RFr:knee~	0.5
+LBk:rotor	-1.2
+LBk:elvtr	0
+LBk:knee~	2.5
+RBk:rotor	-1.2
+RBk:elvtr	0
+RBk:knee~	2.5
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_bump.mot ./tools/safemot/from_cmpack02/k_bump.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_bump.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/k_bump.mot	Fri May  2 00:57:53 2003
@@ -0,0 +1,68 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	200
+LFr:rotor	0.185475
+LFr:elvtr	0.00453314
+LFr:knee~	1.80106
+RFr:rotor	0.185475
+RFr:elvtr	0.00453314
+RFr:knee~	1.80106
+LBk:rotor	-1.15181
+LBk:elvtr	0.255151
+LBk:knee~	1.84981
+RBk:rotor	-1.15181
+RBk:elvtr	0.255151
+RBk:knee~	1.84981
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	100
+LFr:rotor	0.735959
+LFr:elvtr	0.00266154
+LFr:knee~	1.05702
+RFr:rotor	0.735959
+RFr:elvtr	0.00266154
+RFr:knee~	1.05702
+LBk:rotor	-1.15181
+LBk:elvtr	0.255151
+LBk:knee~	1.84981
+RBk:rotor	-1.15181
+RBk:elvtr	0.255151
+RBk:knee~	1.84981
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	200
+LFr:rotor	-0.785992
+LFr:elvtr	0.00638608
+LFr:knee~	2.07946
+RFr:rotor	-0.785992
+RFr:elvtr	0.00638608
+RFr:knee~	2.07946
+LBk:rotor	0.101941
+LBk:elvtr	0.153667
+LBk:knee~	1.3203
+RBk:rotor	0.101941
+RBk:elvtr	0.153667
+RBk:knee~	1.3203
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	400
+LFr:rotor	-0.785992
+LFr:elvtr	0.00638608
+LFr:knee~	2.07946
+RFr:rotor	-0.785992
+RFr:elvtr	0.00638608
+RFr:knee~	2.07946
+LBk:rotor	0.101941
+LBk:elvtr	0.153667
+LBk:knee~	1.3203
+RBk:rotor	0.101941
+RBk:elvtr	0.153667
+RBk:knee~	1.3203
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_diag.mot ./tools/safemot/from_cmpack02/k_diag.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_diag.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/k_diag.mot	Fri May  2 00:57:53 2003
@@ -0,0 +1,52 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	300
+LFr:rotor	-0.145629
+LFr:elvtr	0.405273
+LFr:knee~	1.82849
+RFr:rotor	0.352175
+RFr:elvtr	0.264745
+RFr:knee~	1.34238
+LBk:rotor	-0.865394
+LBk:elvtr	0.172658
+LBk:knee~	1.47472
+RBk:rotor	-0.865394
+RBk:elvtr	0.172658
+RBk:knee~	1.47472
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	200
+LFr:rotor	-1.14237
+LFr:elvtr	1.56166
+LFr:knee~	1.96605
+RFr:rotor	-0.303583
+RFr:elvtr	-0.158102
+RFr:knee~	2.14622
+LBk:rotor	-0.352242
+LBk:elvtr	0.417006
+LBk:knee~	1.0496
+RBk:rotor	-0.478325
+RBk:elvtr	-0.170265
+RBk:knee~	1.34195
+NECK:tilt	-1.2
+NECK:pan~	-1.5
+NECK:roll	0
+delay	200
+LFr:rotor	0
+LFr:elvtr	0.5
+LFr:knee~	0
+RFr:rotor	-0.389073
+RFr:elvtr	1.01684
+RFr:knee~	1.77986
+LBk:rotor	-0.478325
+LBk:elvtr	-0.170265
+LBk:knee~	1.34195
+RBk:rotor	-0.352242
+RBk:elvtr	0.417006
+RBk:knee~	1.0496
+NECK:tilt	-1.2
+NECK:pan~	1.5
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_dive.mot ./tools/safemot/from_cmpack02/k_dive.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_dive.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/k_dive.mot	Fri May  2 00:57:53 2003
@@ -0,0 +1,196 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	200
+LFr:rotor	0.3
+LFr:elvtr	0.4
+LFr:knee~	1.6
+RFr:rotor	0.3
+RFr:elvtr	0.4
+RFr:knee~	1.6
+LBk:rotor	-1.13
+LBk:elvtr	0.14
+LBk:knee~	1.74
+RBk:rotor	-1.13
+RBk:elvtr	0.14
+RBk:knee~	1.74
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	200
+LFr:rotor	1.03
+LFr:elvtr	0.09
+LFr:knee~	0.9
+RFr:rotor	1.03
+RFr:elvtr	0.09
+RFr:knee~	0.9
+LBk:rotor	-1.17
+LBk:elvtr	0.14
+LBk:knee~	1.74
+RBk:rotor	-1.17
+RBk:elvtr	0.14
+RBk:knee~	1.74
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	200
+LFr:rotor	1.53
+LFr:elvtr	-0.11
+LFr:knee~	0.72
+RFr:rotor	1.53
+RFr:elvtr	-0.11
+RFr:knee~	0.72
+LBk:rotor	-1.45
+LBk:elvtr	0.54
+LBk:knee~	2.35
+RBk:rotor	-1.45
+RBk:elvtr	0.54
+RBk:knee~	2.35
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	300
+LFr:rotor	0.2
+LFr:elvtr	0.4
+LFr:knee~	1.5
+RFr:rotor	0.2
+RFr:elvtr	0.4
+RFr:knee~	1.5
+LBk:rotor	-1.13
+LBk:elvtr	0.14
+LBk:knee~	1.74
+RBk:rotor	-1.13
+RBk:elvtr	0.14
+RBk:knee~	1.74
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	100
+LFr:rotor	0.2
+LFr:elvtr	0.15
+LFr:knee~	0
+RFr:rotor	0.2
+RFr:elvtr	0.15
+RFr:knee~	0
+LBk:rotor	-0.2
+LBk:elvtr	0.5
+LBk:knee~	0.2
+RBk:rotor	-0.2
+RBk:elvtr	0.5
+RBk:knee~	0.2
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	50
+LFr:rotor	0.2
+LFr:elvtr	0.15
+LFr:knee~	0
+RFr:rotor	0.2
+RFr:elvtr	0.15
+RFr:knee~	0
+LBk:rotor	-0.2
+LBk:elvtr	0.5
+LBk:knee~	0.2
+RBk:rotor	-0.2
+RBk:elvtr	0.5
+RBk:knee~	0.2
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	100
+LFr:rotor	0
+LFr:elvtr	0.15
+LFr:knee~	0
+RFr:rotor	0
+RFr:elvtr	0.15
+RFr:knee~	0
+LBk:rotor	0
+LBk:elvtr	0.5
+LBk:knee~	1.5
+RBk:rotor	0
+RBk:elvtr	0.5
+RBk:knee~	1.5
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	200
+LFr:rotor	-1.2
+LFr:elvtr	0.5
+LFr:knee~	0
+RFr:rotor	-1.2
+RFr:elvtr	0.5
+RFr:knee~	0
+LBk:rotor	1.2
+LBk:elvtr	0.5
+LBk:knee~	1.5
+RBk:rotor	1.2
+RBk:elvtr	0.5
+RBk:knee~	1.5
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	100
+LFr:rotor	-1.2
+LFr:elvtr	0.5
+LFr:knee~	0
+RFr:rotor	-1.2
+RFr:elvtr	0.5
+RFr:knee~	0
+LBk:rotor	1.2
+LBk:elvtr	0.5
+LBk:knee~	1.5
+RBk:rotor	1.2
+RBk:elvtr	0.5
+RBk:knee~	1.5
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	300
+LFr:rotor	0
+LFr:elvtr	1.5
+LFr:knee~	0
+RFr:rotor	0
+RFr:elvtr	1.5
+RFr:knee~	0
+LBk:rotor	0
+LBk:elvtr	1.5
+LBk:knee~	1.5
+RBk:rotor	0
+RBk:elvtr	1.5
+RBk:knee~	1.5
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	100
+LFr:rotor	0
+LFr:elvtr	1.5
+LFr:knee~	1.5
+RFr:rotor	0
+RFr:elvtr	1.5
+RFr:knee~	1.5
+LBk:rotor	0
+LBk:elvtr	1.5
+LBk:knee~	1.5
+RBk:rotor	0
+RBk:elvtr	1.5
+RBk:knee~	1.5
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	500
+LFr:rotor	0
+LFr:elvtr	1.5
+LFr:knee~	1.5
+RFr:rotor	0
+RFr:elvtr	1.5
+RFr:knee~	1.5
+LBk:rotor	0
+LBk:elvtr	1.5
+LBk:knee~	1.5
+RBk:rotor	0
+RBk:elvtr	1.5
+RBk:knee~	1.5
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_fwd.mot ./tools/safemot/from_cmpack02/k_fwd.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_fwd.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/k_fwd.mot	Fri May  2 00:57:53 2003
@@ -0,0 +1,132 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	200
+LFr:rotor	1
+LFr:elvtr	-0.2
+LFr:knee~	1
+RFr:rotor	1
+RFr:elvtr	-0.2
+RFr:knee~	1
+LBk:rotor	-0.865374
+LBk:elvtr	-0.191986
+LBk:knee~	0.433335
+RBk:rotor	-0.865374
+RBk:elvtr	-0.191986
+RBk:knee~	0.433335
+NECK:tilt	-0.3
+NECK:pan~	0
+NECK:roll	0
+delay	200
+LFr:rotor	1
+LFr:elvtr	-0.2
+LFr:knee~	0.5
+RFr:rotor	1
+RFr:elvtr	-0.2
+RFr:knee~	0.5
+LBk:rotor	-2
+LBk:elvtr	0.5
+LBk:knee~	2.5
+RBk:rotor	-2
+RBk:elvtr	0.5
+RBk:knee~	2.5
+NECK:tilt	-0.5
+NECK:pan~	0
+NECK:roll	0
+delay	100
+LFr:rotor	1
+LFr:elvtr	0.1
+LFr:knee~	0.5
+RFr:rotor	1
+RFr:elvtr	0.1
+RFr:knee~	0.5
+LBk:rotor	-2
+LBk:elvtr	0.5
+LBk:knee~	2.5
+RBk:rotor	-2
+RBk:elvtr	0.5
+RBk:knee~	2.5
+NECK:tilt	-0.5
+NECK:pan~	0
+NECK:roll	0
+delay	300
+LFr:rotor	2.1
+LFr:elvtr	0.1
+LFr:knee~	1.6
+RFr:rotor	2.1
+RFr:elvtr	0.1
+RFr:knee~	1.6
+LBk:rotor	-2
+LBk:elvtr	0.5
+LBk:knee~	2.5
+RBk:rotor	-2
+RBk:elvtr	0.5
+RBk:knee~	2.5
+NECK:tilt	-0.5
+NECK:pan~	0
+NECK:roll	0
+delay	100
+LFr:rotor	2.1
+LFr:elvtr	-0.3
+LFr:knee~	1.6
+RFr:rotor	2.1
+RFr:elvtr	-0.3
+RFr:knee~	1.6
+LBk:rotor	-2
+LBk:elvtr	0.5
+LBk:knee~	2.5
+RBk:rotor	-2
+RBk:elvtr	0.5
+RBk:knee~	2.5
+NECK:tilt	0.2
+NECK:pan~	0
+NECK:roll	0
+delay	100
+LFr:rotor	1.5
+LFr:elvtr	-0.3
+LFr:knee~	1.6
+RFr:rotor	1.5
+RFr:elvtr	-0.3
+RFr:knee~	1.6
+LBk:rotor	-1
+LBk:elvtr	0.5
+LBk:knee~	1.5
+RBk:rotor	-1
+RBk:elvtr	0.5
+RBk:knee~	1.5
+NECK:tilt	0.2
+NECK:pan~	0
+NECK:roll	0
+delay	150
+LFr:rotor	1
+LFr:elvtr	-0.3
+LFr:knee~	0
+RFr:rotor	1
+RFr:elvtr	-0.3
+RFr:knee~	0
+LBk:rotor	-1
+LBk:elvtr	0.5
+LBk:knee~	1.5
+RBk:rotor	-1
+RBk:elvtr	0.5
+RBk:knee~	1.5
+NECK:tilt	0.2
+NECK:pan~	0
+NECK:roll	0
+delay	250
+LFr:rotor	1
+LFr:elvtr	-0.2
+LFr:knee~	1
+RFr:rotor	1
+RFr:elvtr	-0.2
+RFr:knee~	1
+LBk:rotor	-1
+LBk:elvtr	-0.1
+LBk:knee~	1.5
+RBk:rotor	-1
+RBk:elvtr	-0.1
+RBk:knee~	1.5
+NECK:tilt	0.2
+NECK:pan~	0
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_grab.mot ./tools/safemot/from_cmpack02/k_grab.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_grab.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/k_grab.mot	Fri May  2 00:57:53 2003
@@ -0,0 +1,212 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	500
+LFr:rotor	1.2
+LFr:elvtr	-0.2
+LFr:knee~	0.5
+RFr:rotor	1.2
+RFr:elvtr	-0.2
+RFr:knee~	0.5
+LBk:rotor	1.2
+LBk:elvtr	1
+LBk:knee~	0.5
+RBk:rotor	1.2
+RBk:elvtr	1
+RBk:knee~	0.5
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	1.2
+LFr:elvtr	-0.2
+LFr:knee~	0.5
+RFr:rotor	1.2
+RFr:elvtr	-0.2
+RFr:knee~	0.5
+LBk:rotor	-2.5
+LBk:elvtr	1
+LBk:knee~	2.5
+RBk:rotor	-2.5
+RBk:elvtr	1
+RBk:knee~	2.5
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	100
+LFr:rotor	1.2
+LFr:elvtr	-0.2
+LFr:knee~	0.5
+RFr:rotor	1.2
+RFr:elvtr	-0.2
+RFr:knee~	0.5
+LBk:rotor	-1
+LBk:elvtr	0.5
+LBk:knee~	0
+RBk:rotor	-1
+RBk:elvtr	0.5
+RBk:knee~	0
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	400
+LFr:rotor	1.2
+LFr:elvtr	-0.2
+LFr:knee~	0.5
+RFr:rotor	1.2
+RFr:elvtr	-0.2
+RFr:knee~	0.5
+LBk:rotor	-1
+LBk:elvtr	0.5
+LBk:knee~	0
+RBk:rotor	-1
+RBk:elvtr	0.5
+RBk:knee~	0
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	200
+LFr:rotor	1.2
+LFr:elvtr	0.1
+LFr:knee~	0.5
+RFr:rotor	1.2
+RFr:elvtr	0.1
+RFr:knee~	0.5
+LBk:rotor	-1
+LBk:elvtr	0.5
+LBk:knee~	0
+RBk:rotor	-1
+RBk:elvtr	0.5
+RBk:knee~	0
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	100
+LFr:rotor	1.9
+LFr:elvtr	0.1
+LFr:knee~	-0.5
+RFr:rotor	1.9
+RFr:elvtr	0.1
+RFr:knee~	-0.5
+LBk:rotor	-1
+LBk:elvtr	0.5
+LBk:knee~	0
+RBk:rotor	-1
+RBk:elvtr	0.5
+RBk:knee~	0
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	800
+LFr:rotor	1.9
+LFr:elvtr	-0.2
+LFr:knee~	-0.5
+RFr:rotor	1.9
+RFr:elvtr	-0.2
+RFr:knee~	-0.5
+LBk:rotor	-1
+LBk:elvtr	0.5
+LBk:knee~	0
+RBk:rotor	-1
+RBk:elvtr	0.5
+RBk:knee~	0
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	400
+LFr:rotor	-0.5
+LFr:elvtr	-0.1
+LFr:knee~	0
+RFr:rotor	-0.5
+RFr:elvtr	-0.1
+RFr:knee~	0
+LBk:rotor	-0.2
+LBk:elvtr	0.5
+LBk:knee~	0
+RBk:rotor	-0.2
+RBk:elvtr	0.5
+RBk:knee~	0
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	100
+LFr:rotor	-0.5
+LFr:elvtr	-0.1
+LFr:knee~	0
+RFr:rotor	-0.5
+RFr:elvtr	-0.1
+RFr:knee~	0
+LBk:rotor	-0.2
+LBk:elvtr	0.5
+LBk:knee~	0
+RBk:rotor	-0.2
+RBk:elvtr	0.5
+RBk:knee~	0
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	500
+LFr:rotor	1.5
+LFr:elvtr	1
+LFr:knee~	1.5
+RFr:rotor	1.5
+RFr:elvtr	1
+RFr:knee~	1.5
+LBk:rotor	-2
+LBk:elvtr	0.5
+LBk:knee~	0
+RBk:rotor	-2
+RBk:elvtr	0.5
+RBk:knee~	0
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	500
+LFr:rotor	1
+LFr:elvtr	0
+LFr:knee~	0.5
+RFr:rotor	1
+RFr:elvtr	0
+RFr:knee~	0.5
+LBk:rotor	-2
+LBk:elvtr	0
+LBk:knee~	2.5
+RBk:rotor	-2
+RBk:elvtr	0
+RBk:knee~	2.5
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	1000
+LFr:rotor	1
+LFr:elvtr	0
+LFr:knee~	0.5
+RFr:rotor	1
+RFr:elvtr	0
+RFr:knee~	0.5
+LBk:rotor	-1
+LBk:elvtr	0
+LBk:knee~	2.5
+RBk:rotor	-1
+RBk:elvtr	0
+RBk:knee~	2.5
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+delay	1
+LFr:rotor	1
+LFr:elvtr	0
+LFr:knee~	0.5
+RFr:rotor	1
+RFr:elvtr	0
+RFr:knee~	0.5
+LBk:rotor	-1
+LBk:elvtr	0
+LBk:knee~	2.5
+RBk:rotor	-1
+RBk:elvtr	0
+RBk:knee~	2.5
+NECK:tilt	0.5
+NECK:pan~	1.5
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_head.mot ./tools/safemot/from_cmpack02/k_head.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_head.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/k_head.mot	Fri May  2 00:57:53 2003
@@ -0,0 +1,52 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	300
+LFr:rotor	-0.145629
+LFr:elvtr	0.405273
+LFr:knee~	1.82849
+RFr:rotor	0.352175
+RFr:elvtr	0.264745
+RFr:knee~	1.34238
+LBk:rotor	-0.865394
+LBk:elvtr	0.172658
+LBk:knee~	1.47472
+RBk:rotor	-0.865394
+RBk:elvtr	0.172658
+RBk:knee~	1.47472
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	200
+LFr:rotor	-1.14237
+LFr:elvtr	1.56166
+LFr:knee~	1.96605
+RFr:rotor	-0.303583
+RFr:elvtr	-0.158102
+RFr:knee~	2.14622
+LBk:rotor	-0.352242
+LBk:elvtr	0.417006
+LBk:knee~	1.0496
+RBk:rotor	-0.478325
+RBk:elvtr	-0.170265
+RBk:knee~	1.34195
+NECK:tilt	-1.2
+NECK:pan~	-1.5
+NECK:roll	0
+delay	200
+LFr:rotor	-0.743775
+LFr:elvtr	-0.191986
+LFr:knee~	2.33428
+RFr:rotor	-0.389073
+RFr:elvtr	1.01684
+RFr:knee~	1.77986
+LBk:rotor	-0.478325
+LBk:elvtr	-0.170265
+LBk:knee~	1.34195
+RBk:rotor	-0.352242
+RBk:elvtr	0.417006
+RBk:knee~	1.0496
+NECK:tilt	-1.2
+NECK:pan~	1.5
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_heads.mot ./tools/safemot/from_cmpack02/k_heads.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_heads.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/k_heads.mot	Fri May  2 00:57:53 2003
@@ -0,0 +1,52 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	300
+LFr:rotor	-0.145629
+LFr:elvtr	0.405273
+LFr:knee~	1.82849
+RFr:rotor	0.352175
+RFr:elvtr	0.264745
+RFr:knee~	1.34238
+LBk:rotor	-0.865394
+LBk:elvtr	0.172658
+LBk:knee~	1.47472
+RBk:rotor	-0.865394
+RBk:elvtr	0.172658
+RBk:knee~	1.47472
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	400
+LFr:rotor	-1.14237
+LFr:elvtr	1.56166
+LFr:knee~	1.96605
+RFr:rotor	-0.303583
+RFr:elvtr	-0.158102
+RFr:knee~	2.14622
+LBk:rotor	-0.352242
+LBk:elvtr	0.417006
+LBk:knee~	1.0496
+RBk:rotor	-0.478325
+RBk:elvtr	-0.170265
+RBk:knee~	1.34195
+NECK:tilt	-1.2
+NECK:pan~	-1.5
+NECK:roll	0
+delay	200
+LFr:rotor	-0.743775
+LFr:elvtr	-0.191986
+LFr:knee~	2.33428
+RFr:rotor	-0.389073
+RFr:elvtr	1.01684
+RFr:knee~	1.77986
+LBk:rotor	-0.478325
+LBk:elvtr	-0.170265
+LBk:knee~	1.34195
+RBk:rotor	-0.352242
+RBk:elvtr	0.417006
+RBk:knee~	1.0496
+NECK:tilt	-1.2
+NECK:pan~	1.5
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_hold.mot ./tools/safemot/from_cmpack02/k_hold.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_hold.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/k_hold.mot	Fri May  2 00:57:53 2003
@@ -0,0 +1,52 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	300
+LFr:rotor	0.6
+LFr:elvtr	-0.1
+LFr:knee~	1.57
+RFr:rotor	0.6
+RFr:elvtr	-0.1
+RFr:knee~	1.57
+LBk:rotor	-0.72
+LBk:elvtr	0.2
+LBk:knee~	1.48
+RBk:rotor	-0.72
+RBk:elvtr	0.2
+RBk:knee~	1.48
+NECK:tilt	0.349066
+NECK:pan~	1.5708
+NECK:roll	0
+delay	300
+LFr:rotor	0.6
+LFr:elvtr	-0.1
+LFr:knee~	1.57
+RFr:rotor	0.6
+RFr:elvtr	-0.1
+RFr:knee~	1.57
+LBk:rotor	-0.72
+LBk:elvtr	0.2
+LBk:knee~	1.48
+RBk:rotor	-0.72
+RBk:elvtr	0.2
+RBk:knee~	1.48
+NECK:tilt	0.349066
+NECK:pan~	0
+NECK:roll	0
+delay	300
+LFr:rotor	0.6
+LFr:elvtr	-0.1
+LFr:knee~	1.57
+RFr:rotor	0.6
+RFr:elvtr	-0.1
+RFr:knee~	1.57
+LBk:rotor	-0.72
+LBk:elvtr	0.2
+LBk:knee~	1.48
+RBk:rotor	-0.72
+RBk:elvtr	0.2
+RBk:knee~	1.48
+NECK:tilt	0.349066
+NECK:pan~	-1.5708
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_punch.mot ./tools/safemot/from_cmpack02/k_punch.mot
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/k_punch.mot	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/k_punch.mot	Fri May  2 00:57:53 2003
@@ -0,0 +1,100 @@
+#MSq
+# This file was generated from CMPack'02 and falls under their license (GPL)
+radians
+delay	500
+LFr:rotor	0.183246
+LFr:elvtr	0.556069
+LFr:knee~	1.36377
+RFr:rotor	0.0954882
+RFr:elvtr	0.00405851
+RFr:knee~	1.68938
+LBk:rotor	-0.805585
+LBk:elvtr	0.409881
+LBk:knee~	1.30206
+RBk:rotor	-0.870673
+RBk:elvtr	-0.110773
+RBk:knee~	1.49363
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	0
+LFr:elvtr	0
+LFr:knee~	2.5
+RFr:rotor	0.0954882
+RFr:elvtr	0.00405851
+RFr:knee~	1.68938
+LBk:rotor	-0.805585
+LBk:elvtr	0.409881
+LBk:knee~	1.30206
+RBk:rotor	-0.870673
+RBk:elvtr	-0.110773
+RBk:knee~	1.49363
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	2
+LFr:elvtr	0
+LFr:knee~	1
+RFr:rotor	0.0954882
+RFr:elvtr	0.00405851
+RFr:knee~	1.68938
+LBk:rotor	-0.805585
+LBk:elvtr	0.409881
+LBk:knee~	1.30206
+RBk:rotor	-0.870673
+RBk:elvtr	-0.110773
+RBk:knee~	1.49363
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	100
+LFr:rotor	2
+LFr:elvtr	0
+LFr:knee~	1
+RFr:rotor	0.0954882
+RFr:elvtr	0.00405851
+RFr:knee~	1.68938
+LBk:rotor	-0.805585
+LBk:elvtr	0.409881
+LBk:knee~	1.30206
+RBk:rotor	-0.870673
+RBk:elvtr	-0.110773
+RBk:knee~	1.49363
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	1
+LFr:elvtr	0
+LFr:knee~	1
+RFr:rotor	0.0954882
+RFr:elvtr	0.00405851
+RFr:knee~	1.68938
+LBk:rotor	-0.805585
+LBk:elvtr	0.409881
+LBk:knee~	1.30206
+RBk:rotor	-0.870673
+RBk:elvtr	-0.110773
+RBk:knee~	1.49363
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+delay	500
+LFr:rotor	0.108853
+LFr:elvtr	0.325006
+LFr:knee~	1.61054
+RFr:rotor	0.108853
+RFr:elvtr	0.325006
+RFr:knee~	1.61054
+LBk:rotor	-0.865394
+LBk:elvtr	0.172658
+LBk:knee~	1.47472
+RBk:rotor	-0.865394
+RBk:elvtr	0.172658
+RBk:knee~	1.47472
+NECK:tilt	0
+NECK:pan~	0
+NECK:roll	0
+#END
diff -urdN ../Tekkotsu_2.2/tools/safemot/from_cmpack02/readme.txt ./tools/safemot/from_cmpack02/readme.txt
--- ../Tekkotsu_2.2/tools/safemot/from_cmpack02/readme.txt	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/from_cmpack02/readme.txt	Fri Apr 16 16:23:09 2004
@@ -0,0 +1,33 @@
+The included motion files were converted from CMPack'02 files
+and fall under their license:
+
+See tools/convertmot for more information on conversion and the original
+binary files.
+
+  LICENSE:
+  =========================================================================
+    CMPack'02 Source Code Release for OPEN-R SDK v1.0
+    Copyright (C) 2002 Multirobot Lab [Project Head: Manuela Veloso]
+    School of Computer Science, Carnegie Mellon University
+  -------------------------------------------------------------------------
+    This software is distributed under the GNU General Public License,
+    version 2.  If you do not have a copy of this licence, visit
+    www.gnu.org, or write: Free Software Foundation, 59 Temple Place,
+    Suite 330 Boston, MA 02111-1307 USA.  This program is distributed
+    in the hope that it will be useful, but WITHOUT ANY WARRANTY,
+    including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  -------------------------------------------------------------------------
+    Additionally licensed to Sony Corporation under the following terms:
+
+    This software is provided by the copyright holders AS IS and any
+    express or implied warranties, including, but not limited to, the
+    implied warranties of merchantability and fitness for a particular
+    purpose are disclaimed.  In no event shall authors be liable for
+    any direct, indirect, incidental, special, exemplary, or consequential
+    damages (including, but not limited to, procurement of substitute
+    goods or services; loss of use, data, or profits; or business
+    interruption) however caused and on any theory of liability, whether
+    in contract, strict liability, or tort (including negligence or
+    otherwise) arising in any way out of the use of this software, even if
+    advised of the possibility of such damage.
+  =========================================================================
diff -urdN ../Tekkotsu_2.2/tools/safemot/safemot.cc ./tools/safemot/safemot.cc
--- ../Tekkotsu_2.2/tools/safemot/safemot.cc	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/safemot.cc	Mon Nov  8 16:48:19 2004
@@ -0,0 +1,118 @@
+#include <iostream>
+#include <stdio.h>
+#include <string>
+#include <algorithm>
+#include "Motion/DynamicMotionSequence.h"
+#include "Shared/Config.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+using namespace std;
+
+unsigned int simulator_time;
+
+int usage(unsigned int argc, const char** argv) {
+	const char* name;
+	if(strchr(argv[0],'/')!=NULL)
+		name=strrchr(argv[0],'/')+1;
+	else
+		name=argv[0];
+	cerr << "Usage:\t" << argv[0] << " [-rad ] [ -deg ] [ -safe <margin> ] <in-file> <out-file>" << endl;
+	cerr << "\t" << argv[0] << " [-rad ] [ -deg ] [ -safe <margin> ] <in-files> <out-directory>" << endl;
+	cerr << endl;
+	cerr << '`' <<name << "' will insert time between keyframes so that the resulting" << endl;
+	cerr << "motion can be played back without missing frames or violating Sony's joint" << endl;
+	cerr << "speed guidelines." << endl;
+	cerr << endl;
+	cerr << "The first usage converts one single file.  With the second usage, `" << name << "'" << endl;
+	cerr << "expects the last argument to be the directory to store the converted files " << endl;
+	cerr << "into. (with the same name)" << endl;
+	cerr << endl;
+	cerr << "-deg will cause files to save using degrees.  Default is radians." << endl;
+	cerr << endl;
+	cerr << "-safe <margin> will add (or subtract) a safety margin.  The argument is the" << endl;
+	cerr << "percent of the published guideline to actually use.  Default is 1." << endl;
+	return 2;
+}
+
+bool compress=false;
+float margin=1;
+
+int main(unsigned int argc, const char** argv) {
+	if(argc<3)
+		return usage(argc,argv);
+	config=new Config("tekkotsu.cfg");
+	unsigned int used=1;
+	bool isRad=true;
+	while(used<argc) {
+		if(strcmp("-deg",argv[used])==0) {
+			used++;
+			isRad=false;
+			cout << "storing as degrees..." << endl;
+			continue;
+		}
+		if(strcmp("-rad",argv[used])==0) {
+			used++;
+			isRad=true;
+			cout << "storing as radians..." << endl;
+			continue;
+		}
+		if(strcmp("-compress",argv[used])==0) {
+			used++;
+			compress=true;
+			cout << "compression on..." << endl;
+			continue;
+		}
+		if(strcmp("-safe",argv[used])==0) {
+			used++;
+			char * end;
+			margin=strtod(argv[used],&end);
+			if(*end!='\0')
+				return usage(argc,argv);
+			used++;
+		}
+		break;
+	}
+	struct stat s;
+	int ret=stat(argv[argc-1],&s);
+	//cout << argv[argc-1] << ' ' << ret << ' ' << (void*)s.st_mode << ' ' << (void*)s.st_rdev << endl;
+	if(ret==0 && s.st_mode&S_IFDIR) {
+		for(unsigned int i=used; i<argc-1; i++) {
+			string path=argv[argc-1];
+			if(strchr(argv[i],'/')!=NULL)
+				path+=strrchr(argv[i],'/');
+			else {
+				path+="/";
+				path+=argv[i];
+			}
+			DynamicMotionSequence ms;
+			if(isRad)
+				ms.setSaveRadians();
+			else
+				ms.setSaveDegrees();
+			ms.LoadFile(argv[i]);
+			ms.makeSafe(MaxOutputSpeed,margin);
+			if(compress)
+				ms.compress();
+			ms.SaveFile(path.c_str());
+		}
+		used=argc;
+	} else if(argc-used==2) {
+		DynamicMotionSequence ms;
+		if(isRad)
+			ms.setSaveRadians();
+		else
+			ms.setSaveDegrees();
+		ms.LoadFile(argv[used]);
+		ms.makeSafe(MaxOutputSpeed,margin);
+		if(compress)
+			ms.compress();
+		ms.SaveFile(argv[used+1]);
+		used=argc;
+	} else
+		return usage(argc,argv);
+	cout << endl;
+	return 0;
+}
+
diff -urdN ../Tekkotsu_2.2/tools/safemot/tekkotsu.cfg ./tools/safemot/tekkotsu.cfg
--- ../Tekkotsu_2.2/tools/safemot/tekkotsu.cfg	Wed Dec 31 19:00:00 1969
+++ ./tools/safemot/tekkotsu.cfg	Mon Nov  8 16:48:19 2004
@@ -0,0 +1,128 @@
+##################################################################
+##################   Tekkotsu::safemot config   ##################
+##################################################################
+##################### $Name: HEAD $ ######################
+####################### $Revision: 1.1 $ ########################
+################## $Date: 2004/11/17 04:36:48 $ ##################
+##################################################################
+#
+# Format:
+#
+# * Comments are any line beginning with '#'
+#
+# * Model specific regions can be denoted with <MODELNAME>...</MODELNAME>
+#   - Wildcards can also be used: <ERS-2*>...</ERS-2*>
+#   - Anything not within a model region is read by all models (i.e. <*>..</*>)
+#   - Don't get fancy with the "tags" - one per line, the parser's not that smart
+#     (feel free to hack it if you want - it's in Config.cc)
+#
+# * Sections are demarcated with [SECTIONNAME]
+#   - A section is only ended by another section beginning
+#   - Section transitions within a model region will only be read by that model
+#   - Section names are case insensitive
+#
+# * Otherwise, each line is interpreted as: variable=value
+#   - this should correspond to Config::curSectionName_config::variable
+#   - interpretation is up to the code in Config.cc
+#   - some variables are lists (additional assignments push on the list),
+#     others are simply overwritten if a new value is assigned.
+#   - variable names are case insensitive
+#
+# * You can override these at run time from the Controller using the command:
+#   !set section_name.variable=value
+#   - Of course, whether or not the new value will be picked up depends on
+#     how it is being used...
+#
+##################################################################
+
+
+
+##################################################################
+##################################################################
+[Motion]
+##################################################################
+##################################################################
+
+# Any motion related paths which are not absolute (i.e. do not
+# start with '/') will be assumed to be relative to this directory
+root=.
+
+# This is the default set of walk parameters
+walk=walk.prm
+
+# The file specified by "kinematics" should define the kinematic
+# chains which form your robot.
+# "kinematic_chains" lists the names of the chains which should be
+# loaded from that file
+<ERS-2*>
+<ERS-210>
+kinematics=/ms/config/ers210.kin
+kinematic_chains=Mouth
+</ERS-210>
+<ERS-220>
+kinematics=/ms/config/ers220.kin
+</ERS-220>
+kinematic_chains=IR
+</ERS-2*>
+<ERS-7>
+kinematics=/ms/config/ers7.kin
+kinematic_chains=Mouth
+kinematic_chains=NearIR
+kinematic_chains=FarIR
+kinematic_chains=ChestIR
+</ERS-7>
+kinematic_chains=LFr
+kinematic_chains=RFr
+kinematic_chains=LBk
+kinematic_chains=RBk
+kinematic_chains=Camera
+
+# These calibration parameters should specify the value to multiply a
+# desired position by in order to cause the joint to actually reach
+# that position.  This is then used both to calibrate joint values
+# which are sent to the system, and also sensor values which are
+# received back.
+# An unspecified joint is by default '1' which will then pass values
+# through unmodified.  Only PID joints are calibrated (i.e. LEDs and
+# ears are not)
+<ERS-7>
+#Only the knees and rotors have been calibrated
+#This is just kind of a rough calibration since
+#I don't know how well it will generalize across
+#individual robots anyway.
+calibrate:LFr:rotor=0.972
+calibrate:LFr:knee~=0.944
+calibrate:RFr:rotor=0.972
+calibrate:RFr:knee~=0.944
+calibrate:LBk:rotor=0.972
+calibrate:LBk:knee~=0.944
+calibrate:RBk:rotor=0.972
+calibrate:RBk:knee~=0.944
+</ERS-7>
+<ERS-2*>
+#ERS-2xx seems to be fairly well calibrated by system, but
+#you can always try to do better...
+</ERS-2*>
+
+# Sounds to play when turning estop on and off
+estop_on_snd=skid.wav
+estop_off_snd=yap.wav
+
+# These values are used by some behaviors to limit the
+# speed of the head to reduce wear on the joints
+# Units: radians per second
+<ERS-2*>
+max_head_tilt_speed=2.1
+max_head_pan_speed=3.0
+max_head_roll_speed=3.0
+</ERS-2*>
+<ERS-7>
+#the pan speed is revised down from Sony's maximum a bit
+max_head_tilt_speed=3.18522588
+max_head_pan_speed=5.78140315
+max_head_roll_speed=5.78140315
+</ERS-7>
+
+console_port=10003
+stderr_port=10004
+
diff -urdN ../Tekkotsu_2.2/tools/test/kinematics/test_kinematics.cc ./tools/test/kinematics/test_kinematics.cc
--- ../Tekkotsu_2.2/tools/test/kinematics/test_kinematics.cc	Tue Oct  5 15:12:37 2004
+++ ./tools/test/kinematics/test_kinematics.cc	Thu Nov  4 14:45:26 2004
@@ -3,6 +3,7 @@
 #include "Motion/Kinematics.h"
 #include "Shared/Config.h"
 #include "Motion/PostureEngine.h"
+#include "Shared/newmat/newmatio.h"
 
 namespace ROBOOP {
 void serrprintf(const char* msg, int x, int y, int z) {
@@ -18,7 +19,8 @@
 int main(int /*argc*/, char** /*argv*/) {
 	//Read config file
 	config=new Config("../../../project/ms/config/tekkotsu.cfg");
-	config->setValue(Config::sec_motion,"kinematics","../../../project/ms/config/ers7.kin");
+	config->setValue(Config::sec_motion,"root","../../../project/ms/data/motion");
+	config->setValue(Config::sec_motion,"kinematics","../../config/ers7.kin");
 	kine = new Kinematics();
 	
 	PostureEngine pose;
@@ -41,6 +43,8 @@
 	Plink(2)=10;
 	Plink(3)=10;
 	Plink(4)=1;
+
+	cout << pose.getLinkInterestPoint(BaseFrameOffset,"LFrPaw");
 	
 	/*for(unsigned int i=LFrLegOffset; i<LFrLegOffset+JointsPerLeg; i++)
 		cout << outputNames[i] << ' ' << pose(i).value << endl;
diff -urdN ../Tekkotsu_2.2/tools/test/mon/Listener.java ./tools/test/mon/Listener.java
--- ../Tekkotsu_2.2/tools/test/mon/Listener.java	Sat May 24 00:56:20 2003
+++ ./tools/test/mon/Listener.java	Tue Nov  2 00:23:41 2004
@@ -5,145 +5,188 @@
 import java.io.IOException;
 
 public abstract class Listener implements Runnable {
-  public Listener() { _port=-1; _isConnected=false; }
-  public Listener(int port) { this(); setPort(port); }
-  public Listener(String host, int port) { this(); setHostPort(host, port); }
+	public Listener() { _port=-1; _isConnected=false; }
+	public Listener(int port) { this(); setPort(port); }
+	public Listener(String host, int port) { this(); setHostPort(host, port); }
 
-  public void setPort(int port) {
-    _isServer=true;
-    _port=port;
-    startThread();
-  }
+	public void setPort(int port) {
+		_isServer=true;
+		_port=port;
+		startThread();
+	}
 
-  public void setHostPort(String host, int port) {
-    _isServer=false;
-    _host=host;
-    _port=port;
-    startThread();
-  }
-  
-  public void startThread() {
-    _listenerThread=new Thread(this);
-    _listenerThread.start();
-  }
+	public void setHostPort(String host, int port) {
+		_isServer=false;
+		_host=host;
+		_port=port;
+		startThread();
+	}
 
-  public void run() {
-    if (_port >= 0) {
-      if (_isServer)
-        runServer();
-      else
-        runConnect();
-    } else {
-      System.out.println("can't start Listener without [host],port");
-    }
-  }
+	public void startThread() {
+		destroy=false;
+		_listenerThread=new Thread(this);
+		_listenerThread.start();
+	}
 
-  void frameTimer() {
-    _frametimer_numframes++;
-    if (System.currentTimeMillis()-_frametimer_timer>1000) {
-      System.out.println("updated at "+_frametimer_numframes+"hz");
-      _frametimer_numframes=0;
-      _frametimer_timer=System.currentTimeMillis();
-    }
-  }
+	public void run() {
+		if (_port >= 0) {
+			if (_isServer)
+				runServer();
+			else
+				runConnect();
+		} else {
+			System.out.println("can't start Listener without [host],port");
+		}
+	}
 
-  double readDouble(InputStream in) throws IOException {
-    return Double.longBitsToDouble(readLong(in));
-  }
+	public void kill() {
+		destroy=true;
+		_isConnected=false;
+		if(_listenerThread!=null)
+			_listenerThread.interrupt();
+		close();
+	}
 
-  void writeDouble(OutputStream out, double x) throws IOException {
-    writeLong(out,Double.doubleToLongBits(x));
-  }
+	public void frameTimer() {
+		_frametimer_numframes++;
+		if (System.currentTimeMillis()-_frametimer_timer>1000) {
+			System.out.println("updated at "+_frametimer_numframes+"hz");
+			_frametimer_numframes=0;
+			_frametimer_timer=System.currentTimeMillis();
+		}
+	}
 
-  long readLong(InputStream in) throws IOException {
-    int read=0;
-    int last=0;
-    byte[] buf=new byte[8];
-    while (read<8 && last>=0) { last=in.read(buf,read,8-read); read+=last; }
-    if(last<0)
-    	_isConnected=false;
-    return (b2l(buf[7])<<56) | (b2l(buf[6])<<48) |
-           (b2l(buf[5])<<40) | (b2l(buf[4])<<32) |
-           (b2l(buf[3])<<24) | (b2l(buf[2])<<16) |
-           (b2l(buf[1])<< 8) | b2l(buf[0]);
-  }
+	public double readDouble(InputStream in) throws IOException {
+		return Double.longBitsToDouble(readLong(in));
+	}
 
-  void writeLong(OutputStream out, long x) throws IOException {
-    int bytelen=8;
-    byte[] buf=new byte[bytelen];
-    for(int i=0; i<bytelen; i++)
-      buf[i]=(new Long((x>>(8*i)) & 0xff)).byteValue();
-    out.write(buf,0,bytelen);
-  }
+	public void writeDouble(OutputStream out, double x) throws IOException {
+		writeLong(out,Double.doubleToLongBits(x));
+	}
 
-  float readFloat(InputStream in) throws IOException {
-    return Float.intBitsToFloat(readInt(in));
-  }
-  
-  void writeFloat(OutputStream out, float x) throws IOException {
-    writeInt(out,Float.floatToIntBits(x));
-  }
+	public long readLong(InputStream in) throws IOException {
+		int read=0;
+		int last=0;
+		byte[] buf=new byte[8];
+		while (read<8 && last>=0) { last=in.read(buf,read,8-read); read+=last; }
+		if(last<0)
+			_isConnected=false;
+		return (b2l(buf[7])<<56) | (b2l(buf[6])<<48) |
+					 (b2l(buf[5])<<40) | (b2l(buf[4])<<32) |
+					 (b2l(buf[3])<<24) | (b2l(buf[2])<<16) |
+					 (b2l(buf[1])<< 8) | b2l(buf[0]);
+	}
 
-  int readInt(InputStream in) throws IOException {
-    int read=0;
-    int last=0;
-    byte[] buf=new byte[4];
-    while (read<4 && last>=0) { last=in.read(buf,read,4-read); read+=last; }
-    if(last<0)
-    	_isConnected=false;
-    return (b2i(buf[3])<<24) | (b2i(buf[2])<<16) |
-           (b2i(buf[1])<< 8) | b2i(buf[0]);
-  }
-  
-  void writeInt(OutputStream out, int x) throws IOException {
-    int bytelen=4;
-    byte[] buf=new byte[bytelen];
-    for(int i=0; i<bytelen; i++)
-      buf[i]=(new Integer((x>>(8*i)) & 0xff)).byteValue();
-    out.write(buf,0,bytelen);
-  }
+	public void writeLong(OutputStream out, long x) throws IOException {
+		int bytelen=8;
+		byte[] buf=new byte[bytelen];
+		for(int i=0; i<bytelen; i++)
+			buf[i]=(new Long((x>>(8*i)) & 0xff)).byteValue();
+		out.write(buf,0,bytelen);
+	}
 
-  void readBytes(byte[] buf, InputStream in, int bytes) throws IOException {
-    int read=0;
-    int last=0;
-    while (read<bytes && last>=0) { last=in.read(buf, read, bytes-read); read+=last;}
-    if(last<0)
-    	_isConnected=false;
-  }
+	public float readFloat(InputStream in) throws IOException {
+		return Float.intBitsToFloat(readInt(in));
+	}
+	
+	public void writeFloat(OutputStream out, float x) throws IOException {
+		writeInt(out,Float.floatToIntBits(x));
+	}
 
-  String readLine(InputStream in) throws java.io.IOException{
-    StringBuffer sbuf=new StringBuffer();
-    int x=in.read();
-    if(x==-1) {
-      _isConnected=false;
-      return sbuf.toString();
-    }
-    char c=(char)x;
-    while(c!='\n') {
-      sbuf.append(c);
-      x=in.read();
-      if(x==-1) {
-        _isConnected=false;
-        return sbuf.toString();
-      }
-      c=(char)x;
-    }
-    return sbuf.toString();
+	public int readInt(InputStream in) throws IOException {
+		int read=0;
+		int last=0;
+		byte[] buf=new byte[4];
+		while (read<4 && last>=0) { last=in.read(buf,read,4-read); read+=last; }
+		if(last<0)
+			_isConnected=false;
+		return (b2i(buf[3])<<24) | (b2i(buf[2])<<16) |
+					 (b2i(buf[1])<< 8) | b2i(buf[0]);
+	}
+	
+	public void writeInt(OutputStream out, int x) throws IOException {
+		int bytelen=4;
+		byte[] buf=new byte[bytelen];
+		for(int i=0; i<bytelen; i++)
+			buf[i]=(new Integer((x>>(8*i)) & 0xff)).byteValue();
+		out.write(buf,0,bytelen);
+	}
+
+  public byte[] readBytes(InputStream in, int bytes) throws IOException {
+    byte[] ret=new byte[bytes];
+    readBytes(ret, in, bytes);
+    return ret;
   }
-  
-  int b2i(byte b) { return (b>=0)?(int)b:((int)b)+256; }
-  long b2l(byte b) { return (b>=0)?(long)b:((long)b)+256; }
 
-  abstract void runServer();
-  abstract void runConnect();
-  abstract public void close();
+	public void readBytes(byte[] buf, InputStream in, int bytes) throws IOException {
+		int read=0;
+		int last=0;
+		while (read<bytes && last>=0) {
+			last=in.read(buf, read, bytes-read);
+			read+=last;
+		}
+		if(last<0)
+			_isConnected=false;
+	}
 
-  boolean _isServer;
-  int _port;
-  String _host;
-  boolean _isConnected;
-  volatile Thread _listenerThread;
+	public char readChar(InputStream in) throws IOException {
+		return (char)in.read();
+	}
 
-  int _frametimer_numframes=0;
-  long _frametimer_timer=System.currentTimeMillis();
+	public void writeChar(OutputStream out, char c) throws IOException {
+		out.write(c);
+	}
+
+	public String readLine(InputStream in) throws java.io.IOException{
+		StringBuffer sbuf=new StringBuffer();
+		int x=in.read();
+		if(x==-1) {
+			_isConnected=false;
+			return sbuf.toString();
+		}
+		char c=(char)x;
+		while(c!='\n') {
+			sbuf.append(c);
+			x=in.read();
+			if(x==-1) {
+				_isConnected=false;
+				return sbuf.toString();
+			}
+			c=(char)x;
+		}
+		return sbuf.toString();
+	}
+	
+	public int b2i(byte b) { return (b>=0)?(int)b:((int)b)+256; }
+	public long b2l(byte b) { return (b>=0)?(long)b:((long)b)+256; }
+
+	public abstract void runServer();
+	public abstract void runConnect();
+	public abstract void close();
+
+	public boolean _isServer;
+	public int _port;
+	public String _host;
+	public boolean _isConnected;
+	public volatile Thread _listenerThread;
+	public volatile boolean destroy=false;
+
+	public int _frametimer_numframes=0;
+	public long _frametimer_timer=System.currentTimeMillis();
+
+  public static final int PACKET_TEXT=0;
+  public static final int PACKET_VISIONRAW_HALF=1;
+  public static final int PACKET_VISIONRAW_FULL=2;
+  public static final int PACKET_VISIONRAW_YFULL_UVHALF=3;
+  public static final int PACKET_VISIONRAW_Y_ONLY=4;
+  public static final int PACKET_VISIONRAW_Y_LH_ONLY=5;
+  public static final int PACKET_VISIONRAW_Y_HL_ONLY=6;
+  public static final int PACKET_VISIONRAW_Y_HH_ONLY=7;
+  public static final int PACKET_VISIONRAW_U_ONLY=8;
+  public static final int PACKET_VISIONRAW_V_ONLY=9;
+  public static final int PACKET_VISIONRLE_FULL=10;
+  public static final int PACKET_WORLDSTATEJOINTS=11;
+  public static final int PACKET_WORLDSTATEPIDS=12;
+  public static final int PACKET_WORLDSTATEBUTTONS=13;
+  public static final int PACKET_WMCLASS=14;
 }
diff -urdN ../Tekkotsu_2.2/tools/test/mon/TCPListener.java ./tools/test/mon/TCPListener.java
--- ../Tekkotsu_2.2/tools/test/mon/TCPListener.java	Sat May 24 00:56:20 2003
+++ ./tools/test/mon/TCPListener.java	Tue Nov  2 00:23:41 2004
@@ -2,54 +2,66 @@
 import java.net.Socket;
 
 public abstract class TCPListener extends Listener {
-  abstract void connected(Socket socket);
+	public abstract void connected(Socket socket);
 
-  void runServer() {
-    Thread me = Thread.currentThread();
-    try { _serverSocket=new ServerSocket(_port); }
-    catch (Exception ex) {
-      System.out.println("port "+_port+": "+ex);
-      return;
-    }
+	public void runServer() {
+		Thread me = Thread.currentThread();
+		try { _serverSocket=new ServerSocket(_port); }
+		catch (Exception ex) {
+			System.out.println("port "+_port+": "+ex);
+			return;
+		}
 
-    while (me == _listenerThread) {
-      try {
-        _socket=_serverSocket.accept();
-        connected(_socket);
-      } catch (Exception ex) { }
-    }
-  }
+		while (me == _listenerThread && !destroy) {
+			try {
+				_socket=_serverSocket.accept();
+				connected(_socket);
+			} catch (Exception ex) { }
+		}
+	}
 
-  void runConnect() {
-    int attempts=0;
-    Thread me = Thread.currentThread();
-    while (me==_listenerThread) {
-      try {
-        _socket=new Socket(_host,_port);
-        attempts=0;
-        connected(_socket);
-		System.err.println("TCPListener port "+_port+" - Disconnected, attempting to reestablish...");
-      } catch (Exception ex) {}
-      attempts++;
-      if(attempts%10==0)
-        System.err.println("TCPListener port "+_port+" - Waiting for connection... ("+attempts+" attempts)");
-      try {
-	      Thread.sleep(500);
-      } catch (Exception ex) {}
-    }
-  }
+	public void runConnect() {
+		int attempts=0;
+		Thread me = Thread.currentThread();
+		while (me==_listenerThread && !destroy) {
+			if(attempts==0) {
+				System.out.println("["+_port+"] connecting ...");
+			}
+			try {
+				_socket=new Socket(_host,_port);
+				System.out.println("["+_port+"] connected");
+				attempts=0;
+				_isConnected=true;
+			} catch (Exception ex) {}
+			if(_isConnected) {
+				connected(_socket);
+				if(!destroy)
+					System.out.println("["+_port+"] disconnected");
+          System.out.println("["+_port+"] attempting to reestablish ..");
+			}
+			attempts++;
+			if(destroy) {
+				System.out.println("["+_port+"] connection closed");
+				break;
+			}
+			try {
+				Thread.sleep(500);
+			} catch (Exception ex) {}
+		}
+	}
 
-  public void close() {
-    _listenerThread=null;
-    try { _socket.close(); } catch (Exception ex) { }
-    if (_isServer)
-      try { _serverSocket.close(); } catch (Exception ex) { }
-  }
+	public void close() {
+		_listenerThread=null;
+		_isConnected=false;
+		try { _socket.close(); } catch (Exception ex) { }
+		if (_isServer)
+			try { _serverSocket.close(); } catch (Exception ex) { }
+	}
 
-  public TCPListener() { super(); }
-  public TCPListener(int port) { super(port); }
-  public TCPListener(String host, int port) { super(host,port); }
+	public TCPListener() { super(); }
+	public TCPListener(int port) { super(port); }
+	public TCPListener(String host, int port) { super(host,port); }
 
-  Socket _socket;
-  ServerSocket _serverSocket;
+	Socket _socket;
+	ServerSocket _serverSocket;
 }
diff -urdN ../Tekkotsu_2.2/tools/test/mon/listen.java ./tools/test/mon/listen.java
--- ../Tekkotsu_2.2/tools/test/mon/listen.java	Wed Dec 31 19:00:00 1969
+++ ./tools/test/mon/listen.java	Tue Nov  2 00:23:41 2004
@@ -0,0 +1,68 @@
+import java.net.*;
+import java.io.*;
+
+public class listen extends TCPListener {
+	public static void main(String[] args) {
+		if(args.length<1) {
+			usage(args);
+			System.exit(2);
+		}
+		new listen((new Integer(args[0])).intValue());
+	}
+	
+	public static void usage(String[] args) {
+		System.out.println("Usage: java listen port");
+		System.out.println("       This will listen on <port> until a connection occurs.");
+		System.out.println("       Any output is sent to the console, and any console");
+		System.out.println("       input will be sent to the remote host, terminated by");
+		System.out.println("       newline");
+	}
+	
+	public listen() { super(); }
+	public listen(int port) { super(port); }
+	
+	public class send implements Runnable {
+		public Socket socket;
+		public void run() {
+			try {
+				PrintStream out = new PrintStream(socket.getOutputStream());
+				BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );
+ 				while (!socket.isOutputShutdown()) {
+					out.println(in.readLine());
+				}
+			} catch(Exception e) {if((SocketException)e==null) e.printStackTrace();}
+	
+			try { socket.close(); } catch (Exception ex) { }
+			System.out.println("[Lost output...]");
+		}
+	}
+	public class receive implements Runnable {
+		public Socket socket;
+		public void run() {
+			try {
+				InputStream sin=socket.getInputStream();
+				while (!socket.isInputShutdown()) {
+					System.out.print((char)sin.read());
+				}
+			} catch(Exception e) {if((SocketException)e==null) e.printStackTrace();}
+	
+			try { socket.close(); } catch (Exception ex) { }
+			System.out.println("[Lost input...]");
+		}
+	}
+
+	public void runServer() {
+		System.out.println("[Listening...]");
+		super.runServer();
+	}
+	
+	public void connected(Socket socket) {
+		System.out.println("[Connected...]");
+		receive recv=new receive();
+		send snd=new send();
+		recv.socket=snd.socket=socket;
+		(new Thread(recv)).start();
+		(new Thread(snd)).start();
+	}
+
+}
\ No newline at end of file
