Comments (2)
I'm quite leaning towards creating a separate object as, that would allow a better future proof solution. This object will have the following requirements:
- It must be iterable (M)
- A user must be able to easily retrieve a symbol by name (M)
- Option would be to either automatically set them as attributes, would be dynamic though.
- Use
__getitem__
to have dictionary like behaviour
- Have a
get_description
method, which can either take a symbol or a string.
I'm actually shooting this idea, as one can replace the symbols of a body easily. Making a connection between this class and that happening, would make it a SymbolTracker
, which seems over complicated.
Maybe I'm actually going for a SymbolCatalog
which has a compositional relation towards ModelBase
. The SymbolCatalog
itself composes of SymbolDescriptor
objects, which have a name
, full_name
, symbol
, description
and used
attributes. It also has a method change_symbol
, which is only allowed if the symbol has not been used yet. Here are some quick user stories:
symbols = SymbolCatalog(model_name)
symbols.add_symbol(name, description) # -> None
symbols.get_symbol_descriptor(name).used # -> False
symbols.change_symbol(name, new_symbol)
symbols[name] # -> Symbol(f'{model_name}_{name}')
symbols.get_symbol_descriptor(name).used # -> True
symbols.change_symbol(name, new_symbol) # -> raise ValueError("Symbol ... has already been used")
symbols.get_description(name) # -> description
symbols.get_description(symbol) # -> description
symbols.get_description(unknown) # -> None
# How should one add functions and coordinates and speeds
Oh wait, Descriptor
would actually be rather confusing.
from brim.
While nice catalog handling would be nice, there are just too many complication due to trees and inheritance. Therefore, the approach is to go minimal and flexible. This means using normal objects like dictionaries. Classes are a bit free in what they like to use. The main approach will be to keep the hard code descriptions
property which retrieves symbols and add the descriptions (strings) as values. Other then that it is recommended to use easily accessible stuff like dictionaries: q
, u
, symbols
. Though one is free to also use a matrix or list. For q
and u
it is sensible to just use matrix, assuming one just uses numbering.
from brim.
Related Issues (20)
- Redundant _parent attribute in ConnectionBase
- Change frozenset usage to frozen dictionaries? HOT 2
- BicycleParameters adjusts the rear frame CoM based on the rider
- Simplify contact point computation
- Redesign plotting structure
- Refactor test suite
- Make q, u default Matrix properties
- Improve module names
- RiderLean model
- Change base orientation of frames in the rider HOT 2
- Use benchmark results
- Fix broken links
- Rear and Front frame should not use NewtonianBodyMixin HOT 1
- Regression of the number of operations in the EOMs after CSE HOT 2
- Get all symbols HOT 4
- Add tutorials HOT 1
- Diagrams can't be read in dark mode HOT 1
- Feedback BRiM tutorials session
- Feature request: get unspecified components
- Holonomic constraints in HolonomicHandGrips and HolonomicPedals are incompatible with noncontributing forces
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brim.