Ticket #55 (new defect)
"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
37 37 iCelPlLayer* pl) : 38 38 scfImplementationType (this), 39 39 bl (bl), entity (entity), evolving (false), 40 bestFitness (0), targetFitness (100000000.0) 40 bestFitness (0), targetFitness (100000000.0), 41 doResetPos (false) 41 42 { 42 43 parid_currentticks = pl->FetchStringID("cel.parameter.currentticks"); 43 44 parid_maxfitness = pl->FetchStringID("cel.parameter.max_fitness"); … … 74 75 75 76 currentTime = params->GetParameter(parid_currentticks)->value.l; 76 77 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 77 88 // here we produce the inputs; these are speed, and distance to obstacle 78 89 // along three hitbeams protruding from the front of the craft. 79 90 csVector3 position (pcmechobj->GetBody()->GetPosition()); … … 168 179 { 169 180 // the pcevolve is asking us to begin evaluating the fitness of the craft, 170 181 // 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; 176 183 startTime = currentTime; 177 pollPosition = initPosition;178 184 return true; 179 185 } 180 186 else if (csString ("pcdynamicbody_collision") == msg_id) … … 182 188 // a collision! we've finished evaluating the fitness of the craft; 183 189 // its fitness is based on how far it got from the start point before 184 190 // the collision. 185 186 191 if (evolving) 187 192 { 188 193 csTicks timeTaken = currentTime - startTime; … … 195 200 } 196 201 else if (csString ("pccommandinput_unfit1") == msg_id) 197 202 { 198 if (pcevolve)203 if (pcevolve) 199 204 { 200 205 pcevolve->FitnessCallback(0.0); 201 206 } -
apps/evolvecraft/behave.h
66 66 float bestFitness, targetFitness; 67 67 csVector3 initPosition, pollPosition; 68 68 csMatrix3 initOrientation; 69 bool doResetPos; 69 70 70 71 public: 71 72 htBehaviourActor(iCelBlLayer *bl, iCelEntity *entity, iCelPlLayer *pl);
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
