Skip to content

Conversation

josefariasfuentes
Copy link
Contributor

No description provided.

…no option in get_params functions defined in whipple_bicycle, to update the inertial properties of the bicycle if it is wanted to consider the rider inertial properties fixed with respect the rear frame of the bike. Whit this new option, it can be define in the definition of the bicycle object, the possibility to integrate the inertial properties of the rider as mention before. For that call

bicycle_def = symbrim.WhippleBicycle("bike")
...
bicycle_def.rear_frame.combineRiderInertia = True/False
...
bike_params = bicycleparameters.Bicycle(bike_name, pathToData=data_dir)
bike_params.add_rider(rider_name, reCalc=True, draw=False)
constants_def = bicycle_def.get_param_values(bike_params)
...
print(constants_def)
@tjstienstra tjstienstra changed the title Correction in crank kinematics and inclusion of optative variable for fixed the inertial properties of human on the rear frame of the bike BREAKING: Correct crank angle and make inclusion of rider inertia in rear frame optional Mar 13, 2025
@tjstienstra tjstienstra changed the title BREAKING: Correct crank angle and make inclusion of rider inertia in rear frame optional Correct crank angle and make inclusion of rider inertia in rear frame optional Mar 13, 2025
@tjstienstra tjstienstra added the bug Something isn't working label Mar 13, 2025
@tjstienstra
Copy link
Collaborator

tjstienstra commented Mar 13, 2025

The mistake in the crank angle is a good catch.

It would indeed be nice to make it easier for a user to choose whether the inertial properties of the human should be include in the rear frame. However, I would prefer a slightly different implementation.

Two immediate solutions for this feature sprang to mind:

  • Making it possible to pass a keyword argument to get_param_values. This will require one to call the rear frame separately to overwrite the obtained values, e.g. bicycle_rider.get_param_values(bicycle_params) | bicycle_rider.bicycle.rear_frame.get_param_values(bicycle_params, include_rider_inertia=False). The advantage of this method is that it keeps things strongly tied to the get_param_values method and it doesn't clutter the attribute interface.
  • Making an attribute include_rider_intertia, which is set to a default value in __init__. There are two changes w.r.t. your current implementation. Namely, the usage of an attribute instead of a class variable combined with a property.

As for the possible values of include_rider_inertia:

  • True: Include the rider inertia in the rear frame inertia. These will be the benchmark parameters if no rider is specified. However, if a rider is specified then a different computation should be used. If the bicycle_parameters package does not offer an easy option for this, then we should raise a NotImplemntedError.
  • False: Exclude the rider inertia in the rear frame inertia. This can be done by recomputing the benchmark parameters from the bicycle as is currently also done when the bicycle parameters have a rider.
  • None: Choose True if the bicycle parameters don't specify a human else choose False. The advantage of this option would be that we can maintain backward compatibility.

Reflecting on these options, @josefariasfuentes which solution would have your preference? Mine would probably be the first.

@tjstienstra tjstienstra added the enhancement New feature or request label Mar 13, 2025
@josefariasfuentes
Copy link
Contributor Author

josefariasfuentes commented Mar 14, 2025 via email

…ixed to the rear frame according to the option of link this feature to the get_params function
@josefariasfuentes
Copy link
Contributor Author

Hi Timo, I think to include the first option that we talk last month here. Please let me know if this solution was what you think. It would be nice to have this feature merged with the main branche since I want to run some simulations in other pcs importing symbrim with conda - forge and then run the codes without modifying the src code. Thanks in advance

Copy link
Collaborator

@tjstienstra tjstienstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, saw that I had started a review, but didn't finish it. Here is at leat some initial feedback.
Two points that I should still note are:

  • None and False always give the same result, currently. If we do support None, then it should also be the default and in that case the easiest option is probably to start the function with an is None check and converting it to a boolean based on a condition.
  • You will probably also be required to add a simple unittest.


def get_param_values(self, bicycle_parameters: Bicycle, include_rider_inertia=False) -> dict[Symbol, float]:
"""Get the parameter values of the rear frame.
include_rider_inertia option means include the rider inertia parameters fixed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you reformat this docstring according to the numpy docstring format. Doing so you will be adding a parameters section, where you can put a simple explanation on what include_rider_inertia does, refer to symbrim/bicycle/grounds.py for two examples.

"""Get the parameter values of the rear frame."""


def get_param_values(self, bicycle_parameters: Bicycle, include_rider_inertia=False) -> dict[Symbol, float]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    def get_param_values(
        self,
        bicycle_parameters: Bicycle,
        include_rider_inertia: bool | None = False,
    ) -> dict[Symbol, float]:

As the online checks are also pointing out, there are some formatting issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants