AgentDescriptor.cpp

Go to the documentation of this file.
00001 /************************************************************************
00002 * Verve                                                                 *
00003 * Copyright (C) 2004-2006                                               *
00004 * Tyler Streeter  tylerstreeter@gmail.com                               *
00005 * All rights reserved.                                                  *
00006 * Web: http://verve-agents.sourceforge.net                              *
00007 *                                                                       *
00008 * This library is free software; you can redistribute it and/or         *
00009 * modify it under the terms of EITHER:                                  *
00010 *   (1) The GNU Lesser General Public License as published by the Free  *
00011 *       Software Foundation; either version 2.1 of the License, or (at  *
00012 *       your option) any later version. The text of the GNU Lesser      *
00013 *       General Public License is included with this library in the     *
00014 *       file license-LGPL.txt.                                          *
00015 *   (2) The BSD-style license that is included with this library in     *
00016 *       the file license-BSD.txt.                                       *
00017 *                                                                       *
00018 * This library is distributed in the hope that it will be useful,       *
00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
00021 * license-LGPL.txt and license-BSD.txt for more details.                *
00022 ************************************************************************/
00023 
00024 #include "AgentDescriptor.h"
00025 
00026 namespace verve
00027 {
00028         AgentDescriptor::AgentDescriptor()
00029         {
00030                 mNumOutputs = 0;
00031                 mContinuousSensorResolution = 10;
00032                 mDynamicRBFEnabled = true;
00033                 mAgentArchitecture = defaults::agentArchitecture;
00034                 mMaxNumPlanningSteps = defaults::maxNumPlanningSteps;
00035                 mPlanningUncertaintyThreshold = 
00036                         defaults::planningUncertaintyThreshold;
00037         }
00038 
00039         AgentDescriptor::AgentDescriptor(const AgentDescriptor& desc)
00040         {
00041                 // Copy discrete sensors.
00042                 unsigned int numDiscreteSensors = desc.getNumDiscreteSensors();
00043                 for (unsigned int i = 0; i < numDiscreteSensors; ++i)
00044                 {
00045                         DiscreteSensorDescriptor sensorDesc;
00046                         sensorDesc.numOptions = desc.getDiscreteSensorNumOptions(i);
00047                         mDiscreteSensors.push_back(sensorDesc);
00048                 }
00049 
00050                 // Copy continuous sensors.
00051                 unsigned int numContinuousSensors = desc.getNumContinuousSensors();
00052                 for (unsigned int i = 0; i < numContinuousSensors; ++i)
00053                 {
00054                         ContinuousSensorDescriptor sensorDesc;
00055                         sensorDesc.isCircular = desc.getContinuousSensorIsCircular(i);
00056                         mContinuousSensors.push_back(sensorDesc);
00057                 }
00058 
00059                 mNumOutputs = desc.mNumOutputs;
00060                 mContinuousSensorResolution = desc.mContinuousSensorResolution;
00061                 mDynamicRBFEnabled = desc.mDynamicRBFEnabled;
00062                 mAgentArchitecture = desc.mAgentArchitecture;
00063                 mMaxNumPlanningSteps = desc.mMaxNumPlanningSteps;
00064                 mPlanningUncertaintyThreshold = desc.mPlanningUncertaintyThreshold;
00065         }
00066 
00067         AgentDescriptor::~AgentDescriptor()
00068         {
00069                 mDiscreteSensors.clear();
00070                 mContinuousSensors.clear();
00071         }
00072 
00073         void AgentDescriptor::addDiscreteSensor(unsigned int numOptions)
00074         {
00075                 assert(numOptions > 0);
00076                 DiscreteSensorDescriptor desc;
00077                 desc.numOptions = numOptions;
00078                 mDiscreteSensors.push_back(desc);
00079         }
00080 
00081         unsigned int AgentDescriptor::getNumDiscreteSensors()const
00082         {
00083                 return (unsigned int)mDiscreteSensors.size();
00084         }
00085 
00086         unsigned int AgentDescriptor::getDiscreteSensorNumOptions(
00087                 unsigned int i)const
00088         {
00089                 return mDiscreteSensors.at(i).numOptions;
00090         }
00091 
00092         void AgentDescriptor::addContinuousSensor(bool isCircular)
00093         {
00094                 ContinuousSensorDescriptor desc;
00095                 desc.isCircular = isCircular;
00096                 mContinuousSensors.push_back(desc);
00097         }
00098 
00099         unsigned int AgentDescriptor::getNumContinuousSensors()const
00100         {
00101                 return (unsigned int)mContinuousSensors.size();
00102         }
00103 
00104         bool AgentDescriptor::getContinuousSensorIsCircular(
00105                 unsigned int i)const
00106         {
00107                 return mContinuousSensors.at(i).isCircular;
00108         }
00109 
00110         void AgentDescriptor::setNumOutputs(unsigned int numOutputs)
00111         {
00112                 mNumOutputs = numOutputs;
00113         }
00114 
00115         unsigned int AgentDescriptor::getNumOutputs()const
00116         {
00117                 return mNumOutputs;
00118         }
00119 
00120         void AgentDescriptor::setContinuousSensorResolution(
00121                 unsigned int resolution)
00122         {
00123                 assert(resolution > 0);
00124                 mContinuousSensorResolution = resolution;
00125         }
00126 
00127         unsigned int AgentDescriptor::getContinuousSensorResolution()const
00128         {
00129                 return mContinuousSensorResolution;
00130         }
00131 
00132         void AgentDescriptor::setDynamicRBFEnabled(bool enabled)
00133         {
00134                 mDynamicRBFEnabled = enabled;
00135         }
00136 
00137         bool  AgentDescriptor::isDynamicRBFEnabled()const
00138         {
00139                 return mDynamicRBFEnabled;
00140         }
00141 
00142         void AgentDescriptor::setArchitecture(AgentArchitecture arch)
00143         {
00144                 mAgentArchitecture = arch;
00145         }
00146 
00147         AgentArchitecture AgentDescriptor::getArchitecture()const
00148         {
00149                 return mAgentArchitecture;
00150         }
00151 
00152         void AgentDescriptor::setMaxNumPlanningSteps(unsigned int steps)
00153         {
00154                 mMaxNumPlanningSteps = steps;
00155         }
00156 
00157         unsigned int AgentDescriptor::getMaxNumPlanningSteps()const
00158         {
00159                 return mMaxNumPlanningSteps;
00160         }
00161 
00162         void AgentDescriptor::setPlanningUncertaintyThreshold(real threshold)
00163         {
00164                 mPlanningUncertaintyThreshold = threshold;
00165         }
00166 
00167         real AgentDescriptor::getPlanningUncertaintyThreshold()const
00168         {
00169                 return mPlanningUncertaintyThreshold;
00170         }
00171 }

Generated on Tue Jan 24 21:46:37 2006 for Verve by  doxygen 1.4.6-NO