Skip to content

Commit

Permalink
refactor: declare varaibles as late as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
HiroIshida committed Jun 4, 2024
1 parent 4ae1ce5 commit 9d8d208
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/kinematics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,6 @@ KinematicModel::get_jacobian(size_t elink_id,
erot_inverse = erot.inverse();
}

Transform tf_rlink_to_blink, tf_blink_to_rlink, tf_blink_to_elink;
Vector3 rpy_rlink_to_blink;
if (with_base) {
this->get_link_pose(this->root_link_id_, tf_rlink_to_blink);
tf_blink_to_rlink = tf_rlink_to_blink.inverse();
rpy_rlink_to_blink = tf_rlink_to_blink.rotation.getRPY();
tf_blink_to_elink = pose_transform(tf_blink_to_rlink, tf_rlink_to_elink);
}

// Jacobian computation
Eigen::MatrixXd jacobian = Eigen::MatrixXd::Zero(dim_jacobi, dim_dof);

Expand Down Expand Up @@ -188,6 +179,15 @@ KinematicModel::get_jacobian(size_t elink_id,
}
}

Transform tf_rlink_to_blink, tf_blink_to_rlink, tf_blink_to_elink;
Vector3 rpy_rlink_to_blink;
if (with_base) {
this->get_link_pose(this->root_link_id_, tf_rlink_to_blink);
tf_blink_to_rlink = tf_rlink_to_blink.inverse();
rpy_rlink_to_blink = tf_rlink_to_blink.rotation.getRPY();
tf_blink_to_elink = pose_transform(tf_blink_to_rlink, tf_rlink_to_elink);
}

if (with_base) {
const size_t dim_dof = joint_ids.size();

Expand Down

0 comments on commit 9d8d208

Please sign in to comment.