ik_solver_example.h
Go to the documentation of this file.
1 // -- BEGIN LICENSE BLOCK ----------------------------------------------
2 // Copyright 2021 FZI Forschungszentrum Informatik
3 // Created on behalf of Universal Robots A/S
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 // -- END LICENSE BLOCK ------------------------------------------------
17 
18 //-----------------------------------------------------------------------------
25 //-----------------------------------------------------------------------------
26 
27 #pragma once
28 
30 #include <kdl/chainiksolverpos_lma.hpp>
31 #include <kdl/chain.hpp>
32 #include <memory>
33 
35 {
42 class ExampleIKSolver : public IKSolver
43 {
44 public:
47 
54  bool init(const KDL::Chain& robot_chain, ros::NodeHandle&, ros::NodeHandle&) override
55  {
56  robot_chain_ = robot_chain;
57  lma_solver_ = std::make_unique<KDL::ChainIkSolverPos_LMA>(robot_chain_);
58  return true;
59  };
60 
65  virtual int cartToJnt(const KDL::JntArray& q_init, const KDL::Frame& goal, KDL::JntArray& q_out) override
66  {
67  return lma_solver_->CartToJnt(q_init, goal, q_out);
68  };
69 
70 private:
71  std::unique_ptr<KDL::ChainIkSolverPos_LMA> lma_solver_;
73 };
74 } // namespace ros_controllers_cartesian
Base class for Inverse Kinematics (IK) solvers.
A wrapper around KDL&#39;s Levenberg Marquardt solver.
bool init(const KDL::Chain &robot_chain, ros::NodeHandle &, ros::NodeHandle &) override
Initialize the solver.
std::unique_ptr< KDL::ChainIkSolverPos_LMA > lma_solver_
virtual int cartToJnt(const KDL::JntArray &q_init, const KDL::Frame &goal, KDL::JntArray &q_out) override
Compute Inverse Kinematics with KDL&#39;s Levenberg Marquardt solver.


cartesian_trajectory_controller
Author(s):
autogenerated on Thu Feb 23 2023 03:10:48