[Jderobot-admin] jderobot-r1146 - trunk/src/stable/components/visualHFSM

bmenendez en jderobot.org bmenendez en jderobot.org
Sab Ene 25 19:44:50 CET 2014


Author: bmenendez
Date: 2014-01-25 19:44:50 +0100 (Sat, 25 Jan 2014)
New Revision: 1146

Modified:
   trunk/src/stable/components/visualHFSM/generate.cpp
   trunk/src/stable/components/visualHFSM/point.cpp
   trunk/src/stable/components/visualHFSM/visualhfsm.cpp
Log:
#146 Fixed an error generating subautomatons.


Modified: trunk/src/stable/components/visualHFSM/generate.cpp
===================================================================
--- trunk/src/stable/components/visualHFSM/generate.cpp	2014-01-21 22:18:00 UTC (rev 1145)
+++ trunk/src/stable/components/visualHFSM/generate.cpp	2014-01-25 18:44:50 UTC (rev 1146)
@@ -218,7 +218,7 @@
 						nodeListIterator++;
 
 					float ms = atof(transListIterator->getCodeTrans().c_str());
-					this->fs << mapTab[T_ONE] << "t_" << nodeListIterator->getName() << "_max = " << (ms/1000.0) << ";" << std::endl;
+					this->fs << mapTab[T_ONE] << "float t_" << nodeListIterator->getName() << "_max = " << (ms/1000.0) << ";" << std::endl;
 
 					mapNameTime[nodeListIterator->getName()] = ms/1000.0;
 				}
@@ -254,9 +254,9 @@
 			this->fs << "\t\t\tif (";
 
 			int count = 0;
-			for ( std::list<Transition>::iterator nodeListIterator = transList.begin();
-					nodeListIterator != transList.end(); nodeListIterator++ ) {
-				this->fs << " sub_" << id << " == " << nodeListIterator->getName();
+			for ( std::list<Node>::iterator nodeListIterator = nodeList.begin();
+					nodeListIterator != nodeList.end(); nodeListIterator++ ) {
+				this->fs << " sub_" << id << " == " << nodeListIterator->getName() + "_ghost";
 				count++;
 				if (count != countNodes) {
 					this->fs << " ||";
@@ -264,7 +264,7 @@
 			}
 			this->fs << ") {" << std::endl;
 
-			this->fs << "\t\t\t\tsub_" << id << "(State_Sub_" << id << ")(sub_" << id << " - 1);" << std::endl;
+			this->fs << "\t\t\t\tsub_" << id << " = (State_Sub_" << id << ")(sub_" << id << " - 1);" << std::endl;
 			this->fs << "\t\t\t\tt_ini = time(NULL);" << std::endl;
 			this->fs << "\t\t\t}" << std::endl;
 		}
@@ -343,12 +343,12 @@
 				if (mapNameTime.find(nodeListIterator->getName()) != mapNameTime.end()) {
 					this->fs << "\t\t\t\tcase " << nodeListIterator->getName() << ":" << std::endl;
 					this->fs << "\t\t\t\t\tt_" << nodeListIterator->getName() << "_max = " << mapNameTime[nodeListIterator->getName()] << " - difftime(t_fin, t_ini);" << std::endl;
+					this->fs << "\t\t\t\t\tsub_" << id << " = (State_Sub_" << id << ")(sub_" << id << " + 1);" << std::endl;
 					this->fs << "\t\t\t\t\tbreak;" << std::endl;
 				} 
 			}
 			this->fs << "\t\t\t\tdefault:" << std::endl;
 			this->fs << "\t\t\t\t\tbreak;" << std::endl;
-			this->fs << "\t\t\t\tsub_" << id << " = (State_Sub_" << id << ")(sub_" << id << " + 1);" << std::endl;
 			this->fs << "\t\t\t}" << std::endl;
 			this->fs << "\t\t}" << std::endl;
 		}
@@ -477,4 +477,4 @@
         return NULL;
 
     return this->path.substr(last_pos + 1, std::string::npos);
-}
\ No newline at end of file
+}

Modified: trunk/src/stable/components/visualHFSM/point.cpp
===================================================================
--- trunk/src/stable/components/visualHFSM/point.cpp	2014-01-21 22:18:00 UTC (rev 1145)
+++ trunk/src/stable/components/visualHFSM/point.cpp	2014-01-25 18:44:50 UTC (rev 1146)
@@ -87,11 +87,11 @@
     						pow(possible2_final_y - p.getY(), 2.0));
 
     if (distance1 < distance2) {
-    	Point p(possible1_final_x, possible1_final_y);
-    	return p;
+    	Point point(possible1_final_x, possible1_final_y);
+    	return point;
     } else {
-    	Point p(possible2_final_x, possible2_final_y);
-    	return p;
+    	Point point(possible2_final_x, possible2_final_y);
+    	return point;
     }
 }
 

Modified: trunk/src/stable/components/visualHFSM/visualhfsm.cpp
===================================================================
--- trunk/src/stable/components/visualHFSM/visualhfsm.cpp	2014-01-21 22:18:00 UTC (rev 1145)
+++ trunk/src/stable/components/visualHFSM/visualhfsm.cpp	2014-01-25 18:44:50 UTC (rev 1146)
@@ -194,6 +194,8 @@
 
         this->listInterfaces = parser.getConfigFile();
         this->listLibraries = parser.getListLibs();
+        
+        std::cout << "parseado" << std::endl;
 
         this->removeAllGui();
         if (!this->loadSubautomata(parser.getListSubautomata()))
@@ -1268,6 +1270,8 @@
             this->currentSubautomata->hideAll();
 
         subListIterator++;
+        
+        std::cout << "subautomata loaded" << std::endl;
     }
 
     this->currentSubautomata = this->getSubautomataWithIdFather(0);
@@ -1446,4 +1450,4 @@
     }
 
     return true;
-}
\ No newline at end of file
+}



More information about the Jderobot-admin mailing list