Git Product home page Git Product logo

Comments (2)

pariterre avatar pariterre commented on May 27, 2024

Hi there!

I am one of the programmer of pyomeca, but not so much of pyomeca itself, so please pardon myself if I am give edgy advices!

So depending on what you are trying to actually achieve, it seems that an actual kinematics model could be interesting (using for instance bioviz or opensim), instead of directly plotting the joint in the 3d space.
If plotting in 3d space is actually what you want to do, the easiest way is to declare them as Markers in pyomeca.
To declare markers in pyomeca, the most direct way is to use the from methods (such as: pyomeca.Markers.from_csv). But they can also be directly declared from a numpy array as such:

import numpy as np
import pyomeca

# generate some data
n_joints = 15
n_frames = 100
data = np.random.rand(3, n_joints, n_frames) * 1000  # Generate XYZ for all the joints center for each frame

# Convert them to pyomeca
d = pyomeca.Markers(data)

Then you can use bioviz to print them in the 3d space (please note, this is not the intended way to use bioviz, as it is supposed to be used from a bioMod file, but it can be bypass like that:

from bioviz.biorbd_vtk import VtkModel, VtkWindow, Mesh

# Create a windows with a nice gray background
vtk_window = VtkWindow(background_color=(0.5, 0.5, 0.5))

# Add marker holders to the window
vtk_markers = VtkModel(vtk_window, markers_color=(1, 0, 0), markers_size=10.0, markers_opacity=1, rt_length=100)

# Animate in loop
i = 0
while vtk_window.is_active:
    vtk_markers.update_markers(d.isel(time=[i]))
    vtk_window.update_frame()
    i += 1
    if i >= n_frames:
        i = 0

For the question in regards pyosym, I cannot help much as I never used it myself. But as far as I am concerned, you can launch every filter of Opensim from that interface

Hope this helps!

from pyomeca.

steakerlife avatar steakerlife commented on May 27, 2024

I will give this a shot! Thank you!!

from pyomeca.

Related Issues (20)

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.