real_zone.cc
Go to the documentation of this file.
00001 /*
00002  *  Navigator real zone controller
00003  *
00004  *  Copyright (C) 2007, Mickey Ristroph
00005  *
00006  *  License: Modified BSD Software License Agreement
00007  *
00008  *  $Id: real_zone.cc 479 2010-08-27 01:16:11Z jack.oquin $
00009  */
00010 
00011 #include "navigator_internal.h"
00012 #include "Controller.h"
00013 #include "course.h"
00014 #include "halt.h"
00015 #include "real_zone.h"
00016 #include "voronoi_zone.h"
00017 
00018 RealZone::RealZone(Navigator *navptr, int _verbose):
00019   Controller(navptr, _verbose)
00020 {
00021   halt = new Halt(navptr, _verbose);
00022   voronoi = new VoronoiZone(navptr, _verbose);
00023 }
00024 
00025 RealZone::~RealZone()
00026 {
00027   delete halt;
00028   delete voronoi;
00029 }
00030 
00031 // configuration method
00032 void RealZone::configure(ConfigFile* cf, int section)
00033 {
00034   voronoi->configure(cf, section);
00035   halt->configure(cf, section);
00036 }
00037 
00038 // go to next zone way-point
00039 //
00040 // returns: OK.
00041 //
00042 Controller::result_t RealZone::control(pilot_command_t &pcmd)
00043 {
00044   result_t result = OK;
00045 
00046   if(order->waypt[0].id.seg == order->waypt[1].id.seg &&
00047      (order->waypt[1].is_spot || order->waypt[1].is_perimeter)) {
00048     result = voronoi->control(pcmd);
00049   } else {
00050     halt->control(pcmd);
00051     result = NotApplicable;
00052   }
00053 
00054   trace("real_zone controller", pcmd, result);
00055 
00056   return result;
00057 }
00058 
00059 // reset all subordinate controllers
00060 void RealZone::reset(void)
00061 {
00062   trace_reset("RealZone");
00063   halt->reset();
00064   voronoi->reset();
00065 }


art_nav
Author(s): Austin Robot Technology, Jack O'Quin
autogenerated on Fri Jan 3 2014 11:08:43