on the reference frame thing, yes of course if has to be world space orientation, but it is not as easy as it seems.
I wrote a quick hack function to apply the input angles to the target pose.
if we use the current pose the calculation initially goes into recursive feed back.
for example say teh ya angle is zero, and you ally a one degree offset, the each frame will try to rotate one degree, and quickly degenerate.
This is not bad or good, is just bad for this example.
In the code I simple commented out getting the matrix from the pelvis, and use a fix value.
teh it work fine.
however imaging this was a idle controller in which the pelvis rotates and as if rotate, the control trigger a limit and active a leg controller that lift some legs and move the to reach some other position, and keeps doing that as the system provide information.
what this tell me is that tree are many way to control a player, kind of like a state machine that activated pose controllers based on many inputs.
in eh example moving picking the player case what seems a malfunction since the target now is fixed by the body can go anywhere.
There are lot of unknown still.
if you sync you can now control the body orientation like before but not the offset position, not yet.
- Code: Select all
void UpdatePose()
{
//dMatrix rootMatrix(m_robot->m_effector->GetBodyMatrix());
dMatrix xxxx(m_robot->m_effector->GetBodyMatrix());
dMatrix rootMatrix(dGetIdentityMatrix());
rootMatrix.m_posit = xxxx.m_posit;
for (int i = 0; i < m_nodesCount; i++) {
dHexapodNode* const node = m_poseArray[i].m_node;
dMatrix poseMatrix (m_poseArray[i].m_rotation, m_poseArray[i].m_posit);
dMatrix effectorMatrix(poseMatrix * rootMatrix);
if (i == 0) {
dMatrix offset (dPitchMatrix(m_robot->m_pitch) * dYawMatrix(m_robot->m_yaw)* dRollMatrix(m_robot->m_roll));
effectorMatrix = offset * effectorMatrix;
}
node->m_effector->SetTargetMatrix(effectorMatrix);
}
}
I will try to make teh controller class that does this systematically starting from the basic pose generating and the concatenation modifiers nodes.
each node has one or more input vector, and output vector and operators, the we can make controller trees in which each do special stuff.
my goal, if to make the first one which is the pose generation that will produce just a desired pose, the there be a input modifier that will take the input of the pose generator and apply the user input.
then output of this modifier is the input to the enviromment modifirer which will take the current position and steer it to the input pose.
if this works, the result is that we should be able to modified the body orientation on any location on the map while still obeying user pick functionality. That's the idea anyway.