franka_model_interface.h
Go to the documentation of this file.
1 // Copyright (c) 2017 Franka Emika GmbH
2 // Use of this source code is governed by the Apache-2.0 license, see LICENSE
3 #pragma once
4 
5 #include <array>
6 #include <string>
7 
8 #include <franka/model.h>
9 #include <franka/robot_state.h>
11 
12 namespace franka_hw {
13 
18  public:
19  FrankaModelHandle() = delete;
20 
28  FrankaModelHandle(const std::string& name, franka::Model& model, franka::RobotState& robot_state)
29  : name_(name), model_(&model), robot_state_(&robot_state) {}
30 
36  std::string getName() const noexcept { return name_; }
37 
45  std::array<double, 49> getMass() const { return model_->mass(*robot_state_); }
46 
63  std::array<double, 49> getMass(
64  const std::array<double, 7>& q,
65  const std::array<double, 9>& total_inertia,
66  double total_mass,
67  const std::array<double, 3>& F_x_Ctotal) const { // NOLINT (readability-identifier-naming)
68  return model_->mass(q, total_inertia, total_mass, F_x_Ctotal);
69  }
70 
79  std::array<double, 7> getCoriolis() const { return model_->coriolis(*robot_state_); }
80 
99  std::array<double, 7> getCoriolis(
100  const std::array<double, 7>& q,
101  const std::array<double, 7>& dq,
102  const std::array<double, 9>& total_inertia,
103  double total_mass,
104  const std::array<double, 3>& F_x_Ctotal) const { // NOLINT (readability-identifier-naming)
105  return model_->coriolis(q, dq, total_inertia, total_mass, F_x_Ctotal);
106  }
107 
118  std::array<double, 7> getGravity(const std::array<double, 3>& gravity_earth = {
119  {0., 0., -9.81}}) const {
120  return model_->gravity(*robot_state_, gravity_earth);
121  }
122 
139  std::array<double, 7> getGravity(
140  const std::array<double, 7>& q,
141  double total_mass,
142  const std::array<double, 3>& F_x_Ctotal, // NOLINT (readability-identifier-naming)
143  const std::array<double, 3>& gravity_earth = {{0., 0., -9.81}}) const {
144  return model_->gravity(q, total_mass, F_x_Ctotal, gravity_earth);
145  }
146 
159  std::array<double, 16> getPose(const franka::Frame& frame) const {
160  return model_->pose(frame, *robot_state_);
161  }
162 
178  std::array<double, 16> getPose(
179  const franka::Frame& frame,
180  const std::array<double, 7>& q,
181  const std::array<double, 16>& F_T_EE, // NOLINT (readability-identifier-naming)
182  const std::array<double, 16>& EE_T_K) // NOLINT (readability-identifier-naming)
183  const {
184  return model_->pose(frame, q, F_T_EE, EE_T_K);
185  }
186 
199  std::array<double, 42> getBodyJacobian(const franka::Frame& frame) const {
200  return model_->bodyJacobian(frame, *robot_state_);
201  }
202 
218  std::array<double, 42> getBodyJacobian(
219  const franka::Frame& frame,
220  const std::array<double, 7>& q,
221  const std::array<double, 16>& F_T_EE, // NOLINT (readability-identifier-naming)
222  const std::array<double, 16>& EE_T_K) // NOLINT (readability-identifier-naming)
223  const {
224  return model_->bodyJacobian(frame, q, F_T_EE, EE_T_K);
225  }
226 
239  std::array<double, 42> getZeroJacobian(const franka::Frame& frame) const {
240  return model_->zeroJacobian(frame, *robot_state_);
241  }
242 
258  std::array<double, 42> getZeroJacobian(
259  const franka::Frame& frame,
260  const std::array<double, 7>& q,
261  const std::array<double, 16>& F_T_EE, // NOLINT (readability-identifier-naming)
262  const std::array<double, 16>& EE_T_K) // NOLINT (readability-identifier-naming)
263  const {
264  return model_->zeroJacobian(frame, q, F_T_EE, EE_T_K);
265  }
266 
267  private:
268  std::string name_;
271 };
272 
277 };
278 
279 } // namespace franka_hw
std::array< double, 7 > getGravity(const std::array< double, 3 > &gravity_earth={{0., 0.,-9.81}}) const
Calculates the gravity vector from the current robot state.
std::array< double, 7 > getGravity(const std::array< double, 7 > &q, double total_mass, const std::array< double, 3 > &F_x_Ctotal, const std::array< double, 3 > &gravity_earth={{0., 0.,-9.81}}) const
Calculates the gravity vector from the given robot state.
const franka::RobotState * robot_state_
std::array< double, 16 > pose(Frame frame, const franka::RobotState &robot_state) const
std::array< double, 42 > zeroJacobian(Frame frame, const franka::RobotState &robot_state) const
std::array< double, 16 > getPose(const franka::Frame &frame, const std::array< double, 7 > &q, const std::array< double, 16 > &F_T_EE, const std::array< double, 16 > &EE_T_K) const
Gets the 4x4 pose matrix for the given frame in base frame, calculated from the given robot state...
std::array< double, 16 > getPose(const franka::Frame &frame) const
Gets the 4x4 pose matrix for the given frame in base frame, calculated from the current robot state...
std::array< double, 42 > getBodyJacobian(const franka::Frame &frame, const std::array< double, 7 > &q, const std::array< double, 16 > &F_T_EE, const std::array< double, 16 > &EE_T_K) const
Gets the 6x7 Jacobian for the given frame, relative to that frame.
std::array< double, 42 > bodyJacobian(Frame frame, const franka::RobotState &robot_state) const
FrankaModelHandle(const std::string &name, franka::Model &model, franka::RobotState &robot_state)
Creates an instance of a FrankaModelHandle.
std::array< double, 7 > gravity(const std::array< double, 7 > &q, double m_total, const std::array< double, 3 > &F_x_Ctotal, const std::array< double, 3 > &gravity_earth={{0., 0.,-9.81}}) const noexcept
std::array< double, 7 > getCoriolis(const std::array< double, 7 > &q, const std::array< double, 7 > &dq, const std::array< double, 9 > &total_inertia, double total_mass, const std::array< double, 3 > &F_x_Ctotal) const
Calculates the Coriolis force vector (state-space equation) from the given robot state: ...
std::array< double, 49 > mass(const franka::RobotState &robot_state) const noexcept
std::array< double, 42 > getZeroJacobian(const franka::Frame &frame, const std::array< double, 7 > &q, const std::array< double, 16 > &F_T_EE, const std::array< double, 16 > &EE_T_K) const
Gets the 6x7 Jacobian for the given joint relative to the base frame.
std::array< double, 42 > getZeroJacobian(const franka::Frame &frame) const
Gets the 6x7 Jacobian for the given joint relative to the base frame.
std::array< double, 49 > getMass(const std::array< double, 7 > &q, const std::array< double, 9 > &total_inertia, double total_mass, const std::array< double, 3 > &F_x_Ctotal) const
Calculates the 7x7 mass matrix from a given robot state.
std::array< double, 7 > coriolis(const franka::RobotState &robot_state) const noexcept
Hardware interface to perform calculations using the dynamic model of a robot.
Handle to perform calculations using the dynamic model of a robot.
std::string getName() const noexcept
Gets the name of the model handle.
std::array< double, 49 > getMass() const
Calculates the 7x7 mass matrix from the current robot state.
std::array< double, 7 > getCoriolis() const
Calculates the Coriolis force vector (state-space equation) from the current robot state: ...
std::array< double, 42 > getBodyJacobian(const franka::Frame &frame) const
Gets the 6x7 Jacobian for the given frame, relative to that frame.


franka_hw
Author(s): Franka Emika GmbH
autogenerated on Fri Oct 23 2020 03:47:05