Base on #4 @sxsong1207 's fork,I tried to build msf under windows with vs 2017. There are some linux code like usleep() to change, but the key problem is template mismatch under vs 2017, I found what happened but did't find the solution. Here's the problem:
Using 11 define ,under gcc it will be:
msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 0, 0>,
msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 1, 0>,
msf_core::StateVar_T<Eigen::Quaternion, 2, 0>,
msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 3, 1>,
msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 4, 1>,
msf_core::StateVar_T<Eigen::Matrix<double, 1, 1, 0, 1, 1>, 5, 2>,
msf_core::StateVar_T<Eigen::Quaternion, 6, 3>,
msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 7>,
msf_core::StateVar_T<Eigen::Quaternion, 8>,
msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 9>,
msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 10>
and turn to VS2017 it became:
msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,0,0,0>,
msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,1,0,0>,
msf_core::StateVar_T<Eigen::Quaternion<double,0>,2,0,0>,
msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,3,1,0>,
msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,4,1,0>,
msf_core::StateVar_T<Eigen::Matrix<double,1,1,0,1,1>,5,2,0>,
msf_core::StateVar_T<Eigen::Quaternion<double,0>,6,3,0>,
msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,7,2,0>,
msf_core::StateVar_T<Eigen::Quaternion<double,0>,8,2,0>,
msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,9,2,0>,
msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,10,2,0>,
They are the same because default parameter value,but it turns out will generate different template match.
At msf_stata.h line 92-110,define enum by msf_tmp temlate match,but the result is different under VS2017 and gcc,here's the result(left is VS2017,right is gcc):
nStateVarsAtCompileTime 11
nErrorStatesAtCompileTime 31
nStatesAtCompileTime 34
nCoreStatesAtCompileTime 4 vs 16
nCoreErrorStatesAtCompileTime 3 vs 15
nPropagatedCoreStatesAtCompileTime 4 vs 10
nPropagatedCoreErrorStatesAtCompileTime 3 vs 9
I followed it to msf_tmp and found why but couldn't find the solution.I pick nCoreStatesAtCompileTime as an example:
nCoreStatesAtCompileTime = msf_tmp::CountStates<StateSequence_T,
msf_tmp::CoreStateLengthForType>::value,
it use msf_tmp::CoreStateLengthForType as template match to caculate,but under VS2017 ALL StateVAr_T<Eigne::Matrix... will match this:
template<int NAME, int N, int STATE_T, int OPTIONS>
struct CoreStateLengthForType<
const msf_core::StateVar_T<Eigen::Matrix<double, N, 1>, NAME, STATE_T,
OPTIONS>&> {
enum {
value = 0
};
// Not a core state, so length is zero.
};
but gcc will match some of them to :
template<int NAME, int OPTIONS, int N, int MAXROW, int MAXCOL>
struct CoreStateLengthForType<
const msf_core::StateVar_T<Eigen::Matrix<double, N, 1,MAXROW, MAXCOL>, NAME,
msf_core::CoreStateWithoutPropagation, OPTIONS>&> {
enum {
value = N
};
};
I'm not good at template,does can anyone give a solution for this?
Base on #4 @sxsong1207 's fork,I tried to build msf under windows with vs 2017. There are some linux code like usleep() to change, but the key problem is template mismatch under vs 2017, I found what happened but did't find the solution. Here's the problem: Using 11 define ,under gcc it will be: msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 0, 0>, msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 1, 0>, msf_core::StateVar_T<Eigen::Quaternion, 2, 0>,
msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 3, 1>,
msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 4, 1>,
msf_core::StateVar_T<Eigen::Matrix<double, 1, 1, 0, 1, 1>, 5, 2>,
msf_core::StateVar_T<Eigen::Quaternion, 6, 3>,
msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 7>,
msf_core::StateVar_T<Eigen::Quaternion, 8>,
msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 9>,
msf_core::StateVar_T<Eigen::Matrix<double, 3, 1>, 10>
and turn to VS2017 it became: msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,0,0,0>, msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,1,0,0>, msf_core::StateVar_T<Eigen::Quaternion<double,0>,2,0,0>, msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,3,1,0>, msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,4,1,0>, msf_core::StateVar_T<Eigen::Matrix<double,1,1,0,1,1>,5,2,0>, msf_core::StateVar_T<Eigen::Quaternion<double,0>,6,3,0>, msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,7,2,0>, msf_core::StateVar_T<Eigen::Quaternion<double,0>,8,2,0>, msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,9,2,0>, msf_core::StateVar_T<Eigen::Matrix<double,3,1,0,3,1>,10,2,0>,
They are the same because default parameter value,but it turns out will generate different template match. At msf_stata.h line 92-110,define enum by msf_tmp temlate match,but the result is different under VS2017 and gcc,here's the result(left is VS2017,right is gcc): nStateVarsAtCompileTime 11 nErrorStatesAtCompileTime 31 nStatesAtCompileTime 34 nCoreStatesAtCompileTime 4 vs 16 nCoreErrorStatesAtCompileTime 3 vs 15 nPropagatedCoreStatesAtCompileTime 4 vs 10 nPropagatedCoreErrorStatesAtCompileTime 3 vs 9
I followed it to msf_tmp and found why but couldn't find the solution.I pick nCoreStatesAtCompileTime as an example: nCoreStatesAtCompileTime = msf_tmp::CountStates<StateSequence_T, msf_tmp::CoreStateLengthForType>::value, it use msf_tmp::CoreStateLengthForType as template match to caculate,but under VS2017 ALL StateVAr_T<Eigne::Matrix... will match this:
template<int NAME, int N, int STATE_T, int OPTIONS> struct CoreStateLengthForType< const msf_core::StateVar_T<Eigen::Matrix<double, N, 1>, NAME, STATE_T, OPTIONS>&> { enum { value = 0 }; // Not a core state, so length is zero. };
but gcc will match some of them to : template<int NAME, int OPTIONS, int N, int MAXROW, int MAXCOL> struct CoreStateLengthForType< const msf_core::StateVar_T<Eigen::Matrix<double, N, 1,MAXROW, MAXCOL>, NAME, msf_core::CoreStateWithoutPropagation, OPTIONS>&> { enum { value = N }; };
I'm not good at template,does can anyone give a solution for this?