Skip to content

Commit c27b327

Browse files
authored
Merge pull request #93 from Ipuch/pin
fix(dof names in pinocchio models interface)
2 parents dfb48d8 + d406857 commit c27b327

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
We can rerun c3d files and display their original content.
55
And also animate biorbd models from the pyomeca organization.
66

7-
``` conda install -c conda-forge pyorerun rerun-sdk=0.24.1```
7+
``` conda install -c conda-forge pyorerun rerun-sdk=0.27.2```
88
``` pip install trc-data-reader``` # for .trc file support
99
``` conda install opensim-org::opensim # not a mandatory dependency```
1010
``` conda install -c conda-forge biobuddy=0.2.0 # not a mandatory dependency```
@@ -59,7 +59,7 @@ animation.rerun()
5959
```
6060

6161
## From source
62-
```conda install -c conda-forge ezc3d rerun-sdk=0.24 trimesh numpy biorbd pyomeca tk imageio imageio-ffmpeg```
62+
```conda install -c conda-forge ezc3d rerun-sdk=0.27.2 trimesh numpy biorbd pyomeca tk imageio imageio-ffmpeg```
6363

6464
if you want to use the OpenSim, you also need to install separately:
6565
```conda install -c opensim-org::opensim```

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ channels:
55
- opensim-org
66
dependencies:
77
- ezc3d
8-
- rerun-sdk=0.24.1
8+
- rerun-sdk=0.27.2
99
- numpy
1010
- matplotlib
1111
- biorbd>=1.10.5

pyorerun/model_interfaces/pinocchio_model_interface.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ def mesh_path(self) -> list[str]:
6363
".mesh",
6464
".ply",
6565
]:
66-
if self._mesh_dir and not os.path.isabs(mesh_path_str):
67-
mesh_path_str = str(self._mesh_dir / mesh_path_str)
6866
mesh_paths.append(mesh_path_str)
6967
return mesh_paths
7068

@@ -158,10 +156,9 @@ def marker_names(self) -> tuple[str, ...]:
158156
In Pinocchio, markers can be represented as frames or operational frames.
159157
This returns all frame names that could represent markers.
160158
"""
161-
# Get all frames that are not joint frames
162159
marker_frames = []
163160
for frame in self.model.frames:
164-
if frame.type == pin.FrameType.OP_FRAME:
161+
if frame.type == pin.FrameType.SENSOR:
165162
marker_frames.append(frame.name)
166163
return tuple(marker_frames)
167164

@@ -275,8 +272,21 @@ def nb_q(self) -> int:
275272
def dof_names(self) -> tuple[str, ...]:
276273
"""
277274
Returns the names of all degrees of freedom.
275+
276+
Notes
277+
-----
278+
We need to skip the first joint (universe) as it has no DoFs.
279+
Joint DoFs can have individual names if they have multiple DoFs (e.g., a 3-DoF joint).
278280
"""
279-
return tuple(self.model.names[1:]) # Skip universe/world
281+
dof_names = []
282+
for joint, name in zip(self.model.joints[1:], self.model.names[1:]):
283+
if joint.nq == 0:
284+
continue
285+
286+
for k in range(joint.nq):
287+
dof_names.append(f"{name}_{k}")
288+
289+
return tuple(dof_names)
280290

281291
@cached_property
282292
def q_ranges(self) -> tuple[tuple[float, float], ...]:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ classifiers = [
2222
dependencies = [
2323
"ezc3d", # Now needed, but imported for our custom PyoMarkers.from_c3d()
2424
"numpy",
25-
"rerun-sdk==0.24.1",
25+
"rerun-sdk==0.27.2",
2626
"trimesh",
2727
"tk",
2828
"imageio",

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
install_requires=[
77
"ezc3d", # Not yet available on pypi, use `conda install -c conda-forge ezc3d`
88
"numpy",
9-
"rerun-sdk=0.24.1",
9+
"rerun-sdk=0.27.2",
1010
"trimesh",
1111
"tk",
1212
"imageio",

0 commit comments

Comments
 (0)