|
Kinematics Animation Multithread
|
#include <hand.h>
Public Member Functions | |
| Hand () | |
| Empty constructor. More... | |
| void | initialize (igl::opengl::glfw::Viewer *viewer, Exoskeleton *exo_handler, AnimatedHand *anim_hand, bool type, const Eigen::Vector3d &origin) |
| Initialize the hand. More... | |
| void | update (const std::vector< Eigen::Vector3d > &euler_id, igl::opengl::glfw::Viewer &viewer) |
| It updates the hand vertices based on the euler angles for its skeleton joints. These are fed throught the AnimatedHand::EulerID struct. Based on the defined mapping it performs the forward kinematics for each finger and calcualtes all the hand vertices. More... | |
Private Member Functions | |
| template<typename T > | |
| std::vector< T > | concatenate_data (const std::vector< std::vector< T > > &data) |
| Concatenates vertex or face data to a std vector. More... | |
| Eigen::MatrixXd | translation_matrix (const Eigen::Vector3d &offset, size_t vert_num) |
| This function offset a set of vertices by a given offset. More... | |
Private Attributes | |
| std::string | m_config_rel_path = "share/hand_config.json" |
| std::filesystem::path | m_config_abs_path |
| Absolute name of hand's configuration file. More... | |
| std::vector< std::string > | m_hand_config = {"Thumb", "Index", "Middle"} |
| Hand configuration. More... | |
| std::vector< Finger > | m_fingers |
| Vector of finger handles. More... | |
| Eigen::Matrix3d | m_hand_rot |
| Eigen::Vector3d | m_hand_origin |
| Hand origin with respect to the inertial frame of reference | |
| std::vector< Eigen::MatrixXd > | m_vertex_data |
| Vertex data container. More... | |
| Eigen::MatrixXd | m_concatenated_hand_vertex_data |
| Concatenated hand vertex data. More... | |
| int | m_viewer_data_lower_idx |
| int | m_viewer_data_upper_idx |
| int | m_data_list_size |
Class Hand.
This class defines the hand stucture. It calls the finger class (see Finger::) to compose the three fingers and develop the full kinematic model of the hand.
|
private |
Concatenates vertex or face data to a std vector.
This function is used to concatenate Eigen matrices. More specifically each link of the finger is imported as an Eigen::Matrix. The total finger is then a vector of Eigen matrices. The whole hand is a vector of fingers or a vector of a vector of links. This function takes this vector of vectors of links and converts to a vector of fingers.
| T | The type of Eigen::Matrix to concatenate (MatrixXd, MatrixXi etc). |
| data | The vector of vectors of matrices. |
Definition at line 108 of file hand.h.
| void Hand::initialize | ( | igl::opengl::glfw::Viewer * | viewer, |
| Exoskeleton * | exo_handler, | ||
| AnimatedHand * | anim_hand, | ||
| bool | type, | ||
| const Eigen::Vector3d & | origin | ||
| ) |
Initialize the hand.
The function first reads the hand configuration file (m_config_rel_path) and sets up all the its fingers.
| viewer | Pointer to the viewer object. |
| exo_handler | Point to the exoskeleton object. |
| anim_hand | Pointer to the hand animation object. |
| type | Defines whether the hand is the left one (0) or the right one (1). |
| origin | Defines the origin of the hand |
Definition at line 15 of file hand.cpp.

|
private |
This function offset a set of vertices by a given offset.
This is not a homogenous transformation matrix. Instead it is used for shifting a matrix of vertices (as defined by libigl) by a given offset.
| offset | The offset to shift the matrix of vertices. |
| vert_num | The number of matrices. |
Definition at line 135 of file hand.cpp.

| void Hand::update | ( | const std::vector< Eigen::Vector3d > & | euler_id, |
| igl::opengl::glfw::Viewer & | viewer | ||
| ) |
It updates the hand vertices based on the euler angles for its skeleton joints. These are fed throught the AnimatedHand::EulerID struct. Based on the defined mapping it performs the forward kinematics for each finger and calcualtes all the hand vertices.
| euler_id | The custom EulerID structure as described in AnimatedHand::EulerID. |
| viewer | Pointer to the viewer object. |
Definition at line 72 of file hand.cpp.


|
private |
|
private |
|
private |
Relative name of hand's configuration file. This is a json file that contains the geometric characteristics of each finger (link lengths of the finger, ordered as [proximal, middle, distal]), the position and orientation of the finger's frame with respect to the local hand frame
with
and the finger's frame names as illustrated in the figure below.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Viewer data lower and upper idx. The viewer object of libigl stores the vertex data into a container. This includes ALL the bodies that are rendered on the screen. For setting the vertices when they are updated it is important to know where the vertices for each object are located inside this container. These two variables define the lower and upper index for these specific instance of the hand. This way when we set the data for this hand to the viewer.data_list we know what vertices to update. For more info on how libigl handles multiple meshes at https://github.com/libigl/libigl/blob/main/tutorial/107_MultipleMeshes/main.cpp.