Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions binding/python3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}")
endif()

# We need to trick MSVC into keeping the rbdl-casadi as the first import. If we
# We need to trick MSVC (and why not all of them) into keeping the rbdl-casadi as the first import. If we
# just add it, it is pushed at the end because BIORBD will also includes it but
# as an external:import. Added the /../ tricks the parser into not recognizing
# that it is in fact the same directory
set(FORCED_FIRST_INCLUDE_DIRS "")
if(MSVC AND ${MATH_LIBRARY_BACKEND} STREQUAL "Casadi")
if(${MATH_LIBRARY_BACKEND} STREQUAL "Casadi")
set(FORCED_FIRST_INCLUDE_DIRS
"${RBDLCasadi_INCLUDE_DIR}/../rbdl-casadi"
)
Expand Down
2 changes: 1 addition & 1 deletion binding/python3/wrapper/extended_kalman_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ def reconstruct_frame(self, markers: BiorbdArray):

def reconstruct_frames(
self, all_markers: list[BiorbdArray]
) -> Generator[tuple[BiorbdArray, BiorbdArray, BiorbdArray]]:
) -> Generator[tuple[BiorbdArray, BiorbdArray, BiorbdArray], None, None]:
for markers in all_markers:
yield self.reconstruct_frame(markers)
21 changes: 16 additions & 5 deletions binding/python3/wrapper/misc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any
import sys

import numpy as np

Expand All @@ -11,12 +12,22 @@

# If we are using the Eigen backend, returns are np.arrays, if we are using CasADi backend, returns are MX
# So declare an "Array" typedef that will be np.array or MX depending on the backend
if currentLinearAlgebraBackend() == BIORBD_CASADI:
type BiorbdArray = MX
type BiorbdScalar = MX
if sys.version_info >= (3, 12):
if currentLinearAlgebraBackend() == BIORBD_CASADI:
type BiorbdArray = MX
type BiorbdScalar = MX
else:
type BiorbdArray = np.ndarray
type BiorbdScalar = float
else:
type BiorbdArray = np.ndarray
type BiorbdScalar = float
from typing import TypeAlias

if currentLinearAlgebraBackend() == BIORBD_CASADI:
BiorbdArray: TypeAlias = MX
BiorbdScalar: TypeAlias = MX
else:
BiorbdArray: TypeAlias = np.ndarray
BiorbdScalar: TypeAlias = float


# Declare a method that converts output to BiorbdArray
Expand Down
Loading