task_map.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018, University of Edinburgh
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without specific
15 // prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 // POSSIBILITY OF SUCH DAMAGE.
28 //
29 
30 #ifndef EXOTICA_CORE_TASK_MAP_H_
31 #define EXOTICA_CORE_TASK_MAP_H_
32 
33 #include <map>
34 #include <string>
35 #include <vector>
36 
37 #include <Eigen/Dense> // Generally dense manipulations should be enough
38 
39 #include <exotica_core/factory.h> // The Factory template
40 #include <exotica_core/object.h> // The EXOTica base class
41 #include <exotica_core/property.h>
42 #include <exotica_core/scene.h>
44 
48 #define REGISTER_TASKMAP_TYPE(TYPE, DERIV) EXOTICA_CORE_REGISTER(exotica::TaskMap, TYPE, DERIV)
49 
50 namespace exotica
51 {
52 class TaskMap : public Object, Uncopyable, public virtual InstantiableBase
53 {
54 public:
55  virtual void InstantiateBase(const Initializer& init);
56 
57  virtual void AssignScene(ScenePtr scene);
58 
59  // Kinematic-only task maps (traditional) use the following update methods:
60  // x renamed to q in declaration: configuration only
61  virtual void Update(Eigen::VectorXdRefConst q, Eigen::VectorXdRef phi) = 0;
63  virtual void Update(Eigen::VectorXdRefConst q, Eigen::VectorXdRef phi, Eigen::MatrixXdRef jacobian, HessianRef hessian);
64 
65  //------------- New TaskMap API -------------
66  // x => full state of q,v
67  // u => controls
71 
72  virtual int TaskSpaceDim() = 0;
73  virtual int TaskSpaceJacobianDim() { return TaskSpaceDim(); }
74  virtual void PreUpdate() {}
75  virtual std::vector<TaskVectorEntry> GetLieGroupIndices() { return std::vector<TaskVectorEntry>(); }
76  std::vector<KinematicFrameRequest> GetFrames() const;
77 
78  std::vector<KinematicSolution> kinematics = std::vector<KinematicSolution>(1);
79  int id = -1;
80  int start = -1;
81  int length = -1;
82  int start_jacobian = -1;
83  int length_jacobian = -1;
84  bool is_used = false;
85 
86 protected:
87  std::vector<KinematicFrameRequest> frames_;
88  ScenePtr scene_ = nullptr;
89 };
90 
91 // Typedefines for some common functionality
92 typedef std::shared_ptr<TaskMap> TaskMapPtr;
93 typedef std::map<std::string, TaskMapPtr> TaskMapMap;
94 typedef std::vector<TaskMapPtr> TaskMapVec;
95 } // namespace exotica
96 
97 #endif // EXOTICA_CORE_TASK_MAP_H_
exotica::TaskMap::length_jacobian
int length_jacobian
Definition: task_map.h:83
exotica::TaskMap::TaskSpaceJacobianDim
virtual int TaskSpaceJacobianDim()
Definition: task_map.h:73
exotica::TaskMap::is_used
bool is_used
Definition: task_map.h:84
exotica::TaskMap::start_jacobian
int start_jacobian
Definition: task_map.h:82
exotica::Uncopyable
Definition: uncopyable.h:35
factory.h
exotica::TaskMapVec
std::vector< TaskMapPtr > TaskMapVec
Definition: task_map.h:94
exotica::TaskMap
Definition: task_map.h:52
property.h
task_space_vector.h
exotica::InstantiableBase
Definition: property.h:98
exotica
Definition: collision_scene.h:46
scene.h
exotica::TaskMap::GetFrames
std::vector< KinematicFrameRequest > GetFrames() const
Definition: task_map.cpp:57
exotica::ScenePtr
std::shared_ptr< Scene > ScenePtr
Definition: scene.h:246
exotica::Object
Definition: object.h:44
Eigen::VectorXdRef
Eigen::Ref< Eigen::VectorXd > VectorXdRef
Definition: conversions.h:55
Eigen::VectorXdRefConst
const typedef Eigen::Ref< const Eigen::VectorXd > & VectorXdRefConst
Convenience wrapper for storing references to sub-matrices/vectors.
Definition: conversions.h:53
exotica::TaskMap::AssignScene
virtual void AssignScene(ScenePtr scene)
Definition: task_map.cpp:37
kinematics
exotica::TaskMap::scene_
ScenePtr scene_
Definition: task_map.h:88
exotica::TaskMap::GetLieGroupIndices
virtual std::vector< TaskVectorEntry > GetLieGroupIndices()
Definition: task_map.h:75
Eigen::MatrixXdRef
Eigen::Ref< Eigen::MatrixXd > MatrixXdRef
Definition: conversions.h:56
exotica::HessianRef
Eigen::Ref< Hessian > HessianRef
Definition: conversions.h:161
exotica::Initializer
Definition: property.h:70
exotica::TaskMap::PreUpdate
virtual void PreUpdate()
Definition: task_map.h:74
exotica::TaskMap::length
int length
Definition: task_map.h:81
exotica::TaskMap::Update
virtual void Update(Eigen::VectorXdRefConst q, Eigen::VectorXdRef phi)=0
exotica::TaskMap::frames_
std::vector< KinematicFrameRequest > frames_
Definition: task_map.h:87
exotica::TaskMapMap
std::map< std::string, TaskMapPtr > TaskMapMap
The mapping by name of TaskMaps.
Definition: task_map.h:93
init
void init(const M_string &remappings)
exotica::TaskMap::InstantiateBase
virtual void InstantiateBase(const Initializer &init)
Definition: task_map.cpp:42
x
double x
exotica::TaskMapPtr
std::shared_ptr< TaskMap > TaskMapPtr
Task Map smart pointer.
Definition: task_map.h:92
exotica::TaskMap::start
int start
Definition: task_map.h:80
object.h
exotica::TaskMap::TaskSpaceDim
virtual int TaskSpaceDim()=0


exotica_core
Author(s): Yiming Yang, Michael Camilleri
autogenerated on Fri Aug 2 2024 08:43:02