libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
kinopath.hpp
1 /*
2  * Adaptation of the code of Tobias Kunz for use in Move3d
3  *
4  *
5  * Copyright (c) 2011, Georgia Tech Research Corporation
6  * All rights reserved.
7  *
8  * Author: Tobias Kunz <tobias@gatech.edu>
9  * Date: 05/2012
10  *
11  * Humanoid Robotics Lab Georgia Institute of Technology
12  * Director: Mike Stilman http://www.golems.org
13  *
14  * Algorithm details and publications:
15  * http://www.golems.org/node/1570
16  *
17  * This file is provided under the following "BSD-style" License:
18  * Redistribution and use in source and binary forms, with or
19  * without modification, are permitted provided that the following
20  * conditions are met:
21  * * Redistributions of source code must retain the above copyright
22  * notice, this list of conditions and the following disclaimer.
23  * * Redistributions in binary form must reproduce the above
24  * copyright notice, this list of conditions and the following
25  * disclaimer in the documentation and/or other materials provided
26  * with the distribution.
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
28  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
29  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
32  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
35  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
36  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39  * POSSIBILITY OF SUCH DAMAGE.
40  */
41 
42 #pragma once
43 
44 #include <list>
45 #include <Eigen/Core>
46 
47 namespace API
48 {
49 
51  {
52  public:
53  KinoPathSegment(double length = 0.0) :
54  length(length)
55  {
56  }
57 
58  virtual ~KinoPathSegment() {}
59 
60  double getLength() const {
61  return length;
62  }
63  virtual Eigen::VectorXd getConfig(double s) const = 0;
64  virtual Eigen::VectorXd getTangent(double s) const = 0;
65  virtual Eigen::VectorXd getCurvature(double s) const = 0;
66  virtual std::list<double> getSwitchingPoints() const = 0;
67  virtual KinoPathSegment* clone() const = 0;
68 
69  double position;
70  protected:
71  double length;
72  };
73 
74 
75 
76  class KinoPath
77  {
78  public:
79  KinoPath(const std::list<Eigen::VectorXd> &path, double maxDeviation = 0.0);
80  KinoPath(const KinoPath &path);
81  ~KinoPath();
82  double getLength() const;
83  Eigen::VectorXd getConfig(double s) const;
84  Eigen::VectorXd getTangent(double s) const;
85  Eigen::VectorXd getCurvature(double s) const;
86  double getNextSwitchingPoint(double s, bool &discontinuity) const;
87  std::list<std::pair<double, bool> > getSwitchingPoints() const;
88  std::list<KinoPathSegment*>::const_iterator getKinoPathSegmentIt(double s) const;
89  std::list<KinoPathSegment*> getKinoPathSegments() const { return pathSegments;};
90  private:
91  KinoPathSegment* getKinoPathSegment(double &s) const;
92  double length;
93  std::list<std::pair<double, bool> > switchingPoints;
94  std::list<KinoPathSegment*> pathSegments;
95  };
96 }
Definition: kinopath.hpp:76
Definition: kinopath.hpp:50