00001 /********************************************************************* 00002 * 00003 * Software License Agreement (BSD License) 00004 * 00005 * Copyright (c) 2016, 00006 * TU Dortmund - Institute of Control Theory and Systems Engineering. 00007 * All rights reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * * Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * * Redistributions in binary form must reproduce the above 00016 * copyright notice, this list of conditions and the following 00017 * disclaimer in the documentation and/or other materials provided 00018 * with the distribution. 00019 * * Neither the name of the institute nor the names of its 00020 * contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00026 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00027 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00028 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00029 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00032 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00033 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 * POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 * Notes: 00037 * The following class is derived from a class defined by the 00038 * g2o-framework. g2o is licensed under the terms of the BSD License. 00039 * Refer to the base class source for detailed licensing information. 00040 * 00041 * Author: Christoph Rösmann 00042 *********************************************************************/ 00043 00044 #ifndef VERTEX_TIMEDIFF_H 00045 #define VERTEX_TIMEDIFF_H 00046 00047 00048 #include "g2o/config.h" 00049 #include "g2o/core/base_vertex.h" 00050 #include "g2o/core/hyper_graph_action.h" 00051 00052 #include "ros/console.h" 00053 00054 #include <Eigen/Core> 00055 00056 namespace teb_local_planner 00057 { 00058 00065 class VertexTimeDiff : public g2o::BaseVertex<1, double> 00066 { 00067 public: 00068 00073 VertexTimeDiff(bool fixed = false) 00074 { 00075 setToOriginImpl(); 00076 setFixed(fixed); 00077 } 00078 00084 VertexTimeDiff(double dt, bool fixed = false) 00085 { 00086 _estimate = dt; 00087 setFixed(fixed); 00088 } 00089 00093 ~VertexTimeDiff() 00094 {} 00095 00101 double& dt() {return _estimate;} 00102 00108 const double& dt() const {return _estimate;} 00109 00113 virtual void setToOriginImpl() 00114 { 00115 _estimate = 0.1; 00116 } 00117 00123 virtual void oplusImpl(const double* update) 00124 { 00125 _estimate += *update; 00126 } 00127 00133 virtual bool read(std::istream& is) 00134 { 00135 is >> _estimate; 00136 return true; 00137 } 00138 00144 virtual bool write(std::ostream& os) const 00145 { 00146 os << estimate(); 00147 return os.good(); 00148 } 00149 00150 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00151 }; 00152 00153 } 00154 00155 #endif