|
Kinematics Animation Multithread
|
This class generates a finger of n links. The number of links and their properties are defined by a json configuration file. It also calculates the forwared kinematics of the finger given the rotation of its joints and its origin. More...
#include <finger.h>

Public Member Functions | |
| Finger () | |
| void | initialize (const std::string &name_id, const nlohmann::json &json_file, igl::opengl::glfw::Viewer *viewer, int mesh_idx) |
| Initialize finger. More... | |
| void | update (const std::vector< dm::JointState > &state) |
| Update state. More... | |
| std::vector< Eigen::MatrixXd > | get_vertices (void) |
| Get finger vertices. More... | |
| std::vector< int > | get_frame_ids (void) |
| Get the ids of the finger frames. More... | |
| void | load_mesh_files (igl::opengl::glfw::Viewer *viewer) |
| Load finger mesh files. More... | |
| std::vector< dm::JointState > | get_state (void) |
| Get current state of the finger. More... | |
Private Member Functions | |
| void | parse_json_file (const nlohmann::json &json_file) |
| Parses the finger configuration json file. More... | |
| void | initialize_mesh_containers (void) |
| Initialize mesh files. More... | |
| void | get_mesh_data (igl::opengl::glfw::Viewer *viewer) |
| Get mesh data. More... | |
| void | postprocess_meshes (void) |
| Postproccess meshes. More... | |
| void | initialize_state (const std::vector< double > &link_lengths, const dm::JointState &origin) |
| Initialize state. More... | |
Private Attributes | |
| std::string | m_name_id |
| Finger name id. More... | |
| dm::JointState | m_origin |
| Finger origin. More... | |
| std::vector< double > | m_link_lengths |
| The lengths of the finger links. More... | |
| std::vector< int > | m_frame_ids |
| The frame ids of the finger. More... | |
| std::string | m_joint_rel_filename = "share/joint.obj" |
| Joint mesh file. More... | |
| std::string | m_bone_rel_filename = "share/bone.obj" |
| Bone (link) mesh file. More... | |
| std::vector< std::string > | m_meshes_filenames |
| Mesh files for joints and bones(links). More... | |
| double | m_joint_scale = 0.05 |
| Joint scales. More... | |
| std::vector< double > | m_geom_scales |
| Finger scales. More... | |
| int | m_viewer_data_lower_idx |
| Viewer data lower idx see (Hand::m_viewer_data_lower_idx). More... | |
| int | m_viewer_data_upper_idx |
| Viewer data upper idx (see Hand::m_viewer_data_lower_idx). More... | |
| std::vector< Eigen::MatrixXd > | m_vertices_data_o |
| Vertices data (original). More... | |
| std::vector< Eigen::MatrixXd > | m_vertices_data_oh |
| Vertices data (original homogeneous). More... | |
| std::vector< Eigen::MatrixXd > | m_vertices_data |
| Vertices data. More... | |
| std::vector< Eigen::MatrixXi > | m_faces_data |
| Faces data. More... | |
| std::vector< dm::JointState > | m_state_vec |
| Finger state. More... | |
| int | m_state_size |
| State size. More... | |
| std::vector< Eigen::Matrix4d > | m_local_transform |
| Local transforamation matrix. More... | |
| std::vector< Eigen::Matrix4d > | m_global_transform |
| Global transforamation matrix. More... | |
This class generates a finger of n links. The number of links and their properties are defined by a json configuration file. It also calculates the forwared kinematics of the finger given the rotation of its joints and its origin.
|
inline |
Get the ids of the finger frames.
Definition at line 36 of file finger.h.
|
private |
Get mesh data.
It passes a copy of the vertex data from the viewer to the local member variables of the finger instance.
| viewer | Pointer to the viewer object. |
Definition at line 197 of file finger.cpp.

|
inline |
|
inline |
Get finger vertices.
Definition at line 33 of file finger.h.
| void Finger::initialize | ( | const std::string & | name_id, |
| const nlohmann::json & | json_file, | ||
| igl::opengl::glfw::Viewer * | viewer, | ||
| int | mesh_idx | ||
| ) |
Initialize finger.
This initialization function first parses the finger configuration file (see Hand::m_config_rel_path) and sets up the properties of the finger. It also loads and processes the meshes for the links and the joints and initializes the finger state.
| name_id | The name id of the finger. |
| json_file | The json finger configuration file. |
| viewer | Pointer to the viewer handle. |
| mesh_idx | The mesh index. |
Definition at line 13 of file finger.cpp.

|
private |
Initialize mesh files.
It initializes the mesh containers for its link and joint based on their properties defined in the configuration file Hand::m_config_rel_path.
Definition at line 160 of file finger.cpp.

|
private |
Initialize state.
It initializes the state of the finger based on the link_lengths and their origins as defined from the configuration file (Hand::m_config_rel_path)
| link_lengths | The lengths of the links. |
| origin | The origins of the links. |
Definition at line 130 of file finger.cpp.

| void Finger::load_mesh_files | ( | igl::opengl::glfw::Viewer * | viewer | ) |
Load finger mesh files.
Simply loads the meshes to the viewer.
| viewer | Pointer to the viewer object. |
Definition at line 184 of file finger.cpp.

|
private |
Parses the finger configuration json file.
Simply parses the finger configuration file.
| json_file | The json file namek |
Definition at line 248 of file finger.cpp.

|
private |
Postproccess meshes.
It sets the scale of the meshes based on the links length and the joints desired size.
Definition at line 213 of file finger.cpp.

| void Finger::update | ( | const std::vector< dm::JointState > & | state | ) |
Update state.
This function updates the finger's state (position and orientation of its links and joints). It performs the forward kinematics for each link of the finger. It first calculates the local transform of each links with respect to each previous link. Then it calculates the global transforms (with respect to the hand's base frame
) by performing and iterative compound transormation (post-miltiply rules, see Forward Kinematics Spong * Robot Modeling and Control). The frame conventions and the definitions of the rotation and translation matrices used are given in the handover document.
| state | The vector of joint euler angles and postions as defined in dm::JointStateu. |
Definition at line 60 of file finger.cpp.


|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Viewer data lower idx see (Hand::m_viewer_data_lower_idx).
|
private |
Viewer data upper idx (see Hand::m_viewer_data_lower_idx).