billiards-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Billiards-devel] Programming experiments with Billiards


From: Dimitris Papavasiliou
Subject: Re: [Billiards-devel] Programming experiments with Billiards
Date: Tue, 19 Jan 2010 22:48:36 +0200

Tadej,

Yes, you are right, the stick never appears.

It doesn't?  So this means it doesn't get linked at all.  This means that the code in question (the line setting its parent which effectively links it below it) does not get executed *after* you activate the cue's motor but instead *never* at all.  Try to see why that happens.  I'll look into it as well and let you know by tommorow hopefully.
 
Ok, I first tried doing it in my billiards.aiming.experiment2 hook and
it didn't work.

Then I tried changing billiards.aiming.cue with this code:
local oldcue = billiards.aiming.cue

billiards.aiming.cue = function ()
  -- First call the old function to setup the default
  -- behavior we don't want to change.

  print (bodies.cue.parent)
  oldcue()

  -- Now change what we don't like.
  print (bodies.cue.parent)
  joints.arm.motor = {arm_velocity, 1000}

  end

and this also doesn't work.

The first print produces 'nil' and the second print gives 'System'. Is
that how it is supposed to be?

Yes I think so.  Before calling oldcue() the stick is not attached to the scene so its parent is nil.  After that its parent is a "System" node.  This node defines a separate universe so to speak where bodies exist.  Any body nodes linked under it are supposed to exist in the same universe and thus interact with each other.  Currently this means that they can collide.  That's why you set the cue's parent node equal to the cueball's parent node.  After that the cue should appear.  If it doesn't that's mighty strange.  Maybe the cue does appear but only for a second as it immediately contacts the ball and vanishes again?  But then the ball should move... I'll look into it myself and get back to you tommorow.
 
The only big problem I have with the simulated results is that the
measured arm velocity (via billiards.cuecollision.cuespeed) many times
doesn't correspond to the arm velocity set with joints.arm.motor =
{arm_velocity, 10000}.
This is quite a problem, do you have any clues why this is happening?

Yes.  Since you're pushing the cue with a give force (10kN in your case) to speed it up to arm_velocity it needs some time and thefore some space in order to reach it.  Currently the cue's initial distance from the cueball is fixed (it is defined in adjust_cue I think), so if the velocity you measure is smaller that the target velocity this means that the force was not large enough to accelerate the cue within the given time/space.    One way to rectify this would be of course to make the force larger but I'm not sure how well the control logic of the motor works (which is part of the physics library, not of my own code) so I'm worried it might overshoot the target velocity if the force is too large.  This would explain larger values if you see them.  So the other approach would be to pull the cue further away from the ball.  I'll make this distance configurable in experimentation mode so again you'll have to wait a bit if you can't fix your problems by adjusting the force.  (In the meantime though you can determine whether this would help by manually pulling the cue to a safe ditance and firing it via keystroke.)

Let me know if there's anything else you need implemented to perform your experiments.

Dimitris.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]