Skip to content

Commit

Permalink
Merge pull request #101 from TJStienstra/rename
Browse files Browse the repository at this point in the history
Rename
  • Loading branch information
tjstienstra authored Sep 4, 2023
2 parents 8f7a84f + d30f858 commit 397fe44
Show file tree
Hide file tree
Showing 34 changed files with 341 additions and 338 deletions.
16 changes: 8 additions & 8 deletions src/brim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

"NonHolonomicTyre",

"SimplePedals",
"MasslessCranks",

"Rider",

Expand All @@ -31,36 +31,36 @@

"SphericalLeftShoulder", "SphericalRightShoulder",

"FixedPelvisToTorso",
"FixedSacrum",

"BicycleRider",

"SideLeanSeat",

"HolonomicHandGrip",
"HolonomicHandGrips",

"HolonomicPedalsToFeet",
"HolonomicPedals",
]

from brim.bicycle import (
FlatGround,
KnifeEdgeWheel,
MasslessCranks,
NonHolonomicTyre,
RigidFrontFrame,
RigidRearFrame,
SimplePedals,
StationaryBicycle,
ToroidalWheel,
WhippleBicycle,
)
from brim.brim import (
BicycleRider,
HolonomicHandGrip,
HolonomicPedalsToFeet,
HolonomicHandGrips,
HolonomicPedals,
SideLeanSeat,
)
from brim.rider import (
FixedPelvisToTorso,
FixedSacrum,
PinElbowStickLeftArm,
PinElbowStickRightArm,
PinLeftHip,
Expand Down
6 changes: 3 additions & 3 deletions src/brim/bicycle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
"FrontFrameBase", "RigidFrontFrame", "RigidFrontFrameMoore",
"WheelBase", "KnifeEdgeWheel", "ToroidalWheel",
"TyreBase", "NonHolonomicTyre",
"PedalsBase", "SimplePedals",
"CranksBase", "MasslessCranks",
]

from brim.bicycle.bicycle_base import BicycleBase
from brim.bicycle.cranks import CranksBase, MasslessCranks
from brim.bicycle.front_frames import (
FrontFrameBase,
RigidFrontFrame,
RigidFrontFrameMoore,
)
from brim.bicycle.grounds import FlatGround, GroundBase
from brim.bicycle.pedals import PedalsBase, SimplePedals
from brim.bicycle.rear_frames import RearFrameBase, RigidRearFrame, RigidRearFrameMoore
from brim.bicycle.stationary_bicycle import StationaryBicycle
from brim.bicycle.tyre_models import NonHolonomicTyre, TyreBase
from brim.bicycle.tyres import NonHolonomicTyre, TyreBase
from brim.bicycle.wheels import KnifeEdgeWheel, ToroidalWheel, WheelBase
from brim.bicycle.whipple_bicycle import WhippleBicycle, WhippleBicycleMoore
6 changes: 3 additions & 3 deletions src/brim/bicycle/bicycle_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import contextlib
from typing import TYPE_CHECKING

from brim.bicycle.cranks import CranksBase
from brim.bicycle.front_frames import FrontFrameBase
from brim.bicycle.pedals import PedalsBase
from brim.bicycle.rear_frames import RearFrameBase
from brim.bicycle.wheels import WheelBase
from brim.core import ModelBase, ModelRequirement
Expand All @@ -29,13 +29,13 @@ class BicycleBase(ModelBase):
ModelRequirement("rear_wheel", WheelBase, "Submodel of the rear wheel.", False),
ModelRequirement("front_wheel", WheelBase, "Submodel of the front wheel.",
False),
ModelRequirement("pedals", PedalsBase, "Submodel of the pedals.", False),
ModelRequirement("cranks", CranksBase, "Submodel of the cranks.", False),
)
rear_frame: RearFrameBase
front_frame: FrontFrameBase
rear_wheel: WheelBase
front_wheel: WheelBase
pedals: PedalsBase
cranks: CranksBase

def get_param_values(self, bicycle_parameters: Bicycle) -> dict[Symbol, float]:
"""Get a parameters mapping of a model based on a bicycle parameters object."""
Expand Down
24 changes: 12 additions & 12 deletions src/brim/bicycle/pedals.py → src/brim/bicycle/cranks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Module containing models of the pedals."""
"""Module containing models of the cranks."""
from __future__ import annotations

import contextlib
Expand All @@ -15,11 +15,11 @@
with contextlib.suppress(ImportError):
from brim.utilities.plotting import PlotModel

__all__ = ["PedalsBase"]
__all__ = ["CranksBase"]


class PedalsBase(ModelBase):
"""Base class for the pedals."""
class CranksBase(ModelBase):
"""Base class for the cranks."""

def _define_objects(self) -> None:
"""Define the objects."""
Expand All @@ -38,12 +38,12 @@ def _define_kinematics(self) -> None:

@property
def frame(self) -> ReferenceFrame:
"""Frame of the pedals."""
"""Frame of the cranks."""
return self._frame

@property
def center_point(self) -> Point:
"""Center point of the pedals."""
"""Center point of the cranks."""
return self._center_point

@property
Expand All @@ -59,7 +59,7 @@ def right_pedal_point(self) -> Point:
@property
@abstractmethod
def rotation_axis(self) -> Vector:
"""Rotation axis of the pedals."""
"""Rotation axis of the cranks."""

def set_plot_objects(self, plot_object: PlotModel) -> None:
"""Set the symmeplot plot objects."""
Expand All @@ -80,22 +80,22 @@ def set_plot_objects(self, plot_object: PlotModel) -> None:
], self.name)


class SimplePedals(PedalsBase):
"""Simplified pedal model."""
class MasslessCranks(CranksBase):
"""Simplified cranks model."""

@property
def descriptions(self) -> dict[Any, str]:
"""Descriptions of the objects."""
return {
**super().descriptions,
self.symbols["radius"]: "Pedal radius.",
self.symbols["radius"]: "Length of the cranks in the radial direction.",
self.symbols["offset"]: "Distance of the pedal point from the center point "
"of the pedals along the rotation axis.",
"of the cranks along the rotation axis.",
}

@property
def rotation_axis(self) -> Vector:
"""Rotation axis of the pedals."""
"""Rotation axis of the cranks."""
return self.frame.y

def _define_objects(self) -> None:
Expand Down
18 changes: 9 additions & 9 deletions src/brim/bicycle/stationary_bicycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ def descriptions(self) -> dict[Any, str]:
self.q[1]: f"Steering rotation angle of {self.name}.",
self.q[2]: f"Front wheel rotation angle of {self.name}.",
self.symbols["gear_ratio"]: "Ratio between the angle of the rear wheel and"
" the pedals.",
self.symbols["l_px"]: f"Distance between the rear wheel and the pedals "
f"along {self.rear_frame.x}.",
self.symbols["l_pz"]: f"Distance between the rear wheel and the pedals "
f"along {self.rear_frame.z}.",
" the cranks.",
self.symbols["l_px"]: f"Distance between the rear wheel and the center of "
f"the cranks along {self.rear_frame.x}.",
self.symbols["l_pz"]: f"Distance between the rear wheel and the center of "
f"the cranks along {self.rear_frame.z}.",
}
desc.update({ui: f"Generalized speed of the {desc[qi].lower()}"
for qi, ui in zip(self.q, self.u)})
Expand Down Expand Up @@ -79,14 +79,14 @@ def _define_kinematics(self) -> None:
self.front_frame.wheel_attachment, self.front_wheel.center,
self.front_frame.wheel_axis, self.front_wheel.rotation_axis),
)
if self.pedals:
self.pedals.center_point.set_pos(self.rear_frame.wheel_attachment,
if self.cranks:
self.cranks.center_point.set_pos(self.rear_frame.wheel_attachment,
self.symbols["l_px"] * self.rear_frame.x +
self.symbols["l_pz"] * self.rear_frame.z)
self.pedals.frame.orient_axis(
self.cranks.frame.orient_axis(
self.rear_frame.frame, self.rear_frame.wheel_axis,
self.q[0] / self.symbols["gear_ratio"])
self.pedals.frame.set_ang_vel(
self.cranks.frame.set_ang_vel(
self.rear_frame.frame,
self.u[0] / self.symbols["gear_ratio"] * self.rear_frame.wheel_axis)
if self.q[0] not in self.system.q:
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions src/brim/bicycle/whipple_bicycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from brim.bicycle.front_frames import FrontFrameBase
from brim.bicycle.grounds import GroundBase
from brim.bicycle.rear_frames import RearFrameBase
from brim.bicycle.tyre_models import TyreBase
from brim.bicycle.tyres import TyreBase
from brim.bicycle.wheels import WheelBase
from brim.core import ConnectionRequirement, ModelRequirement, set_default_convention

Expand Down Expand Up @@ -74,7 +74,7 @@ def descriptions(self) -> dict[Any, str]:
self.q[6]: f"Steering rotation angle of {self.name}.",
self.q[7]: f"Rear wheel rotation angle of {self.name}.",
self.symbols["gear_ratio"]: "Ratio between the angle of the rear wheel and"
" the pedals.",
" the cranks.",
}
desc.update({ui: f"Generalized speed of the {desc[qi].lower()}"
for qi, ui in zip(self.q, self.u)})
Expand Down Expand Up @@ -135,12 +135,12 @@ def _define_kinematics(self) -> None:
self.system.add_speeds(*self.u[:5])
self.system.add_kdes(*(
ui - qi.diff(dynamicsymbols._t) for qi, ui in zip(self.q[:5], self.u[:5])))
if self.pedals:
self.pedals.center_point.set_pos(self.rear_frame.bottom_bracket, 0)
self.pedals.frame.orient_axis(
if self.cranks:
self.cranks.center_point.set_pos(self.rear_frame.bottom_bracket, 0)
self.cranks.frame.orient_axis(
self.rear_frame.frame, self.rear_frame.wheel_axis,
self.q[7] / self.symbols["gear_ratio"])
self.pedals.frame.set_ang_vel(
self.cranks.frame.set_ang_vel(
self.rear_frame.frame,
self.u[7] / self.symbols["gear_ratio"] * self.rear_frame.wheel_axis)

Expand Down
16 changes: 8 additions & 8 deletions src/brim/brim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
"""Module containing the bicycle rider model."""

__all__ = [
"PedalsToFeetBase", "SeatBase", "HandGripBase",
"PedalsBase", "SeatBase", "HandGripsBase",

"BicycleRider",

"HolonomicPedalsToFeet", "SpringDamperPedalsToFeet",
"HolonomicPedals", "SpringDamperPedals",

"PelvisInterPointMixin",
"FixedSeat", "SideLeanSeat", "SideLeanSeatTorque", "SideLeanSeatSpringDamper",

"HolonomicHandGrip", "SpringDamperHandGrip",
"HolonomicHandGrips", "SpringDamperHandGrips",
]

from brim.brim.base_connections import (
HandGripBase,
PedalsToFeetBase,
HandGripsBase,
PedalsBase,
SeatBase,
)
from brim.brim.bicycle_rider import BicycleRider
from brim.brim.pedal_connections import HolonomicPedalsToFeet, SpringDamperPedalsToFeet
from brim.brim.seat_connections import (
from brim.brim.hand_grips import HolonomicHandGrips, SpringDamperHandGrips
from brim.brim.pedals import HolonomicPedals, SpringDamperPedals
from brim.brim.seats import (
FixedSeat,
PelvisInterPointMixin,
SideLeanSeat,
SideLeanSeatSpringDamper,
SideLeanSeatTorque,
)
from brim.brim.steer_connections import HolonomicHandGrip, SpringDamperHandGrip
18 changes: 9 additions & 9 deletions src/brim/brim/base_connections.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""Module containing the base connection classes between the rider and bicycle."""
from __future__ import annotations

from brim.bicycle.cranks import CranksBase
from brim.bicycle.front_frames import FrontFrameBase
from brim.bicycle.pedals import PedalsBase
from brim.bicycle.rear_frames import RearFrameBase
from brim.core import ConnectionBase, ModelRequirement
from brim.rider.arms import LeftArmBase, RightArmBase
from brim.rider.legs import LeftLegBase, RightLegBase
from brim.rider.pelvis import PelvisBase

__all__ = ["HandGripBase", "PedalsToFeetBase", "SeatBase"]
__all__ = ["HandGripsBase", "PedalsBase", "SeatBase"]


class SeatBase(ConnectionBase):
Expand All @@ -23,29 +23,29 @@ class SeatBase(ConnectionBase):
pelvis: PelvisBase


class HandGripBase(ConnectionBase):
class HandGripsBase(ConnectionBase):
"""Base class for the connection between the handlebar and the arms."""

required_models: tuple[ModelRequirement, ...] = (
ModelRequirement("steer", FrontFrameBase, "Front frame of the bicycle."),
ModelRequirement("front_frame", FrontFrameBase, "Front frame of the bicycle."),
ModelRequirement("left_arm", LeftArmBase, "Left arm of the rider.", hard=False),
ModelRequirement("right_arm", RightArmBase, "Right arm of the rider.",
hard=False),
)
steer: FrontFrameBase
front_frame: FrontFrameBase
left_arm: LeftArmBase
right_arm: RightArmBase


class PedalsToFeetBase(ConnectionBase):
"""Base class for the connection between the pedals and the legs."""
class PedalsBase(ConnectionBase):
"""Base class for the connection between the cranks and the legs."""

required_models: tuple[ModelRequirement, ...] = (
ModelRequirement("left_leg", LeftLegBase, "Left leg of the rider.", hard=False),
ModelRequirement("right_leg", RightLegBase, "Right leg of the rider.",
hard=False),
ModelRequirement("pedals", PedalsBase, "Pedals of the bicycle."),
ModelRequirement("cranks", CranksBase, "Cranks of the bicycle."),
)
left_leg: LeftLegBase
right_leg: RightLegBase
pedals: PedalsBase
cranks: CranksBase
Loading

0 comments on commit 397fe44

Please sign in to comment.