Search found 418 matches

by Mohammadreza Rezaie
Sat Feb 01, 2025 1:04 pm
Forum: OpenSim
Topic: Transform a point into a new frame
Replies: 1
Views: 310

Re: Transform a point into a new frame

***UPDATE*** Transform::shiftBaseStationToFrame did it. I'm posting the solution here: import opensim as osim point = osim.Vec3(...) rotMat = osim.Rotation() rotMat.setRotationToBodyFixedXYZ( osim.Vec3(...) ) location = osim.Vec3(...) transMat = osim.Transform(rotMat, location) transMat.shiftBaseSta...
by Mohammadreza Rezaie
Fri Jan 31, 2025 1:49 am
Forum: OpenSim
Topic: Transform a point into a new frame
Replies: 1
Views: 310

Transform a point into a new frame

Hi, I have a 3D point, and I want to express it wrt a new frame: 3D_space_point_frames.png I want to learn how to do it with OpenSim API. I can create two PhysicalOffsetFrame objects (one for the origin and one for the new frame), update their orientations ( set_orientation ) and translations ( set_...
by Mohammadreza Rezaie
Fri Jan 31, 2025 1:32 am
Forum: OpenSim
Topic: Read/write mesh file
Replies: 4
Views: 757

Re: Read/write mesh file

Nice, thanks for your help.
by Mohammadreza Rezaie
Sun Jan 26, 2025 12:32 am
Forum: OpenSim
Topic: Read/write mesh file
Replies: 4
Views: 757

Re: Read/write mesh file

Thanks Dr. Uchida for your response. I shouldn't have combined the commands; now it works: mesh = osim.PolygonalMesh() mesh.loadFile("l_femur.vtp") for i in range(mesh.getNumVertices()): print(i, mesh.getVertexPosition(i)) However, the PolygonalMesh only reads the points, and I couldn't find any met...
by Mohammadreza Rezaie
Fri Jan 17, 2025 9:35 pm
Forum: OpenSim
Topic: Read/write mesh file
Replies: 4
Views: 757

Read/write mesh file

Hi, I need to read/write the points and normals from/to mesh files (e.g. vtp, stl), and am currently using XML parsing methods (I prefer not to use external libraries). I wonder if such method already exists in OpenSim API. I tested PolygonalMesh() , but the output is empty. >>> import opensim as os...
by Mohammadreza Rezaie
Fri Jan 17, 2025 8:35 pm
Forum: OpenSim
Topic: Obtaining body rotation matrices in a loop
Replies: 3
Views: 1793

Re: Obtaining body rotation matrices in a loop

Hi, there is already a method for updating the column labels TabOpUseAbsoluteStateNames : table = osim.TableProcessor(IK_path) table.append(osim.TabOpConvertDegreesToRadians()) # if in degrees table.append(osim.TabOpUseAbsoluteStateNames()) table = table.process(model) Alternatively, you can update ...
by Mohammadreza Rezaie
Sun Dec 08, 2024 2:52 am
Forum: OpenSim
Topic: How to use the getCoordinatesInMultibodyTreeOrder() function in Python
Replies: 5
Views: 1589

Re: How to use the getCoordinatesInMultibodyTreeOrder() function in Python

Hi, it seems that this method has been introduced recently and doesn't exist in the official 4.5 release. Possible solutions: 1. You can wait for the next official release. 2. Try the latest artifact: https://github.com/opensim-org/opensim-gui/wiki#how-to-get-the-latest-buildartifact 3. Use this alt...
by Mohammadreza Rezaie
Sat Dec 07, 2024 9:55 am
Forum: OpenSim
Topic: How to use the getCoordinatesInMultibodyTreeOrder() function in Python
Replies: 5
Views: 1589

Re: How to use the getCoordinatesInMultibodyTreeOrder() function in Python

Hi, getCoordinateNamesInMultibodyTreeOrder can be used instead:

Code: Select all

model.initSystem()
coordNames = model.getCoordinateNamesInMultibodyTreeOrder()
[coordNames.getElt(i) for i in range(coordNames.size())]
Hope this helps.
by Mohammadreza Rezaie
Thu Dec 05, 2024 10:41 am
Forum: OpenSim
Topic: Inverse Dynamics with and without COP
Replies: 2
Views: 605

Re: Inverse Dynamics with and without COP

Hi Nicos, please find the attached files:
Trial1_FPOrigin.zip
(448.77 KiB) Downloaded 99 times
Trial1_COP.zip
(538.73 KiB) Downloaded 97 times
Thanks
by Mohammadreza Rezaie
Wed Dec 04, 2024 4:32 am
Forum: OpenSim
Topic: Inverse Dynamics with and without COP
Replies: 2
Views: 605

Inverse Dynamics with and without COP

Hi, this might be a stupid question. I created the GRF file with ForceLocation set to zero (forceplate origin) and one (COP). This is the output which makes sense: COP.png Then I executed Inverse Dynamics for each file. My question is why the outputs are exactly identical? Moment.png It seems that t...