libfranka 0.15.0
FCI C++ API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
franka::Model Class Reference

Calculates poses of joints and dynamic properties of the robot. More...

#include <model.h>

Public Member Functions

 Model (franka::Network &network, const std::string &urdf_model)
 Creates a new Model instance.
 
 Model (franka::Network &network, 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.
 
Modeloperator= (Model &&model) noexcept
 Move-assigns this Model from another Model instance.
 
 ~Model () noexcept
 Unloads the model library.
 
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, 16 > pose (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.
 
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.
 
std::array< double, 42 > bodyJacobian (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 > zeroJacobian (Frame frame, const franka::RobotState &robot_state) const
 Gets the 6x7 Jacobian for the given joint relative to the base frame.
 
std::array< double, 42 > zeroJacobian (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, 49 > mass (const franka::RobotState &robot_state) const noexcept
 Calculates the 7x7 mass matrix.
 
std::array< double, 49 > mass (const std::array< double, 7 > &q, const std::array< double, 9 > &I_total, double m_total, const std::array< double, 3 > &F_x_Ctotal) const noexcept
 Calculates the 7x7 mass matrix.
 
std::array< double, 7 > coriolis (const franka::RobotState &robot_state) const noexcept
 Calculates the Coriolis force vector (state-space equation): \( c= C \times dq\), in \([Nm]\).
 
std::array< double, 7 > coriolis (const std::array< double, 7 > &q, const std::array< double, 7 > &dq, const std::array< double, 9 > &I_total, double m_total, const std::array< double, 3 > &F_x_Ctotal) const noexcept
 Calculates the Coriolis force vector (state-space equation): \( c= C \times dq\), in \([Nm]\).
 
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, 7 > gravity (const franka::RobotState &robot_state, const std::array< double, 3 > &gravity_earth) const noexcept
 Calculates the gravity vector.
 
std::array< double, 7 > gravity (const franka::RobotState &robot_state) const noexcept
 Calculates the gravity vector using the robot state.
 

Detailed Description

Calculates poses of joints and dynamic properties of the robot.

Examples
cartesian_impedance_control.cpp, force_control.cpp, joint_impedance_control.cpp, and print_joint_poses.cpp.

Constructor & Destructor Documentation

◆ Model() [1/3]

franka::Model::Model ( franka::Network &  network,
const std::string &  urdf_model 
)
explicit

Creates a new Model instance.

This constructor is for internal use only.

See also
Robot::loadModel
Parameters
[in]networkFor internal use.
Exceptions
ModelExceptionif the model library cannot be loaded.

◆ Model() [2/3]

franka::Model::Model ( franka::Network &  network,
std::unique_ptr< RobotModelBase robot_model 
)
explicit

Creates a new Model instance only for the tests.

This constructor is for the unittests for enabling mocks.

Parameters
[in]networkFor internal use.
[in]robot_modelunique pointer to the mocked robot_model

◆ Model() [3/3]

franka::Model::Model ( Model &&  model)
noexcept

Move-constructs a new Model instance.

Parameters
[in]modelOther Model instance.

Member Function Documentation

◆ bodyJacobian() [1/2]

std::array< double, 42 > franka::Model::bodyJacobian ( Frame  frame,
const franka::RobotState robot_state 
) const

Gets the 6x7 Jacobian for the given frame, relative to that frame.

The Jacobian is represented as a 6x7 matrix in column-major format.

Parameters
[in]frameThe desired frame.
[in]robot_stateState from which the pose should be calculated.
Returns
Vectorized 6x7 Jacobian, column-major.

◆ bodyJacobian() [2/2]

std::array< double, 42 > franka::Model::bodyJacobian ( 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.

The Jacobian is represented as a 6x7 matrix in column-major format.

Parameters
[in]frameThe desired frame.
[in]qJoint position.
[in]F_T_EEEnd effector in flange frame.
[in]EE_T_KStiffness frame K in the end effector frame.
Returns
Vectorized 6x7 Jacobian, column-major.

◆ coriolis() [1/2]

std::array< double, 7 > franka::Model::coriolis ( const franka::RobotState robot_state) const
noexcept

Calculates the Coriolis force vector (state-space equation): \( c= C \times dq\), in \([Nm]\).

Parameters
[in]robot_stateState from which the Coriolis force vector should be calculated.
Returns
Coriolis force vector.
Examples
cartesian_impedance_control.cpp.

◆ coriolis() [2/2]

std::array< double, 7 > franka::Model::coriolis ( const std::array< double, 7 > &  q,
const std::array< double, 7 > &  dq,
const std::array< double, 9 > &  I_total,
double  m_total,
const std::array< double, 3 > &  F_x_Ctotal 
) const
noexcept

Calculates the Coriolis force vector (state-space equation): \( c= C \times dq\), in \([Nm]\).

Parameters
[in]qJoint position.
[in]dqJoint velocity.
[in]I_totalInertia of the attached total load including end effector, relative to center of mass, given as vectorized 3x3 column-major matrix. Unit: \([kg \times m^2]\).
[in]m_totalWeight of the attached total load including end effector. Unit: \([kg]\).
[in]F_x_CtotalTranslation from flange to center of mass of the attached total load. Unit: \([m]\).
Returns
Coriolis force vector.

◆ gravity() [1/3]

std::array< double, 7 > franka::Model::gravity ( const franka::RobotState robot_state) const
noexcept

Calculates the gravity vector using the robot state.

Unit: \([Nm]\).

Parameters
[in]robot_stateState from which the gravity vector should be calculated.
Returns
Gravity vector.

◆ gravity() [2/3]

std::array< double, 7 > franka::Model::gravity ( const franka::RobotState robot_state,
const std::array< double, 3 > &  gravity_earth 
) const
noexcept

Calculates the gravity vector.

Unit: \([Nm]\).

Parameters
[in]robot_stateState from which the gravity vector should be calculated.
[in]gravity_earthEarth's gravity vector. Unit: \(\frac{m}{s^2}\).
Returns
Gravity vector.

◆ gravity() [3/3]

std::array< double, 7 > franka::Model::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.

Unit: \([Nm]\).

Parameters
[in]qJoint position.
[in]m_totalWeight of the attached total load including end effector. Unit: \([kg]\).
[in]F_x_CtotalTranslation from flange to center of mass of the attached total load. Unit: \([m]\).
[in]gravity_earthEarth's gravity vector. Unit: \(\frac{m}{s^2}\). Default to {0.0, 0.0, -9.81}.
Returns
Gravity vector.
Examples
force_control.cpp.

◆ mass() [1/2]

std::array< double, 49 > franka::Model::mass ( const franka::RobotState robot_state) const
noexcept

Calculates the 7x7 mass matrix.

Unit: \([kg \times m^2]\).

Parameters
[in]robot_stateState from which the mass matrix should be calculated.
Returns
Vectorized 7x7 mass matrix, column-major.

◆ mass() [2/2]

std::array< double, 49 > franka::Model::mass ( const std::array< double, 7 > &  q,
const std::array< double, 9 > &  I_total,
double  m_total,
const std::array< double, 3 > &  F_x_Ctotal 
) const
noexcept

Calculates the 7x7 mass matrix.

Unit: \([kg \times m^2]\).

Parameters
[in]qJoint position.
[in]I_totalInertia of the attached total load including end effector, relative to center of mass, given as vectorized 3x3 column-major matrix. Unit: \([kg \times m^2]\).
[in]m_totalWeight of the attached total load including end effector. Unit: \([kg]\).
[in]F_x_CtotalTranslation from flange to center of mass of the attached total load. Unit: \([m]\).
Returns
Vectorized 7x7 mass matrix, column-major.

◆ operator=()

Model & franka::Model::operator= ( Model &&  model)
noexcept

Move-assigns this Model from another Model instance.

Parameters
[in]modelOther Model instance.
Returns
Model instance.

◆ pose() [1/2]

std::array< double, 16 > franka::Model::pose ( Frame  frame,
const franka::RobotState robot_state 
) const

Gets the 4x4 pose matrix for the given frame in base frame.

The pose is represented as a 4x4 matrix in column-major format.

Parameters
[in]frameThe desired frame.
[in]robot_stateState from which the pose should be calculated.
Returns
Vectorized 4x4 pose matrix, column-major.

◆ pose() [2/2]

std::array< double, 16 > franka::Model::pose ( 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.

The pose is represented as a 4x4 matrix in column-major format.

Parameters
[in]frameThe desired frame.
[in]qJoint position.
[in]F_T_EEEnd effector in flange frame.
[in]EE_T_KStiffness frame K in the end effector frame.
Returns
Vectorized 4x4 pose matrix, column-major.

◆ zeroJacobian() [1/2]

std::array< double, 42 > franka::Model::zeroJacobian ( Frame  frame,
const franka::RobotState robot_state 
) const

Gets the 6x7 Jacobian for the given joint relative to the base frame.

The Jacobian is represented as a 6x7 matrix in column-major format.

Parameters
[in]frameThe desired frame.
[in]robot_stateState from which the pose should be calculated.
Returns
Vectorized 6x7 Jacobian, column-major.
Examples
cartesian_impedance_control.cpp, and force_control.cpp.

◆ zeroJacobian() [2/2]

std::array< double, 42 > franka::Model::zeroJacobian ( 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.

The Jacobian is represented as a 6x7 matrix in column-major format.

Parameters
[in]frameThe desired frame.
[in]qJoint position.
[in]F_T_EEEnd effector in flange frame.
[in]EE_T_KStiffness frame K in the end effector frame.
Returns
Vectorized 6x7 Jacobian, column-major.

The documentation for this class was generated from the following file: