-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Hi again, sorry for another "issue". This time is more about a clarification about clusters with a loop.
Taking as an example the four_bar.urdf included in this repo, I did the following:
grbda::ModelState<double> model_state;
for (const auto &cluster : urdf_model.clusters()) {
grbda::JointState<> joint_state = cluster->joint_->randomJointState();
model_state.push_back(joint_state);
}
urdf_model.setState(model_state);
std::cout << model_state.size() << std::endl;
for (int i = 0; i<model_state.size(); ++i) {
std::cout << "Cluster: " << urdf_model.clusters()[i]->name_ << std::endl;
auto joints = urdf_model.clusters()[i]->joint_->singleJoints();
std::cout << "Joints:" ;
for (const auto & j : joints) {
std::cout << " " << j->name();
}
std::cout << std::endl;
std::cout << "Pos: " << model_state[i].position.transpose() << std::endl
<< "Vel: " << model_state[i].velocity.transpose() << std::endl;
}
obtaining:
Cluster: cluster-0
Joints: joint1 joint3 joint2
Pos: -0.0866771 -0.0866771 0.0866771
Vel: 0.680375
I expected here to have only one independent position and one independent velocity, as all the remaining positions in the 4-bar linkages are dependent on the "input" joint.
What am I missing here? If I would like to animate the 4-bar linkage by setting something else than a random joint state vector, on which variable or through which interface should I act before calling forwardKinematics? Should I just edit the 1st element of the pos vector and disregard the other ones?
Moreover, I see that the parsed URDF+ loop is implemented as GenericJoint, whose randomJointState() relies on a rand+retry approach inside and outside the call to findRootsForPhi(). It seems to me that there is no way to impose the value of the independent variable to obtain coherent dependent ones.