Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug when parsing the mask of WBT Configuration block #237

Open
3 of 5 tasks
LoreMoretti opened this issue May 23, 2023 · 7 comments
Open
3 of 5 tasks

bug when parsing the mask of WBT Configuration block #237

LoreMoretti opened this issue May 23, 2023 · 7 comments

Comments

@LoreMoretti
Copy link
Contributor

LoreMoretti commented May 23, 2023

  • I already updated to the latest version I can use
  • I already checked similar issues using the search box
  • I already checked the website for known troubleshooting
  • I already cleaned my environment (by removing the wb-toolbox install folder and installing it again)
  • I am sure the environment variables are correct

Description

It seems it is not possible to define the block parameters through the option Configuration from: Mask.

Platform

Simulation with Matlab/Simulink 2022b on Linux 22.04

Reproducibility

Just use any model which contains the WBT Configuration block, and in the block mask from the drop-down menu choose Mask instead of Workspace, and then fill in all the edit boxes of the Data tab.

For example, let's assume that your object WBToolbox.Configuration is contained in the field of a structure like configSimulation.WBTConfigRobotSim, you will then have to fill the Data tab as follows

edit box value
Robot Name configSimulation.WBTConfigRobotSim.RobotName
Urdf File configSimulation.WBTConfigRobotSim.UrdfFile
Controlled Joints configSimulation.WBTConfigRobotSim.ControlledJoints
Control Boards Names configSimulation.WBTConfigRobotSim.ControlBoardsNames
Local Name configSimulation.WBTConfigRobotSim.LocalName
Gravity Vector configSimulation.WBTConfigRobotSim.GravityVector

If you then run the Simulink model you should see an error ( as the one reported in Additional context).

If instead, the option from Workspace, passing for example configSimulation.WBTConfigRobotSim (which stores the WBToolbox.Configuration object), the simulation runs just fine.

Screenshots

image

image

Additional information

  • OS: [e.g. Ubuntu 22.04]
  • Matlab Version: [e.g. 2022b]

Additional context

Here the error message:

Error reported by S-function 'BlockFactory' in '[simulation_with_PID_control/Simulator/EstimateContactForcesKynematicsForwardDynamics/RobotDynWithContacts_ClosedChain/simulinkFunction_dyn_worldTransform_inContactFrames/First ForwardKinematics/S-Function](matlab:open_and_hilite_hyperlink ('simulation_with_PID_control/Simulator/EstimateContactForcesKynematicsForwardDynamics/RobotDynWithContacts_ClosedChain/simulinkFunction_dyn_worldTransform_inContactFrames/First ForwardKinematics/S-Function','error'))':
ResourceFinder couldn't find urdf file configSimulation.WBTConfigRobotSim.UrdfFile.
Failed to initialize the KinDynComputations object.
Cannot retrieve handle to KinDynComputations.
@LoreMoretti
Copy link
Contributor Author

cc @traversaro @fabiodinatale

@traversaro
Copy link
Member

Ah, now the issue is clear to me. What is happening is that the mask is taking configSimulation.WBTConfigRobotSim.UrdfFile as a string, instead of evaluating its value.

@fabiodinatale
Copy link

fabiodinatale commented May 23, 2023

What is happening is that the mask is taking configSimulation.WBTConfigRobotSim.UrdfFile as a string, instead of evaluating its value.

Yes, exactly, and by testing one by one, this is the only parameter affected by this behavior.

Even if when looking at the mask, the value seems to be correctly evaluated:
image

@traversaro
Copy link
Member

Thanks, that is interesting. Indeed, if I recall correctly we saw this with someone at somepoint, but I forgot about this.

@traversaro
Copy link
Member

traversaro commented May 23, 2023

I added a few debug prints:

diff --git a/sources/Simulink/src/SimulinkBlockInformationImpl.cpp b/sources/Simulink/src/SimulinkBlockInformationImpl.cpp
index 67df010..eae440c 100644
--- a/sources/Simulink/src/SimulinkBlockInformationImpl.cpp
+++ b/sources/Simulink/src/SimulinkBlockInformationImpl.cpp
@@ -14,6 +14,8 @@
 #include <cassert>
 #include <simstruc.h>
 
+#include <iostream>
+
 using namespace blockfactory;
 using namespace blockfactory::mex::impl;
 
@@ -410,7 +412,9 @@ bool SimulinkBlockInformationImpl::getStringParameterAtIndex(const ParameterInde
                                                              std::string& value) const
 {
     const mxArray* blockParam = ssGetSFcnParam(simstruct, idx);
-    return mxpp::MxArray(blockParam).asString(value);
+    bool ok = mxpp::MxArray(blockParam).asString(value);
+    std::cerr << "SimulinkBlockInformationImpl::getStringParameterAtIndex" << idx << "," << value << std::endl;
+    return ok;
 }
 
 // =================================
@@ -435,6 +439,7 @@ bool SimulinkBlockInformationImpl::getVectorAtIndex(const ParameterIndex idx,
                                                     std::vector<double>& value) const
 {
     const mxArray* blockParam = ssGetSFcnParam(simstruct, idx);
+    std::cerr << "SimulinkBlockInformationImpl::getVectorAtIndex" << idx << "," << value[0] << std::endl;
     return mxpp::MxArray(blockParam).asVectorDouble(value);
 }
diff --git a/toolbox/base/src/WholeBodySingleton.cpp b/toolbox/base/src/WholeBodySingleton.cpp
index c59a71ac..55746afb 100644
--- a/toolbox/base/src/WholeBodySingleton.cpp
+++ b/toolbox/base/src/WholeBodySingleton.cpp
@@ -18,6 +18,7 @@
 #include <stddef.h>
 #include <string>
 #include <vector>
+#include <iostream>

 using namespace wbt::base;
 using namespace blockfactory::core;
@@ -158,6 +159,13 @@ bool fillConfiguration(std::shared_ptr<Configuration>& configurationPtr,
     ok = ok && parameters.getParameter("ControlBoardsNames", controlBoardsNames);
     ok = ok && parameters.getParameter("GravityVector", gravityVector);
     ok = ok && parameters.getParameter("ConfBlockName", confBlockName);
+    std::cerr << "==================> ConfBlockName: " << confBlockName << std::endl;
+    std::cerr << "==================> RobotName: " << robotName << std::endl;
+    std::cerr << "==================> UrdfFile: " << urdfFile << std::endl;
+    std::cerr << "==================> LocalName: " << localName << std::endl;
+    std::cerr << "==================> gravityVector[2] " << gravityVector[2] << std::endl;
+
+

     if (!ok) {
         bfError << "The parameters passed do not contain all the required information to create a "
(

With this, I get this output:

>> 
SimulinkBlockInformationImpl::getStringParameterAtIndex0,Jacobian
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/External_Wrench/Configuration
==================> ConfBlockName: simulation_with_PID_control/External_Wrench/Configuration
==================> RobotName: Chelsea
==================> UrdfFile: ISC5RU_Chelsea.urdf
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,DotJNu
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,DotJNu
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,DotJNu
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,DotJNu
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,DotJNu
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,DotJNu
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,DotJNu
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,DotJNu
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,DotJNu
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,DotJNu
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,DotJNu
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,InverseDynamics
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,Jacobian
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,Jacobian
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,Jacobian
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,Jacobian
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,Jacobian
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,Jacobian
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,Jacobian
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,Jacobian
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,Jacobian
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,Jacobian
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,Jacobian
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,MassMatrix
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,ForwardKinematics
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,ForwardKinematics
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,ForwardKinematics
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,ForwardKinematics
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,ForwardKinematics
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,ForwardKinematics
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,ForwardKinematics
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,ForwardKinematics
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex0,ForwardKinematics
SimulinkBlockInformationImpl::getStringParameterAtIndex1,WBToolbox
SimulinkBlockInformationImpl::getStringParameterAtIndex3,simulation_with_PID_control/Simulator/Configuration
==================> ConfBlockName: simulation_with_PID_control/Simulator/Configuration
==================> RobotName: configSimulation.WBTConfigRobotSim.RobotName
==================> UrdfFile: configSimulation.WBTConfigRobotSim.UrdfFile
==================> LocalName: WBT
==================> gravityVector[2] -9.81
SimulinkBlockInformationImpl::getStringParameterAtIndex4,contact_left_heel_inner

@traversaro
Copy link
Member

Today I did more debugging on the original model in which @lrapetti had the problem, and I could not find the root of the problem. It seems however that the value was returned not evaluated directly by MATLAB, as I was debugging directly the value returned by ssGetSFcnParam at https://github.com/robotology/blockfactory/blob/v0.8.3/sources/Simulink/src/SimulinkBlockInformationImpl.cpp#L430, and already there the values were not evaluated. The strange thing is that if I set a name of the variable that does not exists there, I get an error due to the fact that the variable does not exists!

At this point, the next step is to reproduce the problem in a less complex case, to debug more easily.

@xela-95
Copy link
Member

xela-95 commented Jul 10, 2023

Hi,
I was building a library block exploiting some of the wb-toolbox blocks; I created then a top-level mask where the user could set the parameters used in my library block, among which the parameters needed by the "config" of wb-toolbox.
For the "config" block I choose the "from mask" option and passed the parameters defined in the top-level mask, as in the figure below.
image

When I try to simulate the system I get the following error:

Error evaluating ['InitFcn'](matlab:Simulink.internal.OpenCallbackParamsDialog(['forward_dynamics/SoftContactsSimulator/Configuration'],'InitFcn');) callback of SubSystem block (mask) '[forward_dynamics/SoftContactsSimulator/Configuration](matlab:open_and_hilite_hyperlink ('forward_dynamics/SoftContactsSimulator/Configuration','error'))'. 
Callback string is 'source = get_param(gcb,'ConfigSource');

if strcmp(source, 'Workspace')
    object = get_param(gcb,'ConfigObject');
    WBToolbox.ConfigurationToMask(gcb, object);
end

WBToolbox.MaskToConfiguration(gcb);

clear object source'
Caused by:
Unrecognized function or variable 'wbt_controlled_joints'. 
Variable 'wbt_controlled_joints' does not exist. 
Suggested Actions
Load a file into base workspace.
Fix
Create a new variable.

The system configuration on which I am working is the same reported by @LoreMoretti in this issue.

CC @traversaro @LoreMoretti

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants