SCONE crashes when using LuaDof:is_actuated()

SCONE is a software tool for predictive simulations of biomechanical movement. It uses OpenSim for modeling and simulation, and performs optimization using various control strategies, including feed-forward control, proprioceptic feedback control, and bal
POST REPLY
User avatar
Nathan Timmers
Posts: 12
Joined: Thu Apr 04, 2019 11:10 am

SCONE crashes when using LuaDof:is_actuated()

Post by Nathan Timmers » Thu Feb 27, 2020 4:42 am

It seems that there is a bug with the is_actuated method().
SCONE crashes when trying to check if a DOF is actuated through the is_actuated() method


Scone file:

Code: Select all

          CmaOptimizer {
	  signature_prefix = DATE_TIME
	
	SimulationObjective {
		max_duration = 20
		
		# Model used in simulation
		OpenSimModel {
			model_file = data/human_models/Human0914.osim
			enable_external_forces = 1 # Required when applying external forces
			
			# Optimize initial state parameters
			state_init_file = data/state_init_files/InitStateGait10.sto
			initial_state_offset =	0~0.01<-0.5,0.5>
			initial_state_offset_exclude = "*_tx;*_ty;*_u"
		}
		
		
		CompositeController {
			# Controller for gait, based on [Geyer & Herr 2010]
			<< data/controller_files/ControllerGH2010.scone >>
			
			ScriptController {
				name = PerturbationDevice
				script_file = "data/lua_files/Test.lua"
			}
			
		}
		
		# Measure for gait
		<< data/measure_files/MeasureGait.scone >>
		
	}
}
Test.lua file:

Code: Select all

function init(model, par)
	scone.debug("\nDOFs:")
	for i = 1, model:dof_count(), 1 do
		scone.debug(model:dof(i):name())
		scone.debug(model:dof(i):is_actuated())
	end

	
end

function update(model)
	local t = tonumber(model:time())
	return false
end


function store_data(frame)
end
I have opened an issue on github for this

User avatar
Thomas Geijtenbeek
Posts: 451
Joined: Wed Mar 12, 2014 8:08 am

Re: SCONE crashes when using LuaDof:is_actuated()

Post by Thomas Geijtenbeek » Thu Feb 27, 2020 5:06 am

Thanks for reporting this! Let's continue the discussion on github: https://github.com/opensim-org/SCONE/issues/184.

User avatar
Thomas Geijtenbeek
Posts: 451
Joined: Wed Mar 12, 2014 8:08 am

Re: SCONE crashes when using LuaDof:is_actuated()

Post by Thomas Geijtenbeek » Thu Feb 27, 2020 8:46 am

The crash is caused by the fact that in Lua, booleans aren't automatically converted to strings. Changing the code to:

Code: Select all

scone.debug( tostring( model:dof(i):is_actuated() ) )
fixes the crash. However, it should of course show you an error message instead of crashing. I will look further into that!

POST REPLY