Hello,
I'm currently working with the OpenSens interface to run simulations in OpenSim driven by IMU data. I try to change the settings of the visualiser from the 'GroundAndSky' setting to the 'SolodColor' because it always starts with this nasty setup but somehow I miss the point. I have no idea how i can change the settings from python. Anyone out there having an idea?
Best regards,
Markus
Simbody Visualizer and OpenSim in Python
- Markus Peters
- Posts: 2
- Joined: Tue May 15, 2018 11:29 pm
- Ayman Habib
- Posts: 2244
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Simbody Visualizer and OpenSim in Python
Hi Markus,
Looking at the code, it appears you can indeed change the visualizer background to solid color using the call to. Can you clarify how you're calling it and what are you passing as input, and whether you're getting an error message back?
Best regards,
-Ayman
Looking at the code, it appears you can indeed change the visualizer background to solid color using the call to
Code: Select all
setBackgroundType()
Best regards,
-Ayman
- Markus Peters
- Posts: 2
- Joined: Tue May 15, 2018 11:29 pm
Re: Simbody Visualizer and OpenSim in Python
Thanks Ayman for your reply,
Yes indeed I found that argument as well in the "simbody.py" file. The problem is that I don't know what I should put into the function. In the simbody.py file it is wirtten:
The error I get, when I try to change the background with:
is: TypeError: setBackgroundType() missing 1 required positional argument: 'background'
When I add another argument e.g. "background" the error is:
TypeError: in method 'SimTKVisualizer_setBackgroundType', argument 1 of type 'SimTK::Visualizer *'
Basically, I do not understand the term background: SimTK::Visualizer::BackgroundType
Best regards
Markus
Yes indeed I found that argument as well in the "simbody.py" file. The problem is that I don't know what I should put into the function. In the simbody.py file it is wirtten:
Code: Select all
setBackgroundType(self, background: "SimTK::Visualizer::BackgroundType") -> "SimTK::Visualizer &":
Code: Select all
SolidColor = osim._simbody.SimTKVisualizer_SolidColor
osim.SimTKVisualizer.setBackgroundType(SolidColor)
When I add another argument e.g. "background" the error is:
TypeError: in method 'SimTKVisualizer_setBackgroundType', argument 1 of type 'SimTK::Visualizer *'
Basically, I do not understand the term background: SimTK::Visualizer::BackgroundType
Best regards
Markus
- Ayman Habib
- Posts: 2244
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Simbody Visualizer and OpenSim in Python
Hi Markus,
You can call instead so you don't have to define an object/instance of type Background as suggested. The tricky part is that you get access to the visualizer only after it has been created so it's not clear when the change takes effect.
If that doesn't seem to work please open an issue/bug-report and we'll see what it takes to expose/feed parameters to the visualizer creation functionality.
Best regards,
-Ayman
You can call
Code: Select all
setBackgroundTypeByInt
If that doesn't seem to work please open an issue/bug-report and we'll see what it takes to expose/feed parameters to the visualizer creation functionality.
Best regards,
-Ayman