Wrong orientation when driving model

Hello guys,

As some of you may know, I am working on a sit-to-stand model. My model is
based on the old Gait model (lower-limb) and uses orientation to drive the
segments. In short, I drive the thigh (3 DOFs x 2) and pelvis (3 DOFs)
segments using data files that contain rotation vectors over time, and I use
angles to drive the shank (knee, 1 DOF x 2) and feet (ankle, 2 DOFs x 2)
(time + 3 components) and I position the center of the pelvis (3 DOFs).

My problem is that the orientation of the segments do not match the
orientation I supply. More specifically, if I measure (using a
AnyKinRotational) the orientation between the global reference frame and the
thigh segment, I get a different result than if I look at the measure/driver
used to drive this very segment.

Here are extracts from the model code (links to the full model will follow)
and the specifics:

I first drive a zero-mass segment’s orientation to fit my rotational vector
data (SegOrient.any):

===== CODE START =====

AnyFunInterpol Data = {

Type = PiecewiseLinear;

FileName = .DataFile;

}; // Data

AnySeg Seg = {

Mass = 0;

Jii = {0,0,0};

AnyRefNode ISBNode = {

 sRel = {0,0,0};

 ARel = Main.Model.Environment.GlobalRef.ISBFrame.ARel;

 AnyDrawRefFrame DrawRef = {

   RGB = {0,1,0};

   ScaleXYZ = {0.05,0.05,0.05} * ...ShowOrient;

 };

}; // ISBNode

// […]

}; // Seg

AnyKinEqSimpleDriver LinDriver = {

AnyKinLinear LinMeasure = {

 AnyRefFrame &Global = Main.Model.Environment.GlobalRef.ISBFrame;

 AnyRefFrame &Seg = ..Seg.ISBNode;

 Ref = 0;

}; // LinMeasure

Reaction.Type = {On, On, On}; // Markers need to be carried

DriverPos = {0,0,0};

DriverVel = {0,0,0};

}; // LinDriver

AnyKinEqInterPolDriver RotDriver = {

AnyKinRotational RotMeasure = {

 AnyRefFrame &Global = Main.Model.Environment.GlobalRef.IRMFrame;

 AnyRefFrame &Seg = ..Seg.IRMNode;

 Type = RotVector;

 Ref = 0;

}; // RotMeasure

Reaction.Type = {On, On, On}; // Markers need to be carried

Type = PiecewiseLinear;

T = .Data.T;

Data = .Data.Data;

}; // RotDriver

===== CODE END =====

I then drive (by limiting rotations) the segment orientation to match this
null-mass segment (Drivers.any):

===== CODE START =====

AnyKinEqSimpleDriver RThighRotDriver = {

 AnyKinRotational RotLink = {

   AnyRefNode &Model =

Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.IRMNode;

   AnyRefNode &Marker =

Main.Model.Environment.SegmentOrientations.RThigh.Seg.IRMNode;

   Type = RotVector;

 }; // RotLink

 MeasureOrganizer = {0,1,2};

 DriverPos = {0,0,0};

 DriverVel = {0,0,0};

 Reaction.Type = {Off,Off,Off};

}; // RThighRotDriver

===== CODE END =====

Up to here, everything seems fine. But when I look at my model, I notice a
fairly big orientation difference between the line joining the joint centers
(hip joint to knee joint) compared to the equivalent line drawn from my
marker data (hip joint center virtual marker and knee joint center virtual
marker). At first, I blame my transformations/calculations previous to
entering it in Anybody, but strangely, the error seem to come from Anybody!

To test demonstrate this, I simply created a measure that measure directly
the orientation difference between the global reference frame and the thigh
segment (STS.main.any):

===== CODE START =====

 AnyKinRotational RThighRotV = {

   AnyRefFrame &RefFrame = Main.Model.Environment.GlobalRef.IRMFrame;

   AnyRefFrame &Thigh =

Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.IRMNode;

   Type = RotVector;

 };

===== CODE END =====

Strangely enough, this last measure (RThighRotV) gives me a different result
than the one that is being driven (LinDriver.LinMeasure)! The error is
present both in the 3D view and the data.

Values at frame 0:

Main.Study.Output.Model.Environment.SegmentOrientations.RThigh.RotDriver.Rot
Measure.Pos

0.108464

0.058994

-1.187838

Main.Study.Output.Model.RThighRotV.Pos

0.08990936

0.06810572

-1.132129

So I assume that I am missing something fairly big or there is a bug, in
either case, I need your help as I am kinda stuck…

Other specifics:

  •      I use Anybody 2.x, although I tried on 3.x with the same results.
    
  •      I use the repository 6.0.
    
  •      I used repository 6.0 also for 3.x, although it gives me several
    

warnings about the Ref parameter which is now deprecated, but it worked
anyway.

Below is the link to download the model:

http://www.health-ingenio.com/Files/Model.zip

Note that the repository is not included and should be placed under
Repository.6, at the same level as the zip’s directory.

Thank you very much for your help!

Jean-Olivier Racine, ing.jr

joracine@humancad.com

HumanCAD Development Team

NexGen Ergonomics Inc.

http://www.nexgenergo.com

(450) 621-0138

[Non-text portions of this message have been removed]

Hi Jean Olivier,

I run the model with version 3.0.1 and 3.0.2 (I don’t have 2.x currently
installed) and Rep6.

The driver AnyKinEqSimpleDriver RthighRotDriver linking the thigh and the
NoMass segment is working correctly. I drew both IRMNode and they are
perfectly aligned in the model view. Also the rotational measures
Main.Study.Output.Model.Environment.SegmentOrientations.RThigh.RotDriver.Rot
Measure.Pos and Main.Study.Output.Model.RThighRotV.Pos are exactly similar.
You said the difference between the measures is also present in 3.x right?
Can you tell me exactly which version of AnyBody 3.x and 2.x are you using?

Also can you please draw the ref frame of the nodes like following and
verify that they are aligned?

 Main.Model.Environment.SegmentOrientations.RThigh.Seg.IRMNode = {

   AnyDrawRefFrame drw =

   {

     RGB = {1, 0, 0};

     ScaleXYZ = 0.5*{1, 1, 1};

   };

 };





 Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.IRMNode = {

   AnyDrawRefFrame drw =

   {

     RGB = {0, 0, 1};

     ScaleXYZ = 0.5*{1, 1, 1};

   };

 };

Then in addition of this possible problem in a certain version I think I
found another error. The SegmentOrientations.RThigh.Seg.IRMNode is not
aligned with the red line connecting the markers representing the hip and
knee joint centres, which should be if I understood well the model. The
thigh is correctly aligned with the dummy segment but as this last one is
not aligned with red lines then the thigh doesn’t match either the red
lines.

That means the problem can be in the interpolated data used to drive the
dummy segment.

Did you process this data in some way? Are sure it is given in the right
coordinate system?

Best regards,

Sylvain, AnyBody Support


From: anyscript@yahoogroups.com [mailto:anyscript@yahoogroups.com] On Behalf
Of Jean-Olivier Racine
Sent: 10. marts 2009 02:07
To: anyscript@yahoogroups.com
Cc: Rachid.Aissaoui@etsmtl.ca
Subject: [AnyScript] Wrong orientation when driving model

Hello guys,

As some of you may know, I am working on a sit-to-stand model. My model is
based on the old Gait model (lower-limb) and uses orientation to drive the
segments. In short, I drive the thigh (3 DOFs x 2) and pelvis (3 DOFs)
segments using data files that contain rotation vectors over time, and I use
angles to drive the shank (knee, 1 DOF x 2) and feet (ankle, 2 DOFs x 2)
(time + 3 components) and I position the center of the pelvis (3 DOFs).

My problem is that the orientation of the segments do not match the
orientation I supply. More specifically, if I measure (using a
AnyKinRotational) the orientation between the global reference frame and the
thigh segment, I get a different result than if I look at the measure/driver
used to drive this very segment.

Here are extracts from the model code (links to the full model will follow)
and the specifics:

I first drive a zero-mass segment’s orientation to fit my rotational vector
data (SegOrient.any):

===== CODE START =====

AnyFunInterpol Data = {

Type = PiecewiseLinear;

FileName = .DataFile;

}; // Data

AnySeg Seg = {

Mass = 0;

Jii = {0,0,0};

AnyRefNode ISBNode = {

sRel = {0,0,0};

ARel = Main.Model.Environment.GlobalRef.ISBFrame.ARel;

AnyDrawRefFrame DrawRef = {

RGB = {0,1,0};

ScaleXYZ = {0.05,0.05,0.05} * …ShowOrient;

};

}; // ISBNode

// […]

}; // Seg

AnyKinEqSimpleDriver LinDriver = {

AnyKinLinear LinMeasure = {

AnyRefFrame &Global = Main.Model.Environment.GlobalRef.ISBFrame;

AnyRefFrame &Seg = …Seg.ISBNode;

Ref = 0;

}; // LinMeasure

Reaction.Type = {On, On, On}; // Markers need to be carried

DriverPos = {0,0,0};

DriverVel = {0,0,0};

}; // LinDriver

AnyKinEqInterPolDriver RotDriver = {

AnyKinRotational RotMeasure = {

AnyRefFrame &Global = Main.Model.Environment.GlobalRef.IRMFrame;

AnyRefFrame &Seg = …Seg.IRMNode;

Type = RotVector;

Ref = 0;

}; // RotMeasure

Reaction.Type = {On, On, On}; // Markers need to be carried

Type = PiecewiseLinear;

T = .Data.T;

Data = .Data.Data;

}; // RotDriver

===== CODE END =====

I then drive (by limiting rotations) the segment orientation to match this
null-mass segment (Drivers.any):

===== CODE START =====

AnyKinEqSimpleDriver RThighRotDriver = {

AnyKinRotational RotLink = {

AnyRefNode &Model =
Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.IRMNode;

AnyRefNode &Marker =
Main.Model.Environment.SegmentOrientations.RThigh.Seg.IRMNode;

Type = RotVector;

}; // RotLink

MeasureOrganizer = {0,1,2};

DriverPos = {0,0,0};

DriverVel = {0,0,0};

Reaction.Type = {Off,Off,Off};

}; // RThighRotDriver

===== CODE END =====

Up to here, everything seems fine. But when I look at my model, I notice a
fairly big orientation difference between the line joining the joint centers
(hip joint to knee joint) compared to the equivalent line drawn from my
marker data (hip joint center virtual marker and knee joint center virtual
marker). At first, I blame my transformations/calculations previous to
entering it in Anybody, but strangely, the error seem to come from Anybody!

To test demonstrate this, I simply created a measure that measure directly
the orientation difference between the global reference frame and the thigh
segment (STS.main.any):

===== CODE START =====

AnyKinRotational RThighRotV = {

AnyRefFrame &RefFrame = Main.Model.Environment.GlobalRef.IRMFrame;

AnyRefFrame &Thigh =
Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.IRMNode;

Type = RotVector;

};

===== CODE END =====

Strangely enough, this last measure (RThighRotV) gives me a different result
than the one that is being driven (LinDriver.LinMeasure)! The error is
present both in the 3D view and the data.

Values at frame 0:

Main.Study.Output.Model.Environment.SegmentOrientations.RThigh.RotDriver.Rot
Measure.Pos

0.108464

0.058994

-1.187838

Main.Study.Output.Model.RThighRotV.Pos

0.08990936

0.06810572

-1.132129

So I assume that I am missing something fairly big or there is a bug, in
either case, I need your help as I am kinda stuck…

Other specifics:

  • I use Anybody 2.x, although I tried on 3.x with the same results.

  • I use the repository 6.0.

  • I used repository 6.0 also for 3.x, although it gives me several
    warnings about the Ref parameter which is now deprecated, but it worked
    anyway.

Below is the link to download the model:

http://www.health- <http://www.health-ingenio.com/Files/Model.zip>
ingenio.com/Files/Model.zip

Note that the repository is not included and should be placed under
Repository.6, at the same level as the zip’s directory.

Thank you very much for your help!

Jean-Olivier Racine, ing.jr

joracine@humancad. <mailto:joracine%40humancad.com> com

HumanCAD Development Team

NexGen Ergonomics Inc.

http://www.nexgener <http://www.nexgenergo.com> go.com

(450) 621-0138

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

Hello Sylvain,

Thank you very much for your help and time. It seems the values we’re in
fact identical, my mistake comes from a small bug that prevents from
charging variable in AnyChart when you have selected Data in the top window.
Therefore when I clicked on the RThighRotV measure to see its value, I was
still on the quaternion values, and I could only see the first three lines,
which prevented me from figuring out that it was a 4 value variable… :frowning:
Sorry about that.

In fact, my problem was related to my transformation matrix
(GlobalFrame.IRMFrame.ARel) which we’re wrong, giving a 180 degree rotation
to the thigh segments.

I am sorry you had to go through all this, yet, it still helped me to find
the solution, so thank you very, very much.

Jean-Olivier Racine, ing.jr

joracine@humancad.com

HumanCAD Development Team

NexGen Ergonomics Inc.

http://www.nexgenergo.com

(450) 621-0138

From: anyscript@yahoogroups.com [mailto:anyscript@yahoogroups.com] On Behalf
Of AnyScript Support
Sent: March-10-09 10:36 AM
To: anyscript@yahoogroups.com
Subject: RE: [AnyScript] Wrong orientation when driving model

Hi Jean Olivier,

I run the model with version 3.0.1 and 3.0.2 (I don’t have 2.x currently
installed) and Rep6.

The driver AnyKinEqSimpleDriver RthighRotDriver linking the thigh and the
NoMass segment is working correctly. I drew both IRMNode and they are
perfectly aligned in the model view. Also the rotational measures
Main.Study.Output.Model.Environment.SegmentOrientations.RThigh.RotDriver.Rot
Measure.Pos and Main.Study.Output.Model.RThighRotV.Pos are exactly similar.
You said the difference between the measures is also present in 3.x right?
Can you tell me exactly which version of AnyBody 3.x and 2.x are you using?

Also can you please draw the ref frame of the nodes like following and
verify that they are aligned?

Main.Model.Environment.SegmentOrientations.RThigh.Seg.IRMNode = {

AnyDrawRefFrame drw =

{

RGB = {1, 0, 0};

ScaleXYZ = 0.5*{1, 1, 1};

};

};

Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.IRMNode = {

AnyDrawRefFrame drw =

{

RGB = {0, 0, 1};

ScaleXYZ = 0.5*{1, 1, 1};

};

};

Then in addition of this possible problem in a certain version I think I
found another error. The SegmentOrientations.RThigh.Seg.IRMNode is not
aligned with the red line connecting the markers representing the hip and
knee joint centres, which should be if I understood well the model. The
thigh is correctly aligned with the dummy segment but as this last one is
not aligned with red lines then the thigh doesn’t match either the red
lines.

That means the problem can be in the interpolated data used to drive the
dummy segment.

Did you process this data in some way? Are sure it is given in the right
coordinate system?

Best regards,

Sylvain, AnyBody Support


From: anyscript@yahoogroups.com <mailto:anyscript%40yahoogroups.com>
[mailto:anyscript@yahoogroups.com <mailto:anyscript%40yahoogroups.com> ] On
Behalf
Of Jean-Olivier Racine
Sent: 10. marts 2009 02:07
To: anyscript@yahoogroups.com <mailto:anyscript%40yahoogroups.com>
Cc: Rachid.Aissaoui@etsmtl.ca <mailto:Rachid.Aissaoui%40etsmtl.ca>
Subject: [AnyScript] Wrong orientation when driving model

Hello guys,

As some of you may know, I am working on a sit-to-stand model. My model is
based on the old Gait model (lower-limb) and uses orientation to drive the
segments. In short, I drive the thigh (3 DOFs x 2) and pelvis (3 DOFs)
segments using data files that contain rotation vectors over time, and I use
angles to drive the shank (knee, 1 DOF x 2) and feet (ankle, 2 DOFs x 2)
(time + 3 components) and I position the center of the pelvis (3 DOFs).

My problem is that the orientation of the segments do not match the
orientation I supply. More specifically, if I measure (using a
AnyKinRotational) the orientation between the global reference frame and the
thigh segment, I get a different result than if I look at the measure/driver
used to drive this very segment.

Here are extracts from the model code (links to the full model will follow)
and the specifics:

I first drive a zero-mass segment’s orientation to fit my rotational vector
data (SegOrient.any):

===== CODE START =====

AnyFunInterpol Data = {

Type = PiecewiseLinear;

FileName = .DataFile;

}; // Data

AnySeg Seg = {

Mass = 0;

Jii = {0,0,0};

AnyRefNode ISBNode = {

sRel = {0,0,0};

ARel = Main.Model.Environment.GlobalRef.ISBFrame.ARel;

AnyDrawRefFrame DrawRef = {

RGB = {0,1,0};

ScaleXYZ = {0.05,0.05,0.05} * …ShowOrient;

};

}; // ISBNode

// […]

}; // Seg

AnyKinEqSimpleDriver LinDriver = {

AnyKinLinear LinMeasure = {

AnyRefFrame &Global = Main.Model.Environment.GlobalRef.ISBFrame;

AnyRefFrame &Seg = …Seg.ISBNode;

Ref = 0;

}; // LinMeasure

Reaction.Type = {On, On, On}; // Markers need to be carried

DriverPos = {0,0,0};

DriverVel = {0,0,0};

}; // LinDriver

AnyKinEqInterPolDriver RotDriver = {

AnyKinRotational RotMeasure = {

AnyRefFrame &Global = Main.Model.Environment.GlobalRef.IRMFrame;

AnyRefFrame &Seg = …Seg.IRMNode;

Type = RotVector;

Ref = 0;

}; // RotMeasure

Reaction.Type = {On, On, On}; // Markers need to be carried

Type = PiecewiseLinear;

T = .Data.T;

Data = .Data.Data;

}; // RotDriver

===== CODE END =====

I then drive (by limiting rotations) the segment orientation to match this
null-mass segment (Drivers.any):

===== CODE START =====

AnyKinEqSimpleDriver RThighRotDriver = {

AnyKinRotational RotLink = {

AnyRefNode &Model =
Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.IRMNode;

AnyRefNode &Marker =
Main.Model.Environment.SegmentOrientations.RThigh.Seg.IRMNode;

Type = RotVector;

}; // RotLink

MeasureOrganizer = {0,1,2};

DriverPos = {0,0,0};

DriverVel = {0,0,0};

Reaction.Type = {Off,Off,Off};

}; // RThighRotDriver

===== CODE END =====

Up to here, everything seems fine. But when I look at my model, I notice a
fairly big orientation difference between the line joining the joint centers
(hip joint to knee joint) compared to the equivalent line drawn from my
marker data (hip joint center virtual marker and knee joint center virtual
marker). At first, I blame my transformations/calculations previous to
entering it in Anybody, but strangely, the error seem to come from Anybody!

To test demonstrate this, I simply created a measure that measure directly
the orientation difference between the global reference frame and the thigh
segment (STS.main.any):

===== CODE START =====

AnyKinRotational RThighRotV = {

AnyRefFrame &RefFrame = Main.Model.Environment.GlobalRef.IRMFrame;

AnyRefFrame &Thigh =
Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.IRMNode;

Type = RotVector;

};

===== CODE END =====

Strangely enough, this last measure (RThighRotV) gives me a different result
than the one that is being driven (LinDriver.LinMeasure)! The error is
present both in the 3D view and the data.

Values at frame 0:

Main.Study.Output.Model.Environment.SegmentOrientations.RThigh.RotDriver.Rot
Measure.Pos

0.108464

0.058994

-1.187838

Main.Study.Output.Model.RThighRotV.Pos

0.08990936

0.06810572

-1.132129

So I assume that I am missing something fairly big or there is a bug, in
either case, I need your help as I am kinda stuck…

Other specifics:

  • I use Anybody 2.x, although I tried on 3.x with the same results.

  • I use the repository 6.0.

  • I used repository 6.0 also for 3.x, although it gives me several
    warnings about the Ref parameter which is now deprecated, but it worked
    anyway.

Below is the link to download the model:

http://www.health- <http://www.health-ingenio.com/Files/Model.zip>
ingenio.com/Files/Model.zip

Note that the repository is not included and should be placed under
Repository.6, at the same level as the zip’s directory.

Thank you very much for your help!

Jean-Olivier Racine, ing.jr

joracine@humancad. <mailto:joracine%40humancad.com> com

HumanCAD Development Team

NexGen Ergonomics Inc.

http://www.nexgener <http://www.nexgenergo.com> go.com

(450) 621-0138

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.237 / Virus Database: 270.11.9/1991 - Release Date: 03/10/09
07:19:00

[Non-text portions of this message have been removed]

Hi,

It is good to know that you fixed it and that it was not a bug in the
AnyForceMomentMeasure.

Good luck with your work.

Best regards,

Sylvain, AnyBody Support


From: anyscript@yahoogroups.com [mailto:anyscript@yahoogroups.com] On Behalf
Of Jean-Olivier Racine
Sent: 13. marts 2009 03:40
To: anyscript@yahoogroups.com
Subject: RE: [AnyScript] Wrong orientation when driving model

Hello Sylvain,

Thank you very much for your help and time. It seems the values we’re in
fact identical, my mistake comes from a small bug that prevents from
charging variable in AnyChart when you have selected Data in the top window.
Therefore when I clicked on the RThighRotV measure to see its value, I was
still on the quaternion values, and I could only see the first three lines,
which prevented me from figuring out that it was a 4 value variable… :frowning:
Sorry about that.

In fact, my problem was related to my transformation matrix
(GlobalFrame.IRMFrame.ARel) which we’re wrong, giving a 180 degree rotation
to the thigh segments.

I am sorry you had to go through all this, yet, it still helped me to find
the solution, so thank you very, very much.

Jean-Olivier Racine, ing.jr

joracine@humancad. <mailto:joracine%40humancad.com> com

HumanCAD Development Team

NexGen Ergonomics Inc.

http://www.nexgener <http://www.nexgenergo.com> go.com

(450) 621-0138

From: anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com> ps.com
[mailto:anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com> ps.com] On
Behalf
Of AnyScript Support
Sent: March-10-09 10:36 AM
To: anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com> ps.com
Subject: RE: [AnyScript] Wrong orientation when driving model

Hi Jean Olivier,

I run the model with version 3.0.1 and 3.0.2 (I don’t have 2.x currently
installed) and Rep6.

The driver AnyKinEqSimpleDriver RthighRotDriver linking the thigh and the
NoMass segment is working correctly. I drew both IRMNode and they are
perfectly aligned in the model view. Also the rotational measures
Main.Study.Output.Model.Environment.SegmentOrientations.RThigh.RotDriver.Rot
Measure.Pos and Main.Study.Output.Model.RThighRotV.Pos are exactly similar.
You said the difference between the measures is also present in 3.x right?
Can you tell me exactly which version of AnyBody 3.x and 2.x are you using?

Also can you please draw the ref frame of the nodes like following and
verify that they are aligned?

Main.Model.Environment.SegmentOrientations.RThigh.Seg.IRMNode = {

AnyDrawRefFrame drw =

{

RGB = {1, 0, 0};

ScaleXYZ = 0.5*{1, 1, 1};

};

};

Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.IRMNode = {

AnyDrawRefFrame drw =

{

RGB = {0, 0, 1};

ScaleXYZ = 0.5*{1, 1, 1};

};

};

Then in addition of this possible problem in a certain version I think I
found another error. The SegmentOrientations.RThigh.Seg.IRMNode is not
aligned with the red line connecting the markers representing the hip and
knee joint centres, which should be if I understood well the model. The
thigh is correctly aligned with the dummy segment but as this last one is
not aligned with red lines then the thigh doesn’t match either the red
lines.

That means the problem can be in the interpolated data used to drive the
dummy segment.

Did you process this data in some way? Are sure it is given in the right
coordinate system?

Best regards,

Sylvain, AnyBody Support


From: anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com> ps.com
<mailto:anyscript%40yahoogroups.com>
[mailto:anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com> ps.com
<mailto:anyscript%40yahoogroups.com> ] On
Behalf
Of Jean-Olivier Racine
Sent: 10. marts 2009 02:07
To: anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com> ps.com
<mailto:anyscript%40yahoogroups.com>
Cc: Rachid.Aissaoui@ <mailto:Rachid.Aissaoui%40etsmtl.ca> etsmtl.ca
<mailto:Rachid.Aissaoui%40etsmtl.ca>
Subject: [AnyScript] Wrong orientation when driving model

Hello guys,

As some of you may know, I am working on a sit-to-stand model. My model is
based on the old Gait model (lower-limb) and uses orientation to drive the
segments. In short, I drive the thigh (3 DOFs x 2) and pelvis (3 DOFs)
segments using data files that contain rotation vectors over time, and I use
angles to drive the shank (knee, 1 DOF x 2) and feet (ankle, 2 DOFs x 2)
(time + 3 components) and I position the center of the pelvis (3 DOFs).

My problem is that the orientation of the segments do not match the
orientation I supply. More specifically, if I measure (using a
AnyKinRotational) the orientation between the global reference frame and the
thigh segment, I get a different result than if I look at the measure/driver
used to drive this very segment.

Here are extracts from the model code (links to the full model will follow)
and the specifics:

I first drive a zero-mass segment’s orientation to fit my rotational vector
data (SegOrient.any):

===== CODE START =====

AnyFunInterpol Data = {

Type = PiecewiseLinear;

FileName = .DataFile;

}; // Data

AnySeg Seg = {

Mass = 0;

Jii = {0,0,0};

AnyRefNode ISBNode = {

sRel = {0,0,0};

ARel = Main.Model.Environment.GlobalRef.ISBFrame.ARel;

AnyDrawRefFrame DrawRef = {

RGB = {0,1,0};

ScaleXYZ = {0.05,0.05,0.05} * …ShowOrient;

};

}; // ISBNode

// […]

}; // Seg

AnyKinEqSimpleDriver LinDriver = {

AnyKinLinear LinMeasure = {

AnyRefFrame &Global = Main.Model.Environment.GlobalRef.ISBFrame;

AnyRefFrame &Seg = …Seg.ISBNode;

Ref = 0;

}; // LinMeasure

Reaction.Type = {On, On, On}; // Markers need to be carried

DriverPos = {0,0,0};

DriverVel = {0,0,0};

}; // LinDriver

AnyKinEqInterPolDriver RotDriver = {

AnyKinRotational RotMeasure = {

AnyRefFrame &Global = Main.Model.Environment.GlobalRef.IRMFrame;

AnyRefFrame &Seg = …Seg.IRMNode;

Type = RotVector;

Ref = 0;

}; // RotMeasure

Reaction.Type = {On, On, On}; // Markers need to be carried

Type = PiecewiseLinear;

T = .Data.T;

Data = .Data.Data;

}; // RotDriver

===== CODE END =====

I then drive (by limiting rotations) the segment orientation to match this
null-mass segment (Drivers.any):

===== CODE START =====

AnyKinEqSimpleDriver RThighRotDriver = {

AnyKinRotational RotLink = {

AnyRefNode &Model =
Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.IRMNode;

AnyRefNode &Marker =
Main.Model.Environment.SegmentOrientations.RThigh.Seg.IRMNode;

Type = RotVector;

}; // RotLink

MeasureOrganizer = {0,1,2};

DriverPos = {0,0,0};

DriverVel = {0,0,0};

Reaction.Type = {Off,Off,Off};

}; // RThighRotDriver

===== CODE END =====

Up to here, everything seems fine. But when I look at my model, I notice a
fairly big orientation difference between the line joining the joint centers
(hip joint to knee joint) compared to the equivalent line drawn from my
marker data (hip joint center virtual marker and knee joint center virtual
marker). At first, I blame my transformations/calculations previous to
entering it in Anybody, but strangely, the error seem to come from Anybody!

To test demonstrate this, I simply created a measure that measure directly
the orientation difference between the global reference frame and the thigh
segment (STS.main.any):

===== CODE START =====

AnyKinRotational RThighRotV = {

AnyRefFrame &RefFrame = Main.Model.Environment.GlobalRef.IRMFrame;

AnyRefFrame &Thigh =
Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.IRMNode;

Type = RotVector;

};

===== CODE END =====

Strangely enough, this last measure (RThighRotV) gives me a different result
than the one that is being driven (LinDriver.LinMeasure)! The error is
present both in the 3D view and the data.

Values at frame 0:

Main.Study.Output.Model.Environment.SegmentOrientations.RThigh.RotDriver.Rot
Measure.Pos

0.108464

0.058994

-1.187838

Main.Study.Output.Model.RThighRotV.Pos

0.08990936

0.06810572

-1.132129

So I assume that I am missing something fairly big or there is a bug, in
either case, I need your help as I am kinda stuck…

Other specifics:

  • I use Anybody 2.x, although I tried on 3.x with the same results.

  • I use the repository 6.0.

  • I used repository 6.0 also for 3.x, although it gives me several
    warnings about the Ref parameter which is now deprecated, but it worked
    anyway.

Below is the link to download the model:

http://www.health- <http://www.health-
<http://www.health-ingenio.com/Files/Model.zip> ingenio.com/Files/Model.zip>
ingenio.com/Files/Model.zip

Note that the repository is not included and should be placed under
Repository.6, at the same level as the zip’s directory.

Thank you very much for your help!

Jean-Olivier Racine, ing.jr

joracine@humancad. <mailto:joracine%40humancad.com> com

HumanCAD Development Team

NexGen Ergonomics Inc.

http://www.nexgener <http://www.nexgener <http://www.nexgenergo.com> go.com>
go.com

(450) 621-0138

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.237 / Virus Database: 270.11.9/1991 - Release Date: 03/10/09
07:19:00

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]