[ODE] jointFeedback again... please help
Davide Faconti
facontidavide at hotmail.com
Thu Nov 4 09:59:11 MST 2004
Dear all,
I have sent many e-mail asking about jointFeedback behaviour, but no one
answered me.
I invite Russ to enter in the discussion, since there is something defenetly
odd in that function.
The force applied to the joints looks fine, instead the torque doesn't:
1) I suppose that t1 should be equal to -t2, according to newton-euler laws,
but it isn't.
2) I calculated by and the torque that the joint is supposed to generate,
and ODE gives different values, that I am pretty sure are wrong.
If you are not sure, check try the following code please and read the output
torque.
#include <ode/ode.h>
#include <drawstuff/drawstuff.h>
static dWorldID world;
static dBodyID body;
static dJointID joint;
static dJointFeedback feedback;
static void simLoop (int pause)
{
dReal sides[3] = {0.20,0.01,0.01};
dsDrawBoxD (dBodyGetPosition(body),dBodyGetRotation(body),sides);
dWorldStep (world,0.01);
printf("t1 %f %f %f\n", feedback.t1[0],feedback.t1[1],feedback.t1[2]);
printf("t2 %f %f %f\n", feedback.t2[0],feedback.t2[1],feedback.t2[2]);
}
static void start()
{
static float xyz[3] = {0.1f,0.5f,0.4f};
static float hpr[3] = {-90.0000f,-10.5000f,0.0000f};
dsSetViewpoint (xyz,hpr);
}
int main (int argc, char **argv)
{
dsFunctions fn;
fn.version = DS_VERSION;
fn.start = &start;
fn.step = &simLoop;
fn.stop = 0;
fn.path_to_textures = "textures";
world = dWorldCreate();
dWorldSetGravity (world, 0, 0, -10);
dMass m;
dMassSetBox (&m,1,0.20,0.01,0.01);
dMassAdjust (&m,1);
body = dBodyCreate (world);
dBodySetMass (body,&m);
dBodySetPosition (body, 0 ,0 , 0.5);
joint = dJointCreateHinge (world,0);
dJointAttach (joint,body,0);
dJointSetHingeAnchor (joint,0.1,0,0.5);
dJointSetHingeAxis (joint,0,1,0);
dJointSetHingeParam(joint, dParamFMax,0.4);
dJointSetFeedback(joint, &feedback);
dsSimulationLoop (argc,argv,500,500,&fn);
dWorldDestroy (world);
return 0;
}
More information about the ODE
mailing list