Hi all
I want to use an objective function that minimize an error in scriptmeasure. Actually, I have defined a new variable at script controller, and I want to use the error (difference between the new variable and joint angle) in scriptmeasure. But as far as I know, I can't import a variable defined in script controller in script measure. Is this correct?
Do you have any idea to save this variable in script controller and use it in the script measure?
Best regards
How to import variable from scriptcontroller to scriptmeasure
- Samane Amini
- Posts: 101
- Joined: Sun Jan 12, 2020 3:48 am
- Thomas Geijtenbeek
- Posts: 437
- Joined: Wed Mar 12, 2014 8:08 am
Re: How to import variable from scriptcontroller to scriptmeasure
Unfortunately, you cannot access these variables, since the controller and measure run independently. The best solution would be to simply recompute the value in the ScriptMeasure.
- Samane Amini
- Posts: 101
- Joined: Sun Jan 12, 2020 3:48 am
Re: How to import variable from scriptcontroller to scriptmeasure
Thanks for your quick reply.
Actually, the variable is computed by some parameters that I want to optimize them. so if I recompute the variable in the scriptmeasure, I will have to define these parameters again and it's false. Unless I can import the optimization parameters to the scripmeasure without re-optimizing them. Is it possible?
Best
Actually, the variable is computed by some parameters that I want to optimize them. so if I recompute the variable in the scriptmeasure, I will have to define these parameters again and it's false. Unless I can import the optimization parameters to the scripmeasure without re-optimizing them. Is it possible?
Best
- Thomas Geijtenbeek
- Posts: 437
- Joined: Wed Mar 12, 2014 8:08 am
Re: How to import variable from scriptcontroller to scriptmeasure
You do actually have access to all the parameters in the ScriptMeasure. Simply use the following init function:
I realize this wasn't in the documentation, so I will update it!
Code: Select all
function init( model, par )
-- par can be used here
end