Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

dynamicDrift computation -> seg fault #11

Open
andreadelprete opened this issue Dec 27, 2014 · 4 comments
Open

dynamicDrift computation -> seg fault #11

andreadelprete opened this issue Dec 27, 2014 · 4 comments

Comments

@andreadelprete
Copy link

I do not manage to understand why this code results in segmentation fault

from dynamic_graph.sot.hrp2_14 import robot
r = robot.Robot("hrp2");
r.dynamic.dynamicDrift.recompute(1);

Is there something wrong I am doing?

@olivier-stasse
Copy link
Member

If you try to access a signal for which you did not specify the dependency, then the software is trying to access it without checking the dependency. This may create a seg fault.

@andreadelprete
Copy link
Author

Thank you for your answer Olivier. What do you mean by "specify the dependency"? Do you mean "plug the signals on which dynamicDrift depends"? If that's the case, I think they are all automatically plugged inside the constructor of the python class Robot. Indeed if I call recompute on any other signal (e.g. com, inertia, Jcom) it doesn't seg fault.
Moreover, adding a print inside method computeTorqueDrift (line 1365 of file sot-dynamic.cpp) I found out that the seg fault is caused by the access to the vector Torques, which has (unexpectedly) size 0:

  newtonEulerSINTERN(iter);
  const unsigned int NB_JOINTS = jointPositionSIN.accessCopy().size();
  tauDrift.resize(NB_JOINTS);
  const vectorN& Torques = m_HDR->currentJointTorques();
  for( unsigned int i=0;i<NB_JOINTS; ++i ) tauDrift(i) = Torques(i);

@olivier-stasse
Copy link
Member

Hi Andreas,
Happy new year !
Sorry for the delay in answering...
Regarding the snippet you gave, it might be due to the flag controlling the computation done in the sot-dynamic entity. The rational was to have a better control of what is computed in the control loop.
To have an example please look at the class AbstractHumanoidRobot and more specifically here

@andreadelprete
Copy link
Author

Hi Olivier, happy new year to you too!
Don't worry for the delay, it's vacation time for everybody!
I'm sorry but I don't get your answer, maybe there's a misunderstanding here, so let me try to explain myself more clearly.

I'm trying to use the robot python class defined in dynamic_graph.sot.hrp2_14 to compute the dynamics of hrp2. I can compute Jacobians, forward kinematics, mass matrix, but when I try to compute the dynamicDrift I get a segmentation fault.
I see two possible reasons for this: either i) I'm using it wrong, or ii) there is a bug in the code of sot-dynamic. This is how I'm using it:

from dynamic_graph.sot.hrp2_14 import robot
r = robot.Robot("hrp2");
r.dynamic.dynamicDrift.recompute(1);

Is this the correct way of using it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants