Skip to content

Commit

Permalink
Merge pull request #38 from Ipuch/main
Browse files Browse the repository at this point in the history
feat: meshlines of biorbd and wheelchair example
  • Loading branch information
Ipuch authored Jun 28, 2024
2 parents 00083ea + 90cc332 commit 87f7800
Show file tree
Hide file tree
Showing 5 changed files with 438 additions and 4 deletions.
27 changes: 27 additions & 0 deletions examples/biorbd/meshline_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import numpy as np

from pyorerun import PhaseRerun, BiorbdModel


def main():
biorbd_model_path = "models/2d_wheelchair.bioMod"

# building some time components
nb_frames = 200
nb_seconds = 1
t_span = np.linspace(0, nb_seconds, nb_frames)

# loading biorbd model
biorbd_model = BiorbdModel(biorbd_model_path)
nq = biorbd_model.model.nbQ()

# running the animation
rerun_biorbd = PhaseRerun(t_span)
np.random.seed(42)
q = np.linspace(np.array([0, 0, 0, -1]), np.array([0.35 * 2, -2, 1, 1.5]), nb_frames).T
rerun_biorbd.add_animated_model(biorbd_model, q)
rerun_biorbd.rerun("animation")


if __name__ == "__main__":
main()
350 changes: 350 additions & 0 deletions examples/biorbd/models/2d_wheelchair.bioMod
Original file line number Diff line number Diff line change
@@ -0,0 +1,350 @@
version 4

gravity 0 -9.81 0

// Segment representing the wheelchair (without wheel)
segment Wheelchair
rt 0 0 0 xyz 0 0.35 0
translations x
ranges
-10 10
mass 89.64 // Mass of the wheelchair segment
inertia
0.0484311488 0 0
0 0.0484311488 0
0 0 0.0484311488
com 0.10537237661758142 0.31566042659527 0 // Center of mass position of the wheelchair segment
mesh 0.65000 -0.25000 0.00000
mesh 0.64511 -0.21910 0.00000
mesh 0.63090 -0.19122 0.00000
mesh 0.60878 -0.16910 0.00000
mesh 0.58090 -0.15489 0.00000
mesh 0.55000 -0.15000 0.00000
mesh 0.51910 -0.15489 0.00000
mesh 0.49122 -0.16910 0.00000
mesh 0.46910 -0.19122 0.00000
mesh 0.45489 -0.21910 0.00000
mesh 0.45000 -0.25000 0.00000
mesh 0.45489 -0.28090 0.00000
mesh 0.46910 -0.30878 0.00000
mesh 0.49122 -0.33090 0.00000
mesh 0.51910 -0.34511 0.00000
mesh 0.55000 -0.35000 0.00000
mesh 0.58090 -0.34511 0.00000
mesh 0.60878 -0.33090 0.00000
mesh 0.63090 -0.30878 0.00000
mesh 0.64511 -0.28090 0.00000
mesh 0.65000 -0.25000 0.00000
mesh -0.05000 0.40000 0.00000
mesh 0.35000 0.40000 0.00000
mesh 0.35000 0.35000 0.00000
mesh -0.05000 0.35000 0.00000
mesh -0.05000 0.40000 0.00000
mesh -0.05000 0.70000 0.00000
mesh -0.05000 0.70000 0.00000
mesh -0.05000 0.40000 0.00000
mesh 0.00000 0.00000 0.00000
mesh 0.55000 0.10000 0.00000
mesh 0.10000 0.30000 0.00000
mesh 0.10000 0.35000 0.00000
endsegment


segment Wheel
parent Wheelchair
rtinmatrix 0
rt 0 0 0 xyz 0 0 0
rotations z
ranges
-10*pi 10*pi
mass 3.79 // Mass of the wheel segment
inertia
0 0 0
0 0 0
0 0 0.16
com 0 0 0 // Center of mass position of the wheel segment
mesh 0.35000 0.00000 0.00000
mesh 0.34931 0.02198 0.00000
mesh 0.34724 0.04387 0.00000
mesh 0.34380 0.06558 0.00000
mesh 0.33900 0.08704 0.00000
mesh 0.33287 0.10816 0.00000
mesh 0.32542 0.12884 0.00000
mesh 0.31669 0.14902 0.00000
mesh 0.30671 0.16861 0.00000
mesh 0.29551 0.18754 0.00000
mesh 0.28316 0.20572 0.00000
mesh 0.26968 0.22310 0.00000
mesh 0.25514 0.23959 0.00000
mesh 0.23959 0.25514 0.00000
mesh 0.22310 0.26968 0.00000
mesh 0.20572 0.28316 0.00000
mesh 0.18754 0.29551 0.00000
mesh 0.16861 0.30671 0.00000
mesh 0.14902 0.31669 0.00000
mesh 0.12884 0.32542 0.00000
mesh 0.10816 0.33287 0.00000
mesh 0.08704 0.33900 0.00000
mesh 0.06558 0.34380 0.00000
mesh 0.04387 0.34724 0.00000
mesh 0.02198 0.34931 0.00000
mesh -0.00000 0.35000 0.00000
mesh -0.02198 0.34931 0.00000
mesh -0.04387 0.34724 0.00000
mesh -0.06558 0.34380 0.00000
mesh -0.08704 0.33900 0.00000
mesh -0.10816 0.33287 0.00000
mesh -0.12884 0.32542 0.00000
mesh -0.14902 0.31669 0.00000
mesh -0.16861 0.30671 0.00000
mesh -0.18754 0.29551 0.00000
mesh -0.20572 0.28316 0.00000
mesh -0.22310 0.26968 0.00000
mesh -0.23959 0.25514 0.00000
mesh -0.25514 0.23959 0.00000
mesh -0.26968 0.22310 0.00000
mesh -0.28316 0.20572 0.00000
mesh -0.29551 0.18754 0.00000
mesh -0.30671 0.16861 0.00000
mesh -0.31669 0.14902 0.00000
mesh -0.32542 0.12884 0.00000
mesh -0.33287 0.10816 0.00000
mesh -0.33900 0.08704 0.00000
mesh -0.34380 0.06558 0.00000
mesh -0.34724 0.04387 0.00000
mesh -0.34931 0.02198 0.00000
mesh -0.35000 -0.00000 0.00000
mesh -0.34931 -0.02198 0.00000
mesh -0.34724 -0.04387 0.00000
mesh -0.34380 -0.06558 0.00000
mesh -0.33900 -0.08704 0.00000
mesh -0.33287 -0.10816 0.00000
mesh -0.32542 -0.12884 0.00000
mesh -0.31669 -0.14902 0.00000
mesh -0.30671 -0.16861 0.00000
mesh -0.29551 -0.18754 0.00000
mesh -0.28316 -0.20572 0.00000
mesh -0.26968 -0.22310 0.00000
mesh -0.25514 -0.23959 0.00000
mesh -0.23959 -0.25514 0.00000
mesh -0.22310 -0.26968 0.00000
mesh -0.20572 -0.28316 0.00000
mesh -0.18754 -0.29551 0.00000
mesh -0.16861 -0.30671 0.00000
mesh -0.14902 -0.31669 0.00000
mesh -0.12884 -0.32542 0.00000
mesh -0.10816 -0.33287 0.00000
mesh -0.08704 -0.33900 0.00000
mesh -0.06558 -0.34380 0.00000
mesh -0.04387 -0.34724 0.00000
mesh -0.02198 -0.34931 0.00000
mesh -0.00000 -0.35000 0.00000
mesh 0.02198 -0.34931 0.00000
mesh 0.04387 -0.34724 0.00000
mesh 0.06558 -0.34380 0.00000
mesh 0.08704 -0.33900 0.00000
mesh 0.10816 -0.33287 0.00000
mesh 0.12884 -0.32542 0.00000
mesh 0.14902 -0.31669 0.00000
mesh 0.16861 -0.30671 0.00000
mesh 0.18754 -0.29551 0.00000
mesh 0.20572 -0.28316 0.00000
mesh 0.22310 -0.26968 0.00000
mesh 0.23959 -0.25514 0.00000
mesh 0.25514 -0.23959 0.00000
mesh 0.26968 -0.22310 0.00000
mesh 0.28316 -0.20572 0.00000
mesh 0.29551 -0.18754 0.00000
mesh 0.30671 -0.16861 0.00000
mesh 0.31669 -0.14902 0.00000
mesh 0.32542 -0.12884 0.00000
mesh 0.33287 -0.10816 0.00000
mesh 0.33900 -0.08704 0.00000
mesh 0.34380 -0.06558 0.00000
mesh 0.34724 -0.04387 0.00000
mesh 0.34931 -0.02198 0.00000
mesh 0.35000 0.00000 0.00000
endsegment

segment ContactFrame
parent Wheel
rtinmatrix 0
rt 0 0 0.2 xyz 0 0 0
mass 0
inertia
0 0 0
0 0 0
0 0 0
com 0 0 0 // Center of mass position of the wheel segment
mesh 0.30000 0.00000 0.00000
mesh 0.29941 0.01884 0.00000
mesh 0.29763 0.03760 0.00000
mesh 0.29469 0.05621 0.00000
mesh 0.29057 0.07461 0.00000
mesh 0.28532 0.09271 0.00000
mesh 0.27893 0.11044 0.00000
mesh 0.27145 0.12773 0.00000
mesh 0.26289 0.14453 0.00000
mesh 0.25330 0.16075 0.00000
mesh 0.24271 0.17634 0.00000
mesh 0.23115 0.19123 0.00000
mesh 0.21869 0.20536 0.00000
mesh 0.20536 0.21869 0.00000
mesh 0.19123 0.23115 0.00000
mesh 0.17634 0.24271 0.00000
mesh 0.16075 0.25330 0.00000
mesh 0.14453 0.26289 0.00000
mesh 0.12773 0.27145 0.00000
mesh 0.11044 0.27893 0.00000
mesh 0.09271 0.28532 0.00000
mesh 0.07461 0.29057 0.00000
mesh 0.05621 0.29469 0.00000
mesh 0.03760 0.29763 0.00000
mesh 0.01884 0.29941 0.00000
mesh -0.00000 0.30000 0.00000
mesh -0.01884 0.29941 0.00000
mesh -0.03760 0.29763 0.00000
mesh -0.05621 0.29469 0.00000
mesh -0.07461 0.29057 0.00000
mesh -0.09271 0.28532 0.00000
mesh -0.11044 0.27893 0.00000
mesh -0.12773 0.27145 0.00000
mesh -0.14453 0.26289 0.00000
mesh -0.16075 0.25330 0.00000
mesh -0.17634 0.24271 0.00000
mesh -0.19123 0.23115 0.00000
mesh -0.20536 0.21869 0.00000
mesh -0.21869 0.20536 0.00000
mesh -0.23115 0.19123 0.00000
mesh -0.24271 0.17634 0.00000
mesh -0.25330 0.16075 0.00000
mesh -0.26289 0.14453 0.00000
mesh -0.27145 0.12773 0.00000
mesh -0.27893 0.11044 0.00000
mesh -0.28532 0.09271 0.00000
mesh -0.29057 0.07461 0.00000
mesh -0.29469 0.05621 0.00000
mesh -0.29763 0.03760 0.00000
mesh -0.29941 0.01884 0.00000
mesh -0.30000 -0.00000 0.00000
mesh -0.29941 -0.01884 0.00000
mesh -0.29763 -0.03760 0.00000
mesh -0.29469 -0.05621 0.00000
mesh -0.29057 -0.07461 0.00000
mesh -0.28532 -0.09271 0.00000
mesh -0.27893 -0.11044 0.00000
mesh -0.27145 -0.12773 0.00000
mesh -0.26289 -0.14453 0.00000
mesh -0.25330 -0.16075 0.00000
mesh -0.24271 -0.17634 0.00000
mesh -0.23115 -0.19123 0.00000
mesh -0.21869 -0.20536 0.00000
mesh -0.20536 -0.21869 0.00000
mesh -0.19123 -0.23115 0.00000
mesh -0.17634 -0.24271 0.00000
mesh -0.16075 -0.25330 0.00000
mesh -0.14453 -0.26289 0.00000
mesh -0.12773 -0.27145 0.00000
mesh -0.11044 -0.27893 0.00000
mesh -0.09271 -0.28532 0.00000
mesh -0.07461 -0.29057 0.00000
mesh -0.05621 -0.29469 0.00000
mesh -0.03760 -0.29763 0.00000
mesh -0.01884 -0.29941 0.00000
mesh -0.00000 -0.30000 0.00000
mesh 0.01884 -0.29941 0.00000
mesh 0.03760 -0.29763 0.00000
mesh 0.05621 -0.29469 0.00000
mesh 0.07461 -0.29057 0.00000
mesh 0.09271 -0.28532 0.00000
mesh 0.11044 -0.27893 0.00000
mesh 0.12773 -0.27145 0.00000
mesh 0.14453 -0.26289 0.00000
mesh 0.16075 -0.25330 0.00000
mesh 0.17634 -0.24271 0.00000
mesh 0.19123 -0.23115 0.00000
mesh 0.20536 -0.21869 0.00000
mesh 0.21869 -0.20536 0.00000
mesh 0.23115 -0.19123 0.00000
mesh 0.24271 -0.17634 0.00000
mesh 0.25330 -0.16075 0.00000
mesh 0.26289 -0.14453 0.00000
mesh 0.27145 -0.12773 0.00000
mesh 0.27893 -0.11044 0.00000
mesh 0.28532 -0.09271 0.00000
mesh 0.29057 -0.07461 0.00000
mesh 0.29469 -0.05621 0.00000
mesh 0.29763 -0.03760 0.00000
mesh 0.29941 -0.01884 0.00000
mesh 0.30000 0.00000 0.00000
endsegment

marker handrim_contact_point
parent ContactFrame
position 0 0.3 0
endmarker

contact handrim_contact_point
parent ContactFrame
position 0 0.3 0
axis yz
endcontact


// Segment representing the upper arm segment (shoulder to elbow)
segment Arm
parent Wheelchair
rt 0 0 0 xyz 0 0.7710000000000001 0
rotations z
ranges
-pi 0
mass 3.84 // Mass of the upper arm segment
inertia
0.030711263616000004 0 0
0 0.030711263616000004 0
0 0 0.030711263616000004
com 0.14910420000000002 0 0 // Center of mass position of the upper arm segment
mesh 0 0 0
mesh 0.271 0 0
endsegment

// Marker 0: Origin marker for Arm
marker marker_0
parent Arm
position 0 0 0
endmarker

// Marker 1: End marker for Arm
marker marker_1
parent Arm
position 0.271 0 0
endmarker

// Segment representing the forearm segment
segment Forearm
parent Arm
rt 0 0 0 xyz 0.271 0 0
rotations z
ranges
-0.1 pi
mass 3.68 // Mass of the forearm segment
inertia
0.04297025777218477 0 0
0 0.0002 0
0 0 0.04297025777218477
com 0.2100573304347826 0 0 // Center of mass position of the forearm segment
mesh 0 0 0
mesh 0.283 0 0
endsegment

// Marker 3: Origin marker for Forearm
marker marker_3
parent Forearm
position 0 0 0
endmarker

// Marker 4: End marker for Forearm
marker hand
parent Forearm
position 0.283 0 0
endmarker
Loading

0 comments on commit 87f7800

Please sign in to comment.