Page 1 of 1

About ScriptController parameter model

Posted: Thu Mar 19, 2020 12:53 am
by bruce_wangwei
Hi,

We revised 0914 model with an ideal ankle actuator called <CoordinateActuator name="Ankle_Exoskeleton_r">.

Then we want to use it in the ScriptController by command :
target_actuator = model:find_actuator("Ankle_Exoskeleton_r")

but an error shows that "Could not find 'Ankle_Exoskeleton_r'".

How can i solve this problem?

Thanks!

Re: About ScriptController parameter model

Posted: Thu Mar 19, 2020 4:35 am
by nathant
If I am correct you can find the actuator just by using the actuated dof's name, thus:

target_actuator = model:find_actuator("ankle_r")

Another way to check which actuators are present, you can loop over the actuators in a lua script and display the names

Code: Select all

	scone.debug("\nActuators:")
	for i = 1, model:actuator_count(), 1 do
		scone.debug(model:actuator(i):name())
	end
which could be in a ScriptController file for instance:

Code: Select all


function init(model, par)

	scone.debug("\nActuators:")
	for i = 1, model:actuator_count(), 1 do
		scone.debug(model:actuator(i):name())
	end
	
end

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



The output with the names will show up in the console of SCONE

Re: About ScriptController parameter model

Posted: Thu Mar 19, 2020 4:53 am
by bruce_wangwei
You are correct! It's ok now.

Thank you very much for the answer and suggestion!