vertex_pose.h
Go to the documentation of this file.
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_POSE_H_
00045 #define VERTEX_POSE_H_
00046 
00047 #include <g2o/config.h>
00048 #include <g2o/core/base_vertex.h>
00049 #include <g2o/core/hyper_graph_action.h>
00050 #include <g2o/stuff/misc.h>
00051 
00052 #include <teb_local_planner/pose_se2.h>
00053 
00054 namespace teb_local_planner
00055 {
00056 
00063 class VertexPose : public g2o::BaseVertex<3, PoseSE2 >
00064 {
00065 public:
00066 
00071   VertexPose(bool fixed = false)
00072   {
00073     setToOriginImpl();
00074     setFixed(fixed);
00075   }
00076   
00082   VertexPose(const PoseSE2& pose, bool fixed = false)
00083   {
00084     _estimate = pose;
00085     setFixed(fixed);
00086   }
00087   
00094   VertexPose(const Eigen::Ref<const Eigen::Vector2d>& position, double theta, bool fixed = false)
00095   {
00096     _estimate.position() = position;
00097     _estimate.theta() = theta;
00098     setFixed(fixed);
00099   }
00100   
00108   VertexPose(double x, double y, double theta, bool fixed = false)
00109   {
00110     _estimate.x() = x;
00111     _estimate.y() = y;
00112     _estimate.theta() = theta;
00113     setFixed(fixed);
00114   }
00115   
00119   ~VertexPose() {}
00120   
00126   PoseSE2& pose() {return _estimate;}
00127   
00133   const PoseSE2& pose() const {return _estimate;}
00134           
00135   
00141   Eigen::Vector2d& position() {return _estimate.position();}
00142 
00148   const Eigen::Vector2d& position() const {return _estimate.position();}
00149   
00154   double& x() {return _estimate.x();}
00155   
00160   const double& x() const {return _estimate.x();}
00161   
00166   double& y() {return _estimate.y();}
00167   
00172   const double& y() const {return _estimate.y();}
00173   
00178   double& theta() {return _estimate.theta();}
00179   
00184   const double& theta() const {return _estimate.theta();}
00185   
00189   virtual void setToOriginImpl()
00190   {
00191     _estimate.setZero();
00192   }
00193 
00200   virtual void oplusImpl(const double* update)
00201   {
00202     _estimate.plus(update);
00203   }
00204 
00211   virtual bool read(std::istream& is)
00212   {
00213     is >> _estimate.x() >> _estimate.y() >> _estimate.theta();
00214     return true;
00215   }
00216 
00223   virtual bool write(std::ostream& os) const
00224   {
00225     os << _estimate.x() << " " << _estimate.y() << _estimate.theta();
00226     return os.good();
00227   }
00228 
00229   EIGEN_MAKE_ALIGNED_OPERATOR_NEW  
00230 };
00231 
00232 }
00233 
00234 #endif // VERTEX_POSE_H_


teb_local_planner
Author(s): Christoph Rösmann
autogenerated on Sat Jun 8 2019 20:21:34