eff_orientation.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018-2020, University of Edinburgh, University of Oxford
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 
31 
33 
34 namespace exotica
35 {
36 void EffOrientation::Instantiate(const EffOrientationInitializer& init)
37 {
40 }
41 
42 std::vector<TaskVectorEntry> EffOrientation::GetLieGroupIndices()
43 {
44  std::vector<TaskVectorEntry> ret;
45  ret.reserve(kinematics[0].Phi.rows());
46  for (int i = 0; i < kinematics[0].Phi.rows(); ++i)
47  {
48  ret.emplace_back(TaskVectorEntry(start + i * stride_, rotation_type_));
49  }
50  return ret;
51 }
52 
54 {
55  if (phi.rows() != kinematics[0].Phi.rows() * stride_) ThrowNamed("Wrong size of Phi! Expected " << kinematics[0].Phi.rows() * stride_ << ", but received " << phi.rows());
56  for (int i = 0; i < kinematics[0].Phi.rows(); ++i)
57  {
58  phi.segment(i * stride_, stride_) = SetRotation(kinematics[0].Phi(i).M, rotation_type_);
59  }
60 }
61 
63 {
64  if (phi.rows() != kinematics[0].Phi.rows() * stride_) ThrowNamed("Wrong size of Phi! Expected " << kinematics[0].Phi.rows() * stride_ << ", but received " << phi.rows());
65  if (jacobian.rows() != kinematics[0].jacobian.rows() * 3 || jacobian.cols() != kinematics[0].jacobian(0).data.cols()) ThrowNamed("Wrong size of jacobian! " << kinematics[0].jacobian(0).data.cols());
66  for (int i = 0; i < kinematics[0].Phi.rows(); ++i)
67  {
68  phi.segment(i * stride_, stride_) = SetRotation(kinematics[0].Phi(i).M, rotation_type_);
69  jacobian.middleRows<3>(i * 3) = kinematics[0].jacobian[i].data.bottomRows<3>();
70  }
71 }
72 
74 {
75  if (phi.rows() != kinematics[0].Phi.rows() * stride_) ThrowNamed("Wrong size of Phi! Expected " << kinematics[0].Phi.rows() * stride_ << ", but received " << phi.rows());
76  if (jacobian.rows() != kinematics[0].jacobian.rows() * 3 || jacobian.cols() != kinematics[0].jacobian(0).data.cols()) ThrowNamed("Wrong size of jacobian! " << kinematics[0].jacobian(0).data.cols());
77  for (int i = 0; i < kinematics[0].Phi.rows(); ++i)
78  {
79  phi.segment(i * stride_, stride_) = SetRotation(kinematics[0].Phi(i).M, rotation_type_);
80  jacobian.middleRows<3>(i * 3) = kinematics[0].jacobian[i].data.bottomRows<3>();
81 
82  for (int j = 0; j < 3; ++j)
83  {
84  hessian(i * 3 + j).block(0, 0, jacobian.cols(), jacobian.cols()) = kinematics[0].hessian[i](j + 3);
85  }
86  }
87 }
88 
90 {
91  return kinematics[0].Phi.rows() * stride_;
92 }
93 
95 {
96  return kinematics[0].Phi.rows() * 3;
97 }
98 
100 {
101  return rotation_type_;
102 }
103 
104 } // namespace exotica
Eigen::Ref< Eigen::VectorXd > VectorXdRef
const RotationType & get_rotation_type() const
void Update(Eigen::VectorXdRefConst x, Eigen::VectorXdRef phi) override
RotationType GetRotationTypeFromString(const std::string &rotation_type)
#define ThrowNamed(m)
void Instantiate(const EffOrientationInitializer &init) override
std::vector< TaskVectorEntry > GetLieGroupIndices() override
const Eigen::Ref< const Eigen::VectorXd > & VectorXdRefConst
int TaskSpaceJacobianDim() override
Eigen::VectorXd SetRotation(const KDL::Rotation &data, RotationType type)
int GetRotationTypeLength(const RotationType &type)
Eigen::Ref< Hessian > HessianRef
Eigen::Ref< Eigen::MatrixXd > MatrixXdRef
REGISTER_TASKMAP_TYPE("EffOrientation", exotica::EffOrientation)


exotica_core_task_maps
Author(s): Yiming Yang, Michael Camilleri
autogenerated on Sat Apr 10 2021 02:36:09