0
マイ相を格納することは次のようになります。は配列として構造体を渡すと
enum Gait_cycle_states {
HEEL_STRIKE,
FLAT_FOOT,
MID_STANCE,
HEEL_OFF,
TOE_OFF,
MID_SWING
};
私の構造体には次のようになります。
struct State {
Gait_cycle_states current_state;
uint8_t next_state; //index of the next state
uint8_t ay_num_criteria;
State_criterion *ay_criteria_for_state;
unsigned int gy_num_criteria;
State_criterion *gy_criteria_for_state;
};
と私の関数は次のようになります。
void initialize_FSM(State states_array[]){
//Heel strike----------------------------------------------------------
State heel_strike = {
.current_state = HEEL_STRIKE,
.next_state = 1, //the index of the next state
.ay_num_criteria = 1,
.ay_criteria_for_state = new State_criterion[1],
.gy_num_criteria = 2,
.gy_criteria_for_state = new State_criterion[2]
};
//The features to look for in accel_y and gyro_y, and how old they can be to count (in ms)
heel_strike.ay_criteria_for_state[0] = { NO_FEATURE, 150 };
heel_strike.gy_criteria_for_state[0] = { NEGATIVE_TROUGH, 150 };
heel_strike.gy_criteria_for_state[1] = { BREACHED_HIGH_THRESHOLD, 30 };
//putting the state we just configured into the state array
states_array[0] = heel_strike;
};
Visual Studio 2015は、 "。"を使用して自分のタイプに値を割り当てさせていないようです。またはファッションで、私はそれをやっています。
それは私にたくさんまたはエラーと、このような警告を投げている:
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(123): error C2059: syntax error: '.'
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(131): error C2143: syntax error: missing ';' before '}'
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(134): error C3927: '->': trailing return type is not allowed after a non-function declarator
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(134): error C3484: syntax error: expected '->' before the return type
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(134): error C3613: missing return type after '->' ('int' assumed)
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(134): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(134): error C2146: syntax error: missing ';' before identifier 'ay_criteria_for_state'
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(134): error C2143: syntax error: missing ';' before '{'
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(134): error C2447: '{': missing function header (old-style formal list?)
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(135): error C3927: '->': trailing return type is not allowed after a non-function declarator
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(135): error C3484: syntax error: expected '->' before the return type
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(135): error C3613: missing return type after '->' ('int' assumed)
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(135): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(135): error C2086: 'int heel_strike': redefinition
1> c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(134): note: see declaration of 'heel_strike'
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(135): error C2146: syntax error: missing ';' before identifier 'gy_criteria_for_state'
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(135): error C2143: syntax error: missing ';' before '{'
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(135): error C2447: '{': missing function header (old-style formal list?)
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(136): error C3927: '->': trailing return type is not allowed after a non-function declarator
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(136): error C3484: syntax error: expected '->' before the return type
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(136): error C3613: missing return type after '->' ('int' assumed)
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(136): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(136): error C2086: 'int heel_strike': redefinition
1> c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(134): note: see declaration of 'heel_strike'
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(136): error C2146: syntax error: missing ';' before identifier 'gy_criteria_for_state'
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(136): error C2143: syntax error: missing ';' before '{'
1>c:\users\arunava nag\documents\visual studio 2015\projects\gaitdetector\gaitdetector\gait_detector.cpp(136): error C2447: '{': missing function header (old-style formal list?)
誰かが何ができるかを私に提案してくださいだろうか?
ありがとうございます...あなたは正しいです。 –
"*(C言語でもサポートされているとは思えません)*" VC++ 2013から始まりますが、C言語でコンパイルするときは_only_、C++でコンパイルするときは決してありません。 – ildjarn
@ildjarn括弧内の文字を削除しました。 –