libfranka 0.21.3
FCI C++ API
Loading...
Searching...
No Matches
model.h
Go to the documentation of this file.
1// Copyright (c) 2023 Franka Robotics 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 <memory>
7
8#include <franka/robot.h>
10
16namespace franka {
17
18class RobotModelBase;
19
23enum class Frame { // NOLINT(performance-enum-size)
24 kJoint1,
25 kJoint2,
26 kJoint3,
27 kJoint4,
28 kJoint5,
29 kJoint6,
30 kJoint7,
31 kFlange,
32 kEndEffector,
33 kStiffness
34};
35
45Frame operator++(Frame& frame, int /* dummy */) noexcept;
46
50class Model {
51 public:
63 explicit Model(const std::string& urdf_model);
64
73 explicit Model(std::unique_ptr<RobotModelBase> robot_model);
74
80 Model(Model&& model) noexcept;
81
89 Model& operator=(Model&& model) noexcept;
90
94 ~Model() noexcept;
95
106 std::array<double, 16> pose(Frame frame, const franka::RobotState& robot_state) const;
107
120 std::array<double, 16> pose(
121 Frame frame,
122 const std::array<double, 7>& q, // NOLINT(readability-identifier-length)
123 const std::array<double, 16>& F_T_EE, // NOLINT(readability-identifier-naming)
124 const std::array<double, 16>& EE_T_K) // NOLINT(readability-identifier-naming)
125 const;
126
137 std::array<double, 42> bodyJacobian(Frame frame, const franka::RobotState& robot_state) const;
138
151 std::array<double, 42> bodyJacobian(
152 Frame frame,
153 const std::array<double, 7>& q, // NOLINT(readability-identifier-length)
154 const std::array<double, 16>& F_T_EE, // NOLINT(readability-identifier-naming)
155 const std::array<double, 16>& EE_T_K) // NOLINT(readability-identifier-naming)
156 const;
157
168 std::array<double, 42> zeroJacobian(Frame frame, const franka::RobotState& robot_state) const;
169
182 std::array<double, 42> zeroJacobian(
183 Frame frame,
184 const std::array<double, 7>& q, // NOLINT(readability-identifier-length)
185 const std::array<double, 16>& F_T_EE, // NOLINT(readability-identifier-naming)
186 const std::array<double, 16>& EE_T_K) // NOLINT(readability-identifier-naming)
187 const;
188
196 std::array<double, 49> mass(const franka::RobotState& robot_state) const noexcept;
197
211 std::array<double, 49> mass(
212 const std::array<double, 7>& q, // NOLINT(readability-identifier-length)
213 const std::array<double, 9>& I_total, // NOLINT(readability-identifier-naming)
214 double m_total,
215 const std::array<double, 3>& F_x_Ctotal) // NOLINT(readability-identifier-naming)
216 const noexcept;
217
226 std::array<double, 7> coriolis(const franka::RobotState& robot_state) const noexcept;
227
246 [[deprecated(
247 "Use coriolis(q, dq, i_total, m_total, f_x_ctotal, g_earth) instead")]] std::array<double, 7>
248 coriolis(const std::array<double, 7>& q, // NOLINT(readability-identifier-length)
249 const std::array<double, 7>& dq, // NOLINT(readability-identifier-length)
250 const std::array<double, 9>& I_total, // NOLINT(readability-identifier-naming)
251 double m_total,
252 const std::array<double, 3>& F_x_Ctotal) // NOLINT(readability-identifier-naming)
253 const noexcept;
254
272 std::array<double, 7> coriolis(
273 const std::array<double, 7>& q, // NOLINT(readability-identifier-length)
274 const std::array<double, 7>& dq, // NOLINT(readability-identifier-length)
275 const std::array<double, 9>& I_total, // NOLINT(readability-identifier-naming)
276 double m_total,
277 const std::array<double, 3>& F_x_Ctotal, // NOLINT(readability-identifier-naming)
278 const std::array<double, 3>& gravity_earth) const noexcept;
279
293 std::array<double, 7> gravity(
294 const std::array<double, 7>& q, // NOLINT(readability-identifier-length)
295 double m_total,
296 const std::array<double, 3>& F_x_Ctotal, // NOLINT(readability-identifier-naming)
297 const std::array<double, 3>& gravity_earth = {{0., 0., -9.81}}) const noexcept;
298
307 std::array<double, 7> gravity(const franka::RobotState& robot_state,
308 const std::array<double, 3>& gravity_earth) const noexcept;
309
317 std::array<double, 7> gravity(const franka::RobotState& robot_state) const noexcept;
318
320 Model(const Model&) = delete;
321 Model& operator=(const Model&) = delete;
323
324 private:
325 std::unique_ptr<RobotModelBase> robot_model_;
326};
327
328} // namespace franka
Calculates poses of joints and dynamic properties of the robot.
Definition model.h:50
std::array< double, 42 > zeroJacobian(Frame frame, const franka::RobotState &robot_state) const
Gets the 6x7 Jacobian for the given joint relative to the base frame.
~Model() noexcept
Unloads the model library.
std::array< double, 7 > gravity(const franka::RobotState &robot_state, const std::array< double, 3 > &gravity_earth) const noexcept
Calculates the gravity vector.
std::array< double, 49 > mass(const franka::RobotState &robot_state) const noexcept
Calculates the 7x7 mass matrix.
Model(const std::string &urdf_model)
Creates a new Model instance.
Model(std::unique_ptr< RobotModelBase > robot_model)
Creates a new Model instance only for the tests.
Model(Model &&model) noexcept
Move-constructs a new Model instance.
std::array< double, 7 > coriolis(const franka::RobotState &robot_state) const noexcept
Calculates the Coriolis force vector (state-space equation): , in .
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
Calculates the gravity vector.
std::array< double, 16 > pose(Frame frame, const franka::RobotState &robot_state) const
Gets the 4x4 pose matrix for the given frame in base frame.
std::array< double, 7 > gravity(const franka::RobotState &robot_state) const noexcept
Calculates the gravity vector using the robot state.
Model & operator=(Model &&model) noexcept
Move-assigns this Model from another Model instance.
std::array< double, 42 > bodyJacobian(Frame frame, const franka::RobotState &robot_state) const
Gets the 6x7 Jacobian for the given frame, relative to that frame.
Frame
Enumerates the seven joints, the flange, and the end effector of a robot.
Definition model.h:23
Frame operator++(Frame &frame, int) noexcept
Post-increments the given Frame by one.
Contains the franka::Robot type.
Contains the franka::RobotState types.
Describes the robot state.
Definition robot_state.h:34