Ticket #55 (new defect)

Opened 9 months ago

Last modified 9 months ago

"evolvecraft.exe -evolve" throws ODE internal error on collision only on Windows

Reported by: vknecht Owned by:
Priority: minor Milestone: 1.2.1
Component: general Version: 1.2
Keywords: locked space evolvecraft Cc:

Description (last modified by sunshine) (diff)

With 1.2 on Windows, when the ship collides with the terrain, an ODE internal error arises:

ode internal error 2: invalid operation for locked space
(\source-wip\CSlibs\source\libode\ode\src\collision_space.cpp:60)

It happens whatever ODE version is used, from 0.6 to 0.9. It does not happen on Linux. Problem does not happen with 1.3/trunk on Windows.

Looking around the Net, this explanation can be found: http://www.ode.org/old_list_archives/2006-April/018305.html

I tried working around the problem by deferring the position reset to the next frame and it works, but then on Linux the ship would often pass through the terrain without colliding. Here's the mod I tried:

  • apps/evolvecraft/behave.cpp

     
    3737    iCelPlLayer* pl) : 
    3838        scfImplementationType (this), 
    3939        bl (bl), entity (entity), evolving (false), 
    40         bestFitness (0), targetFitness (100000000.0) 
     40        bestFitness (0), targetFitness (100000000.0), 
     41        doResetPos (false) 
    4142{ 
    4243  parid_currentticks = pl->FetchStringID("cel.parameter.currentticks"); 
    4344  parid_maxfitness = pl->FetchStringID("cel.parameter.max_fitness"); 
     
    7475 
    7576    currentTime = params->GetParameter(parid_currentticks)->value.l; 
    7677 
     78        if (doResetPos) 
     79        { 
     80      pcmechobj->GetBody ()->SetOrientation (initOrientation); 
     81      pcmechobj->GetBody ()->SetPosition (initPosition); 
     82      pcmechobj->GetBody ()->SetLinearVelocity (csVector3 (0)); 
     83      pcmechobj->GetBody ()->SetAngularVelocity (csVector3 (0)); 
     84      pollPosition = initPosition; 
     85          doResetPos = false; 
     86        } 
     87         
    7788    // here we produce the inputs; these are speed, and distance to obstacle 
    7889    // along three hitbeams protruding from the front of the craft. 
    7990    csVector3 position (pcmechobj->GetBody()->GetPosition()); 
     
    168179  { 
    169180    // the pcevolve is asking us to begin evaluating the fitness of the craft, 
    170181    // so we position it at the start point and initialize some values. 
    171  
    172     pcmechobj->GetBody ()->SetOrientation (initOrientation); 
    173     pcmechobj->GetBody ()->SetPosition (initPosition); 
    174     pcmechobj->GetBody ()->SetLinearVelocity (csVector3 (0)); 
    175     pcmechobj->GetBody ()->SetAngularVelocity (csVector3 (0)); 
     182        doResetPos = true; 
    176183    startTime = currentTime; 
    177     pollPosition = initPosition; 
    178184    return true; 
    179185  } 
    180186  else if (csString ("pcdynamicbody_collision") == msg_id) 
     
    182188    // a collision! we've finished evaluating the fitness of the craft; 
    183189    // its fitness is based on how far it got from the start point before 
    184190    // the collision. 
    185  
    186191    if (evolving) 
    187192    { 
    188193      csTicks timeTaken = currentTime - startTime; 
     
    195200  } 
    196201  else if (csString ("pccommandinput_unfit1") == msg_id) 
    197202  { 
    198     if (pcevolve) 
     203  if (pcevolve) 
    199204    { 
    200205      pcevolve->FitnessCallback(0.0); 
    201206    } 
  • apps/evolvecraft/behave.h

     
    6666  float bestFitness, targetFitness; 
    6767  csVector3 initPosition, pollPosition; 
    6868  csMatrix3 initOrientation; 
     69  bool doResetPos; 
    6970 
    7071public: 
    7172  htBehaviourActor(iCelBlLayer *bl, iCelEntity *entity, iCelPlLayer *pl); 

Attachments

Change History

Changed 9 months ago by sunshine

  • description modified (diff)

Changed 9 months ago by vknecht

  • milestone set to 1.2.1

Changed 9 months ago by vknecht

I spoke to Piotr (aka. obi_1) about that problem, and he might have a look at this problem next week-end.
Should the issue take too much time to solve, since it's now OK with trunk (perhaps the move to new SCF, not sure), I'd think about closing this ticket as "wontfix", unless it would be acceptable to implement the "fix" using #ifdef win32 ?

Add/Change #55 ("evolvecraft.exe -evolve" throws ODE internal error on collision only on Windows)

Author



Action
as new
 
Note: See TracTickets for help on using tickets.