-
Notifications
You must be signed in to change notification settings - Fork 17
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
Comments
Ah, now the issue is clear to me. What is happening is that the mask is taking |
Thanks, that is interesting. Indeed, if I recall correctly we saw this with someone at somepoint, but I forgot about this. |
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:
|
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 At this point, the next step is to reproduce the problem in a less complex case, to debug more easily. |
Hi, When I try to simulate the system I get the following error:
The system configuration on which I am working is the same reported by @LoreMoretti in this issue. |
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 ofWorkspace
, and then fill in all the edit boxes of theData
tab.For example, let's assume that your object
WBToolbox.Configuration
is contained in the field of a structure likeconfigSimulation.WBTConfigRobotSim
, you will then have to fill theData
tab as followsIf 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 exampleconfigSimulation.WBTConfigRobotSim
(which stores theWBToolbox.Configuration
object), the simulation runs just fine.Screenshots
Additional information
2022b
]Additional context
Here the error message:
The text was updated successfully, but these errors were encountered: