1#include "../include/finger.h"
14 const nlohmann::json& json_file, igl::opengl::glfw::Viewer *viewer,
75 Eigen::Matrix4d local_transform = Eigen::Matrix4d::Identity();
78 local_transform.block<3, 1>(0, 3) =
m_state_vec.at(i).position;
81 local_transform.block<3, 3>(0, 0) =
110 Eigen::MatrixXd joint_vert =
114 Eigen::MatrixXd link_vert =
148 m_state_vec.at(i).position(0) = link_lengths.at(idx);
219 Eigen::Matrix3d scale_matrix;
231 Eigen::MatrixXd mesh_i_oh = Eigen::MatrixXd::Ones(mesh_i.rows(),
235 mesh_i_oh.col(0) = mesh_i.col(0);
236 mesh_i_oh.col(1) = mesh_i.col(1);
237 mesh_i_oh.col(2) = mesh_i.col(2);
251 auto lengths_json = json_file[
m_name_id][
"Lengths"];
254 auto frames_json = json_file[
m_name_id][
"Frames"];
257 auto origin_position_json = json_file[
m_name_id][
"Origin"][
"Position"];
260 auto origin_euler_json = json_file[
m_name_id][
"Origin"][
"Euler"];
262 for(
size_t i = 0; i < lengths_json.size(); i++)
278 for(
size_t i = 0; i < frames_json.size(); i++)
static Eigen::Matrix3d rotation(double phi, double theta, double psi)
Euler rotation matrix z-y'-x''.
void initialize_state(const std::vector< double > &link_lengths, const dm::JointState &origin)
Initialize state.
void initialize(const std::string &name_id, const nlohmann::json &json_file, igl::opengl::glfw::Viewer *viewer, int mesh_idx)
Initialize finger.
int m_viewer_data_lower_idx
Viewer data lower idx see (Hand::m_viewer_data_lower_idx).
std::vector< int > m_frame_ids
The frame ids of the finger.
std::string m_joint_rel_filename
Joint mesh file.
std::vector< Eigen::MatrixXd > m_vertices_data_o
Vertices data (original).
double m_joint_scale
Joint scales.
std::vector< Eigen::MatrixXd > m_vertices_data
Vertices data.
std::vector< double > m_link_lengths
The lengths of the finger links.
void load_mesh_files(igl::opengl::glfw::Viewer *viewer)
Load finger mesh files.
std::vector< Eigen::Matrix4d > m_global_transform
Global transforamation matrix.
std::string m_bone_rel_filename
Bone (link) mesh file.
void postprocess_meshes(void)
Postproccess meshes.
std::vector< std::string > m_meshes_filenames
Mesh files for joints and bones(links).
std::vector< Eigen::MatrixXi > m_faces_data
Faces data.
void parse_json_file(const nlohmann::json &json_file)
Parses the finger configuration json file.
int m_state_size
State size.
std::vector< dm::JointState > m_state_vec
Finger state.
dm::JointState m_origin
Finger origin.
void update(const std::vector< dm::JointState > &state)
Update state.
void get_mesh_data(igl::opengl::glfw::Viewer *viewer)
Get mesh data.
std::vector< Eigen::Matrix4d > m_local_transform
Local transforamation matrix.
std::string m_name_id
Finger name id.
void initialize_mesh_containers(void)
Initialize mesh files.
std::vector< double > m_geom_scales
Finger scales.
std::vector< Eigen::MatrixXd > m_vertices_data_oh
Vertices data (original homogeneous).
int m_viewer_data_upper_idx
Viewer data upper idx (see Hand::m_viewer_data_lower_idx).