Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
-
Mohammadreza Rezaie
- Posts: 408
- Joined: Fri Nov 24, 2017 12:48 am
Post
by Mohammadreza Rezaie » Sat Mar 27, 2021 2:18 pm
Dear Experts,
I'm trying to update the "point" location of "FX", "FY", and "FZ" point actuators in rra_actuators.xml file. I did:
Code: Select all
actuators = osim.ForceSet('rra_actuators.xml')
FX = actuators.get('FX')
or
Code: Select all
n_actuators = actuators.getSize()
actuators_name = list()
for i in range(n_actuators):
actuators_name.append(actuators.get(i).getName())
FX = actuators.get(actuators_name.index('FY'))
My problem is that the FX is now an "OpenSim::Force" not an "OpenSim::PointActuator" and I can't get or update "point" location. Is there any solution instead of creating a new actuator file (e.g. createActuatorsFile.m)?
Any help is much appreciated.
Regards,
Mohammadreza
Tags:
-
Mohammadreza Rezaie
- Posts: 408
- Joined: Fri Nov 24, 2017 12:48 am
Post
by Mohammadreza Rezaie » Sun Mar 28, 2021 1:57 pm
Dear Thomas,
Thank you so much for your guidance and I appreciate it. The problem was solved.
Code: Select all
FX = osim.PointActuator().safeDownCast(actuators.get('FX'))
FY = osim.PointActuator().safeDownCast(actuators.get('FY'))
FZ = osim.PointActuator().safeDownCast(actuators.get('FZ'))
FX.set_point(pelvisMassCenter)
FY.set_point(pelvisMassCenter)
FZ.set_point(pelvisMassCenter)
actuators.printToXML('f_new.xml')
Regards,
Mohammadreza