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
33 changes: 21 additions & 12 deletions bioptim/dynamics/fatigue/effort_perception.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
from .muscle_fatigue import MuscleFatigue
from .tau_fatigue import TauFatigue
from ...misc.enums import VariableType
from ...misc.parameters_types import (
Bool,
Float,
Str,
IntTuple,
StrTuple,
AnyTuple,
CX,
)


class EffortPerception(MuscleFatigue):
"""
A placeholder for fatigue dynamics.
"""

def __init__(self, effort_threshold: float, effort_factor: float, scaling: float = 1):
def __init__(self, effort_threshold: Float, effort_factor: Float, scaling: Float = 1):
"""
Parameters
----------
Expand All @@ -27,26 +36,26 @@ def __init__(self, effort_threshold: float, effort_factor: float, scaling: float
self.effort_factor = effort_factor

@staticmethod
def suffix(variable_type: VariableType) -> tuple:
def suffix(variable_type: VariableType) -> StrTuple:
if variable_type == VariableType.STATES:
return ("mf",)
else:
return ("",)

@staticmethod
def color() -> tuple:
def color() -> StrTuple:
return ("tab:brown",)

def default_state_only(self) -> bool:
def default_state_only(self) -> Bool:
return True

def default_initial_guess(self) -> tuple:
def default_initial_guess(self) -> IntTuple:
return (0,)

def default_bounds(self, variable_type: VariableType) -> tuple:
def default_bounds(self, variable_type: VariableType) -> AnyTuple:
return (0,), (1,)

def apply_dynamics(self, target_load, *states):
def apply_dynamics(self, target_load: CX, *states) -> CX:
effort = states[0]

effort_perception_dot = (
Expand All @@ -61,11 +70,11 @@ def apply_dynamics(self, target_load, *states):
return effort_perception_dot

@staticmethod
def dynamics_suffix() -> str:
def dynamics_suffix() -> Str:
return ""

@staticmethod
def fatigue_suffix() -> str:
def fatigue_suffix() -> Str:
return "mf"


Expand All @@ -89,13 +98,13 @@ def __init__(self, minus: EffortPerception, plus: EffortPerception, **kwargs):
)

@staticmethod
def default_state_only():
def default_state_only() -> Bool:
return True

@staticmethod
def dynamics_suffix() -> str:
def dynamics_suffix() -> Str:
return "effort"

@staticmethod
def fatigue_suffix() -> str:
def fatigue_suffix() -> Str:
return "fatigue"
Loading
Loading