optimizing joint axis with Breve
[email protected] Wed, 26 Jan 2005 12:06:53 -0700 (MST)
| Newsgroups | gmane.comp.breve |
|---|---|
| Message-ID | <[email protected]> |
Hi Jon,
Thanks in advance for any help you can off, thank you for creating Breve
and I apologize for the length of this inquiry. I am using your program
for a biomechanics simulation and I must tell you that I am no
mathematician or computer expert, rather I am an industrial designer and
kinesiologist (this is my first crack at coding so please excuse my
inexperience).
I have included my Breve simulation code in the text at the end.
What I am trying to do is to optimize a joint axis between two body
segments. The two segments in the simulation are the rearfoot (the sphere)
and the forefoot (the customshape) (note there are no toes in this
foot). The portion of the customshape that is attached to the ground
(you can see my sloppy work in the way I mashed my fixed link with the
ground) is like the ball of your foot and the joint axis I am looking for
would be in your arch between the customshape and sphere.
I am using a study where points on a real foot where photographed at
high-speed to create my two segments. In my simulation the forefoot goes
from arch flatten at time 0 to arch augmentation at time 1. I rotate
the customshape so that the pointed end moves the same amount as arch
rises (this is the independent motion and will remain the same for each
trial). How far and at what angle the sphere moves around the particular
axis linking it to the customshape will determine how fit that axis is.
I need to link the customshape to the sphere with a revolute joint (the
axis of interest) so that they are placed in the proper position for each
trial (I use the parent point vector and add the child point vector so
that the sphere winds up in the same place every time).
The distance between points on the customshape and sphere need to be
measured at time 0 (only once) and at time 1 for each trial so that the
change in distance can be calculated. I also need to know the change in
angle of the sphere in the horizontal plane. These numbers are subtracted
from the expected results from the study and added together to generate a
fitness value.
The distances to be measured are 1) the inside or medial distance from
vertex1 on the customshape to the outside edge of the sphere on the same
side (if I could figure out how to rotate the sphere 90 degrees in the
horizontal plane it would be to that side of the spheres axis) and 2) the
outside or lateral distance from vertex3 of the customshape to the other
side of the sphere. Also the angle change of the sphere in the horizontal
plane
This gives you some background on what I am trying to do and I assume that
I will need help later on, but for now can you tell me:
1. How do I get the revolute joint to be at an orientation that is
not orthogonal or what appears to be 45 degrees to the grid? I am using
the normals to change orientation but any number I use produces the same
joint (1 is the same as 45 or 33). I need to be able to check any joint
axis at any orientation as the axis in the foot is suspected to be
triplanar and possibly at a very unusual angle.
2. Is there a way to show the axis? I was contemplating using
add-line method as I have been reading about it in the newsletter. Can I
use this method to show the axis orientation or perhaps connect the
customshape to the axis with a line and also connect the sphere to the
axis so that the connection between the segments can be seen.
3. Finally, how can I measure between points on segments? Should I
use get-point-on-shape (I dont seem to get anything returned)? Will I
need to measure from segment centre to segment centre with the
get-distance method and then calculate where the points would be, or is
there a way to measure between points on shapes?
Oh yea how do I rotate the sphere so that I dont change my joint axis (I
have tried to use set-relative-rotation as I saw in the question from Jon
Kleiser without success and have tried the point method without results).
Thanks again for any help you can offer.
@include "PhysicalControl.tz"
@include "Joint.tz"
@include "MultiBody.tz"
@include "Shape.tz"
@include "Stationary.tz"
@include "Mobile.tz"
@include "Link.tz"
Controller Foot.
PhysicalControl : Foot {
+ variables:
FootThing (object).
+ to init:
floorShape (object).
floor (object).
floorShape = (new Shape init-with-cube size (30, 3, 30)).
floor = new Stationary.
floor register with-shape floorShape at-location (0, 0, 0).
floor set-color to (1.0, 1.0, 1.0).
FootThing = new FootForm.
FootThing show-bounding-box.
FootThing show-axis.
self point-camera at (-2.2, 1, 1.2) from (-31, 10, 21).
self set-background-color to (.4, .6, .9).
self enable-lighting.
self move-light to (-20, 20, 0).
self enable-smooth-drawing.
}
MultiBody : FootForm {
+ variables:
FxShape, FShape, RShape (object).
joint1, joint2 (object).
parts (list).
- to join1 parent part0 (object) with-child part1 (object):
joint1 = new myRevoluteJoint.
joint1 link parent part0 to-child part1
with-parent-point (-2.5, 1.5, -10) with-child-point (0, 0, 0)
with-normal (0, 0, 0).
joint1 set-joint-limits min (-0.15) max (0.0).
joint1 set-strength-limit to 400.
- to join2 parent part1 (object) with-child part2 (object):
joint2 = new myRevoluteJoint.
joint2 link parent part1 to-child part2
with-parent-point (3, 3.2, 8) with-child-point (-0.65, 0, -6.48)
with-normal (-1, 0, 1).
joint2 set-strength-limit to 10.
+ to init:
FShape = new myCustomShape.
FxShape = new Shape.
FxShape init-with-cube size (20, -3, 20).
RShape = new Shape.
RShape init-with-sphere radius (3.2).
RShape get-point-on-shape on-vector (-1, 0, 0).
RShape get-point-on-shape on-vector (1, 0, 0).
parts = 3 new Links.
parts{0} set shape FxShape.
parts{1} set shape FShape.
parts{2} set shape RShape.
parts{2} point vertex (1, -1, 1) at (0, 0, 0).
self register with-link parts{0}.
parts{0} set-color to (1, 1, 1).
parts{1} set-color to (0.4, 0, 0.6).
parts{2} set-color to (1.0, 0.2, 0).
self join1 parent parts{0} with-child parts{1}.
self join2 parent parts{1} with-child parts{2}.
}
CustomShape : myCustomShape {
+ variables:
vertices (5 vectors).
+ to init:
vertices[0] = (-5, 0, 0).
vertices[1] = (-5, 2.3, 0).
vertices[2] = (5, 0 , 0).
vertices[3] = (5, 1.6, 0).
vertices[4] = (-1.6, 4.1, 9.4).
self add-face with-vertex-list { vertices[0], vertices[1],
vertices[3], vertices[2]}.
self add-face with-vertex-list { vertices[0], vertices[1],
vertices[4]}.
self add-face with-vertex-list { vertices[0], vertices[2],
vertices[4]}.
self add-face with-vertex-list { vertices[1], vertices[3],
vertices[4]}.
self add-face with-vertex-list { vertices[2], vertices[3],
vertices[4]}.
self finish-shape with-density 1.1.
}
RevoluteJoint : myRevoluteJoint {
+ to iterate:
self set-joint-velocity to sin((controller get-time) / 8) / 8.
}
_______________________________________________
breve mailing list
[email protected]
http://lists.spiderland.org/mailman/listinfo/breve