Skip to content

Commit

Permalink
Adjust code to new BRiM and SymPy version
Browse files Browse the repository at this point in the history
  • Loading branch information
tjstienstra committed Dec 1, 2023
1 parent 34dc66c commit 37d746c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/rolling_disc_optimization/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

system = disc.to_system()
normal = disc.ground.get_normal(disc.ground.origin)
system.apply_gravity(-g * normal)
system.apply_uniform_gravity(-g * normal)
r_long = me.cross(normal, disc.disc.rotation_axis).normalize()
system.add_loads(
me.Torque(
Expand Down
2 changes: 1 addition & 1 deletion examples/whipple_bicycle_simulation/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

# Apply additional forces and torques to the system
g = symbols("g")
system.apply_gravity(-g * bicycle.ground.get_normal(bicycle.ground.origin))
system.apply_uniform_gravity(-g * bicycle.ground.get_normal(bicycle.ground.origin))
steer_torque = dynamicsymbols("steer_torque")
system.add_actuators(TorqueActuator(
steer_torque, bicycle.rear_frame.steer_hub.axis,
Expand Down
2 changes: 1 addition & 1 deletion examples/whipple_upper_rider_simulation/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
system = br.to_system()

g = symbols("g")
system.apply_gravity(-g * bicycle.ground.get_normal(bicycle.ground.origin))
system.apply_uniform_gravity(-g * bicycle.ground.get_normal(bicycle.ground.origin))
disturbance = dynamicsymbols("disturbance")
system.add_loads(Force(
bicycle.rear_frame.saddle.point, disturbance * bicycle.rear_frame.wheel_hub.axis))
Expand Down
5 changes: 3 additions & 2 deletions tests/test_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ def create_rolling_disc(self) -> None:
self.rolling_disc.define_loads()
self.rolling_disc.define_constraints()
self.system = self.rolling_disc.to_system()
self.system.apply_gravity(-symbols("g") * self.rolling_disc.ground.get_normal(
self.rolling_disc.ground.origin))
self.system.apply_uniform_gravity(
-symbols("g") * self.rolling_disc.ground.get_normal(
self.rolling_disc.ground.origin))
self.system.add_loads(
Torque(self.rolling_disc.disc.frame,
dynamicsymbols("T") * self.rolling_disc.disc.rotation_axis))
Expand Down
6 changes: 3 additions & 3 deletions utilities/simulator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Module for simulating sympy.physics.mechanics._system.System objects."""
"""Module for simulating sympy.physics.mechanics.system.System objects."""
from __future__ import annotations

from typing import Callable
Expand All @@ -11,17 +11,17 @@
from sympy import Basic, Function, lambdify
from sympy.physics.mechanics import (
KanesMethod,
System,
dynamicsymbols,
find_dynamicsymbols,
msubs,
)
from sympy.physics.mechanics._system import System

__all__ = ["Simulator"]


class Simulator:
"""Simulator for sympy.physics.mechanics._system.System object."""
"""Simulator for sympy.physics.mechanics.system.System object."""

def __init__(self, system: System) -> None:
if not isinstance(system, System):
Expand Down

0 comments on commit 37d746c

Please sign in to comment.