linux/windows inconsistent joint behavior

"Rick Giuly" <[email protected]>
Newsgroups gmane.comp.breve
Message-ID <001401c3ff08$65682090$0401a8c0@horse>
The code listed below does a different thing in Linux than Windows (both
version 1.8). Notice the orientation of the little block and the way it is
turning. I  develop in windows and run simulations in linux, so a quick fix
would be appreciated.

-rick


@include "PhysicalControl.tz"
@include "Joint.tz"
@include "MultiBody.tz"
@include "Link.tz"
@include "Shape.tz"
@include "Stationary.tz"

# base link is red

Controller JointTest.


PhysicalControl : JointTest {
 + variables:

  body1 (object).



 + to init:

  # make floor
  new Stationary register with-shape
    (new Shape init-with-cube size (100, 0.2, 100))
    at-location (0, -10, 0).

  # make the hinged thing
  body1 = new Body.

  #position the body
  #body1 move to (-1, 7, 3).
  #body1 rotate around-axis (0,0,1) by 0.6.
  #body1 set-color to (0, .7, 0).


  self point-camera at (0, -10, 0) from (0, 5, 15).
  self set-display-text to "hello" at-x -.98 at-y -.98.
  self set-background-color to (0.4, 0.4, 0.4).
  self full-gravity.



 + to catch-key-0-down: body1 set-vel.


}

%do Shape objects have physics defined?
%maybe mutating(in the object oriented sense) the shape, rotating it, would
be useful

MultiBody : Body {

 + variables:
  childLink (object).
  baseLink (object).
  joint (object).
  cubeShape (object).
  cubeShape1 (object).
  cubeLength (float).
  length (int).
                longAxis (vector).

  nothing (object).

 + to init:
  #length = {5,8,6,8}.
  #print length.
  #cubeLength = 5.


                longAxis = (1,0,0).

  nothing = new Link.
  print nothing + 0.

  cubeLength = 4.5. #messes up if not initialized
  cubeShape = new Shape.
  cubeShape init-with-cube size (cubeLength/4,
     cubeLength/4,cubeLength).

  cubeShape1 = new Shape.
  cubeShape1 init-with-cube size (cubeLength/6,
     cubeLength/6,cubeLength/4).

  # make base
  baseLink = new Link.
  baseLink set shape cubeShape.
  baseLink set-color to (1,0,0).
  self register with-link baseLink.

  # make child piece
  childLink = new Link.
  childLink set shape cubeShape1.
  self register with-link childLink.






    #self register with-link childLink. only register root

    joint = new RevoluteJoint.

    # Attach joint to child at certain angle.
    joint set-relative-rotation-matrix to
                                  (self orien).


           joint link parent baseLink
                             to-child childLink
                             with-normal ((self orien)*(self axis))
                             with-parent-point ((longAxis * 0.7) + (self
displacement))
               with-child-point (longAxis * -0.7).

                  # need this, could be a bug, because the previous
                  # "link" command already specified it
    joint set-child-link-point to (longAxis * -0.7).

    joint set-strength-limit to 100.


                  joint set-double-spring
                          with-strength 100
                          with-max 100 ############
                          with-min -100.







  joint set-joint-velocity to -0.2.

         #joint set-joint-damping to 1.





        + to axis:
                return (1.00000, 0.00000, 0.00000).

        + to orien:
                return [ (0.00000, 0.00000, 1.00000), (0.00000, 1.00000,
0.00000), (-1.00000, 0.00000, 0.00000) ].

        + to displacement:
                return (2.00000, 0.00000, -1.00000).




        + to iterate:
                print (joint get-joint-position).

 + to set-vel:

  print (joint get-joint-velocity).
                joint set-joint-velocity to 0.
  #baseLink set-joint-velocity to 1000.
  #childLink set-joint-velocity to -1000.
  #joint set-joint-velocity to 3.

}

RevoluteJoint : TurningRevoluteJoint {
 + to iterate:



  a (float).
  a = self get-joint-position.

                #self set-joint-velocity to 0.

                if ((self get-joint-position) < .2):
                    if ((self get-joint-position) >= -0.1): {
                        print (self get-joint-position).
                        self set-joint-velocity to .3.
                        }




  ##if a < .5: self set-joint-velocity to .3.
  ##if a > 1.5: self set-joint-velocity to -.3.
  ##print (self get-joint-position).
  #self set-joint-velocity to 5.
}

#RevoluteJoint : KneeJoint  {
#: + to iterate:

RevoluteJoint : UnidirectionalRevoluteJoint {
 + to iterate:
  if (self get-joint-velocity) > 0:
       self set-joint-velocity to 0.
}






_______________________________________________
breve mailing list
[email protected]
http://www.spiderland.org/mailman/listinfo/breve
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.