]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Add upper time bound for planner computation
authorJiri Hubacek <hubacji1@fel.cvut.cz>
Mon, 2 Jul 2018 13:07:41 +0000 (15:07 +0200)
committerJiri Hubacek <hubacji1@fel.cvut.cz>
Mon, 2 Jul 2018 13:07:41 +0000 (15:07 +0200)
base/main.cc

index a067794ea4842ec9f375282fe22a0fed9e330a5a..e22945d1d277ef912db80a83779c4e45ce8a2426 100644 (file)
@@ -20,6 +20,8 @@ along with I am car. If not, see <http://www.gnu.org/licenses/>.
 #include "obstacle.h"
 #include "rrtplanner.h"
 
+#define TMAX 10
+
 int main()
 {
         Json::Value jvi; // JSON input
@@ -60,9 +62,10 @@ int main()
         p.link_obstacles(&co, &so);
 
         p.tstart();
-        while (!p.goal_found())
+        while (!p.goal_found() && p.elapsed() < 10) {
                 p.next();
-        p.tend();
+                p.tend();
+        }
 
         std::cerr << "Elapsed is " << p.elapsed() << std::endl;
         std::cerr << "Goal found is " << p.goal_found() << std::endl;