Giter Club home page Giter Club logo

pyorerun's Introduction

Pyorerun

Maintainability

We can rerun c3d files and display their original content. And all also animate biorbd models from the pyomeca organization.

Installation prerequisites

conda install -c conda-forge ezc3d rerun-sdk trimesh numpy biorbd pyomeca tk

Then, ensure it is accessible in your Python environment by installing the package:

pip install . or python setup.py install

Conda install will come soon. Don't worry ๐Ÿ˜Š.

conda install -c conda-forge pyorerun

Rerun .c3d - As simple as that

import pyorerun as prr

prr.c3d("example.c3d")

logo

NOTE: Only handle markers for now

Rerun biorbd Models

from pyorerun import BiorbdModel, PhaseRerun

nb_frames = 10
nb_seconds = 0.1
t_span = np.linspace(0, nb_seconds, nb_frames)

model = BiorbdModel("models/Wu_Shoulder_Model_kinova_scaled_adjusted_2.bioMod")
q = np.zeros((model.model.nbQ(), nb_frames))

viz = PhaseRerun(t_span)
viz.add_animated_model(model, q)
viz.rerun("msk_model")

logo

play with joint DoFs q

from pyorerun import LiveModelAnimation


model_path = "models/Wu_Shoulder_Model_kinova_scaled_adjusted_2.bioMod"
animation = LiveModelAnimation(model_path, with_q_charts=True)
animation.rerun()

Contributing

Contributions are welcome. I will be happy to review and help you to improve the code.

pyorerun's People

Contributors

ipuch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pyorerun's Issues

Pyorerun for gait

Hi @Ipuch

Would it be interesting to adapt pyorerun to include more features specific to gait analysis?

  • represent force plate and external force
  • provide stick model in line with main gait models
  • show forces (as done for markers)
  • ... to be discussed with experts in gait

mickael

LocalFrame replaced by Transform3D

from math import pi

import rerun as rr
from rerun.datatypes import Angle, RotationAxisAngle

rr.init("rerun_example_transform3d", spawn=True)

arrow = rr.Arrows3D(origins=[0, 0, 0], vectors=[0, 1, 0])

rr.log("base", arrow)

rr.log("base/translated", rr.Transform3D(translation=[1, 0, 0]))
rr.log("base/translated", arrow)

rr.log(
    "base/rotated_scaled",
    rr.Transform3D(
        rotation=RotationAxisAngle(axis=[0, 0, 1], angle=Angle(rad=pi / 4)),
        scale=2,
    ),
)
rr.log("base/rotated_scaled", arrow)

Models with no mesh doesn't display

Thanks @Infa60

version	1

// General informations
root_actuated 1
external_forces 0

// Informations about Pelvis segment
	// Segment
	segment	Pelvis
		RT
			1.0000000000	0.0000000000	0.0000000000	0.0000000000
			0.0000000000	1.0000000000	0.0000000000	0.0000000000
			0.0000000000	0.0000000000	1.0000000000	0.0000000000
			0.0000000000	0.0000000000	0.0000000000	1.0000000000
		translations	xyz
		rotations	xyz
		mass	9.58000
		inertia
			0.0477000000	0.0000000000	0.0000000000
			0.0000000000	0.0867000000	0.0000000000
			0.0000000000	0.0000000000	0.0778000000
		com		0.0000000000		0.0000000000		0.0918000000
	endsegment

	// Markers
	marker	EIASD
		parent	Pelvis
		position	0.1241850108	0.0875764484	-0.0000000000
		technical 1
	endmarker
	marker	CID
		parent	Pelvis
		position	0.1499331029	-0.0194301197	0.0761722448
		technical 1
	endmarker
	marker	EIPSD
		parent	Pelvis
		position	0.0381419560	-0.0926274407	0.0004204501
		technical 1
	endmarker
	marker	EIPSG
		parent	Pelvis
		position	-0.0381419560	-0.0879143256	-0.0004204501
		technical 1
	endmarker
	marker	CIG
		parent	Pelvis
		position	-0.1432984214	0.0163805324	0.0771860961
		technical 1
	endmarker
	marker	EIASG
		parent	Pelvis
		position	-0.1241850108	0.0929653179	-0.0000000000
		technical 1
	endmarker

Update mesh position faster

"""Log a simple colored triangle, then update its vertices' positions each frame."""
import numpy as np
import rerun as rr
from rerun.components import Position3DBatch

rr.init("rerun_example_mesh3d_partial_updates", spawn=True)

vertex_positions = np.array([[-1.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]], dtype=np.float32)

# Log the initial state of our triangle
rr.set_time_sequence("frame", 0)
rr.log(
    "triangle",
    rr.Mesh3D(
        vertex_positions=vertex_positions,
        vertex_normals=[0.0, 0.0, 1.0],
        vertex_colors=[[255, 0, 0], [0, 255, 0], [0, 0, 255]],
    ),
)

# Only update its vertices' positions each frame
factors = np.abs(np.sin(np.arange(1, 300, dtype=np.float32) * 0.04))
for i, factor in enumerate(factors):
    rr.set_time_sequence("frame", i)
    rr.log_components("triangle", [Position3DBatch(vertex_positions * factor)])

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.