-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Locale settings are inconsistent between TimeSeriesTable
/Storage
and applications
#3924
Comments
It turned out to be an issue with my locale settings. However, it's also a problem with OpenSim. The There should definitely be a notice about configuring locale settings before using OpenSim, or the validation process should be adjusted to handle this scenario. PS: I don't like commas for numerics either. |
Fixes issue opensim-org#3924
I think it would be beneficial to define the behavior that should be supported (or expected). I can see two cases:
Which behavior would you be expecting? |
I am expecting behavior 2. OpenSim's OpenSense IK exports the .mot files with dots no matter what locale system settings, so reading the data again should also be expected with dots. Either way, i believe noone who lives in a country which still uses commas for numerics (e.g. Germany) uses them in research. Standard are dots in my opinion. |
I agree that in research the commas are not used for numerics generally but the system locale is important for things like date and calendar display settings within the system and on the desktop. I think I've figured out where the problem could be solved and found this article and this post very helpful. Here is where the file stream is opened and on line 281 it is opened. So I believe you could do something like this to change the locale to |
Also are you able to reopen this issue? It looks like the closing of the linked PR also closed the issue inadvertently. |
I only closed the PR for the opensim-gui because I submitted two PR requests for the each linux build script (core+gui) and the current approach of fixing this issue seems to be to fix the root cause which lies in opensim-core. The PR for opensim-core is still open. Alternatively just changing LC_NUMERIC to en_us.UTF-8 might also fix the issue, though still not the root and it would probably be necessary that LC_ALL is not set. |
Okay I see, simply instering this line into
..under this part of the opensim-core/OpenSim/Common/Storage.cpp Lines 181 to 186 in c9336a8
..could be a quick fix for this problem. But before I would try that out by changing the source code, rebuilding OpenSim and seeing if it works with German locale settings, to me this issue seems to be a real root problem, so why not already imbue these settings in Any opinions on that? |
I think that is a great solution! I am still relatively new with this code base so I didn't get to that level of digging yet. Hopefully the maintainers could also chime in and I'm happy to test the change against the Finnish locale (where I'm currently located) if needed. |
/edit: Actually I will try it out in |
It looks like @adamkewley has used this solution in OpenSimCreator if you also want to check that for reference. |
This comment confuses me a bit because its the exact opposite of what i am experiencing.
|
iirc, I wrote the comment because we had a problem in prod where dutch students in TU Delft were ending up with incompatible data files when they were shared with the english speakers. I probably only tested it in a very specific situation, and it was probably borked in that specific way. It wouldn't surprise me if the same bug also happens for reading via different APIs. It stems from an inconsistent use of raw file writers vs. formatted file writers (e.g. @alexbeattie42 , I'm actually feeling quite seen ^_^ - I think you're probably one of the first people to read OSC's source 😄 |
Yeah, the problem I am experiencing is essentially the same, though the other way around. The OpenSense IK exports with dots only and the import wants it with commas. Also I noticed that the build scripts could use a rework, especially having two separate build scripts for Core and GUI would make sense, but not how it is currently implemented. The GUI build script also builds OpenSim core from source but does not have the Python tests in it. Why? The GUI gets installed properly into the /opt/ but the core does not, its just installed right at the home directory, why? Everything seems a bit unorganized. In my opinion it would be best to open a new repository under opensim called opensim-build-scripts and have a unified script where you can easily choose if you want core, gui or both installed. Either way, when I tried out the fix, I executed the OpenSim core script without checking (for some reason I was hoping that it would build my local modified source code, but it always pulls the latest main branch before building) and now I can't load models in the OpenSim GUI anymore, which is weird to me because essentially I just installed OpenSim again and nothing should've changed. Will post the exception I am getting inside the GUI when trying to import an
Either way, I will need to solve this first before I can try the fix for the current problem again. |
That problem usually pops up when building in |
I did not build in debug mode. Just used the standard execution without any parameters. |
In terms of expected behavior, I think we're all in agreement that files should be written/read in US format (with decimal point). Accordingly we should plug any loopholes/cracks that end up writing files in a different format. We never run into this locally because our machines typically have US locale. We just need to use a common solution to enforce this for consistency. |
It seems like actually fixing the issue would first involve removing usages of Once that is complete and there is only one place where the file IO happens then the stream can be imbued with the correct locale in the |
Just getting up to speed on this after being in limited capacity over the last two weeks. @alexbeattie42 that seems like a reasonable solution. I'm not sure when @aymanhab or I will get around to a fix. If you or @ksomml want to give this a shot (which might make sense since you're both outside the US) I'd be happy to review a PR. As for the build scripts, in their current form I'd say they're currently most useful as an entry point for new developers. I would recommend using them as a reference for creating your own build scripts or IDE project settings (e.g., setting CMake variables via VS Code workspace settings). But I agree we should have better options for contributors to quickly get up to speed (the discussion on #3928 is a good start). |
TimeSeriesTable
/Storage
and applications
@nickbianco @ksomml Now that I can reliably reproduce the issue I'm going to starting working on the fixes described above. |
I am on a fresh Ubuntu 22.04 install and installed the latest OpenSim (main branch build).
When trying to load this test data
test.mot
through the OpenSim GUI onto a model:.. I am receiving this error:
It seems to only accept the data if the time starts from
0
.Also this does not work for me either:
Only if the timestamps are full seconds it seems to pass.
Everything worked on my old system with OpenSim 4.5 install (code below should be identical to 4.5.1).
Not sure how I can even debug this as I get the same results using the official examples from the OpenSim Modules --> Code --> Python --> OpenSenseExample
Whats the problem here?
Regarding code:
opensim-core/OpenSim/Common/Storage.cpp
Lines 205 to 230 in c9336a8
opensim-core/OpenSim/Common/TimeSeriesTable.h
Lines 518 to 537 in cbf9c74
The text was updated successfully, but these errors were encountered: