Comments (3)
@juan-g-bonilla , I just pushed my setter/getter branch to feature/bsk_715_setterGetter
. I'm able to log the private variables now with the get method. However, I wonder if we should make a new utility function in sys_model.i
called loggerGet()
that logs specifically a variable foo
with the method getFoo()
? If setters and getters are becoming the norm, then I feel we should make this logging process easier.
Or, can we expand the logger()
functionality to see if the variable can be accessed via mod.foo
. If not, then try using mod.getFoo()
. If that doesn't work, then throw the current error message? That way the logging interface for public variables and getter accessible private variables remains the same?
from basilisk.
bsk_715_setterGetter
I see the issue now. The thing is that because we are using raw C arrays, we need to return them from functions as pointers:
double * getFoo();
but then SWIG does not have enough information to transform that into a Python type (because it doesn't know the length of the data). There is really no way to return something like this in C++:
double[3] getFoo();
So we would need to use a more information rich type. I've added some commits with a switch to using std::array<double, 3>
and SWIG changes to support that. I've also updated .logger
with your idea about automatically finding getters, and it seems to work pretty good. As long as the documentation explains what's going on, I think it's a good change. Feel free to reset and play around with my changes.
Changing from C arrays to std::array
might require some code churn, but I think it's step in the right direction anyway. Of course C arrays will still be necessary in C messages, but intermixing C arrays and std::array
is pretty painless.
from basilisk.
Thanks for the support @juan-g-bonilla . I pulled your commits to my branch and will review and integrated. I like the new combined logger()
functionality. I think this is a clean solution for the user. I need to update documentation to reflect this, and still keep the explanation on how to do more complex logging.
from basilisk.
Related Issues (20)
- MacOS Sonoma 14.4.1 Run Failure HOT 1
- SpiceInterface::initTimeData() rounds epoch information to 0.1 second precision HOT 1
- AVS Eigen library's MRP Identity() method returns identity quaternion rotation
- [Windows Error]:'ERROR: 'settings.compiler' value not defined'! HOT 1
- problem with build Basilisk on Linux
- Unable to connect Basilisk and Vizard in the same network. HOT 1
- SPICE (NOLOADEDFILES) HOT 1
- [Windows ERROR] ImportError: DLL load failed while importing _spacecraft: The specified module could not be found!!!
- protectAllClasses does not actually prevent from setting new attributes
- Add linear and bilinear interpolation functions to the utilities folder
- Logging bug with multiple tasks in version 2.2.1
- Python 3.9 is not supported under some conditions HOT 7
- Fix errors when using numpy>=2.0.0
- Download bsp files at build time and remove from git lfs HOT 1
- "Could not find vizInterface when import attempted." Error with default settings on Linux. HOT 3
- Unify definition of astro constants HOT 1
- Hardcoded Isp in thrusterStateEffector HOT 1
- SWIG 4.2.0 causes failure in test_bskAttitudeConstrainedManeuver HOT 4
- solarArrayReference differential articulation for momentum management
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 basilisk.