Hi, I was able to run IMU placer with script in GUI and added an IMU on the calibrated model. I was able to access the IMU component via name (e.g. "hand_l_imu"), yet I was not able to convert the Component type to IMU type, as I get the error "1st arg can't be coerced to org.opensim.modeling.IMU".
Could you please help?
How to convert Component to IMU?
- Junwei Sun
- Posts: 12
- Joined: Mon Mar 14, 2022 11:05 am
Re: How to convert Component to IMU?
I found this post https://github.com/opensim-org/opensim-core/pull/3002
But I don't understand how to convert the component into IMU type so I can run functions in IMU class
But I don't understand how to convert the component into IMU type so I can run functions in IMU class
- Carmichael Ong
- Posts: 401
- Joined: Fri Feb 24, 2012 11:50 am
Re: How to convert Component to IMU?
Conversion to a more specific type can be done using `safeDownCast()`. This is a method in MATLAB/Python to help scripting users change the type.
See the Common Scripting Commands page, and then there's an example under the "Exploring and Editing Models and Model Components" section.
See the Common Scripting Commands page, and then there's an example under the "Exploring and Editing Models and Model Components" section.
- Junwei Sun
- Posts: 12
- Joined: Mon Mar 14, 2022 11:05 am
Re: How to convert Component to IMU?
Many thanks!
ongcf wrote: ↑Thu Jun 16, 2022 2:36 pmConversion to a more specific type can be done using `safeDownCast()`. This is a method in MATLAB/Python to help scripting users change the type.
See the Common Scripting Commands page, and then there's an example under the "Exploring and Editing Models and Model Components" section.