00001 /************************************************************************************************** 00002 Software License Agreement (BSD License) 00003 00004 Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without modification, are permitted 00008 provided that the following conditions are met: 00009 00010 *Redistributions of source code must retain the above copyright notice, this list of 00011 conditions and the following disclaimer. 00012 *Redistributions in binary form must reproduce the above copyright notice, this list of 00013 conditions and the following disclaimer in the documentation and/or other materials provided 00014 with the distribution. 00015 *Neither the name of the University of Aveiro nor the names of its contributors may be used to 00016 endorse or promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00021 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00024 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00025 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 ***************************************************************************************************/ 00032 #ifndef _TARGET_H_ 00033 #define _TARGET_H_ 00034 00035 #include <vector> 00036 #include <string> 00037 00038 #include <mtt/measurement.h> 00039 #include <mtt/motionModel.h> 00040 #include <mtt/metrics.h> 00041 00042 using namespace std; 00043 00044 class Measurement; 00046 typedef boost::shared_ptr<Measurement> MeasurementPtr; 00047 00048 class Target; 00050 typedef boost::shared_ptr<Target> TargetPtr; 00051 00052 class Target: public MotionModel 00053 { 00054 public: 00055 00056 double stt; 00057 00058 long _hypothesis; 00059 long _cluster; 00060 long _id; 00061 long _missed_associations; 00062 string _variant; 00063 long _uid; 00064 long _exuid; 00065 // static long _euid; 00066 // static long _ntotal; 00067 static long _euid; 00068 static long _ntotal; 00069 00070 double _aux1; 00071 00072 vector<MeasurementPtr> _assigned_measurements; 00073 vector<long> _concurrent_targets; 00074 vector<Vector5d> _past_states; 00075 00076 Target(); 00077 00078 ~Target(); 00079 00080 Target(TargetPtr prev_target); 00081 00082 Target(TargetPtr prev_target,MeasurementPtr measurement); 00083 00084 Target(MeasurementPtr measurement); 00085 00086 void incrementMissedAssociations(int inc=1); 00087 00088 void decrementMissedAssociations(int dec=1); 00089 00090 void zeroMissedAssociations(void); 00091 00092 double getDistance(MeasurementPtr& mes,int algorithm=0); 00093 00094 double getDistanceToPredictedPosition(TargetPtr& target,int algorithm=0); 00095 00096 void cleanTargetAssociations(void); 00097 00098 friend ostream& operator<<(ostream& o,Target& t); 00099 }; 00100 00101 bool compareTargetsById(TargetPtr t1,TargetPtr t2); 00102 bool compareTargetsByAux1(TargetPtr t1,TargetPtr t2); 00103 bool compareTargetsByAux1Descending(TargetPtr t1,TargetPtr t2); 00104 00105 00106 #endif