00001 /* 00002 * Copyright (c) 2012, Daniel Claes, Maastricht University 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Neither the name of the Maastricht University nor the names of its 00014 * contributors may be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 * POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 00030 00031 00032 #ifndef AGENT_H 00033 #define AGENT_H 00034 00035 #include "collvoid_local_planner/Utils.h" 00036 #include "collvoid_local_planner/clearpath.h" 00037 00038 #include <boost/shared_ptr.hpp> 00039 00040 namespace collvoid{ 00041 00042 class Agent{ 00043 public: 00044 00045 // Agent(){}; 00046 virtual ~Agent(){}; 00047 00048 void computeOrcaVelocity(Vector2 pref_velocity, bool convex); 00049 00050 void computeClearpathVelocity(Vector2 pref_velocity); 00051 void computeSampledVelocity(Vector2 pref_velocity); 00052 00053 00054 void computeAgentVOs(); 00055 00056 void setLeftPref(double left_pref); 00057 void setRadius(double radius); 00058 void setTruncTime(double trunc_time); 00059 void setSimPeriod(double sim_period); 00060 00061 double getRadius(); 00062 collvoid::Vector2 getPosition(); 00063 collvoid::Vector2 getVelocity(); 00064 00065 00066 //config 00067 double left_pref_; 00068 00069 bool use_truncation_; 00070 double trunc_time_; 00071 double timestep_, sim_period_; 00072 00073 bool controlled_; 00074 00075 bool orca_; // Orca or VO? 00076 bool convex_; // circle approx, or mink sum? 00077 00078 //VO settings 00079 bool clearpath_; //Clearpath or sampling based 00080 int type_vo_; //0 = HRVO, 1 = RVO , 2 = VO 00081 00082 //description 00083 Vector2 position_; 00084 double heading_; 00085 Vector2 velocity_; 00086 00087 double radius_; 00088 00089 std::vector<Vector2> footprint_; 00090 00091 00092 00093 Vector2 new_velocity_; 00094 00095 00096 //nh stuff 00097 double cur_allowed_error_; 00098 00099 //Orca 00100 double max_speed_x_; 00101 std::vector<Line> orca_lines_, additional_orca_lines_; 00102 00103 //VO stuff 00104 std::vector<VO> vo_agents_, additional_vos_; 00105 std::vector<VelocitySample> samples_; 00106 00107 00108 00109 std::vector<boost::shared_ptr<Agent> > agent_neighbors_; 00110 00111 00112 }; 00113 00114 typedef boost::shared_ptr<Agent> AgentPtr; 00115 00116 00117 } 00118 00119 #endif