Exemplo n.º 1
0
void sendCognitivAnimation(SocketClient& sock, EmoStateHandle eState) {

	std::ostringstream os;

	EE_CognitivAction_t actionType	= ES_CognitivGetCurrentAction(eState);
	float				actionPower = ES_CognitivGetCurrentActionPower(eState);
	int					intType = static_cast<int>(actionType);
	int					intPower = static_cast<int>(actionPower*100.0f);

	os << intType << "," << intPower;
	std::cout << os.str()<< std::endl;

	sock.SendBytes(os.str());
}
Exemplo n.º 2
0
void sendCognitiv(EmoStateHandle eState) {
	int i;
	std::ostringstream os;

	EE_CognitivAction_t actionType	= ES_CognitivGetCurrentAction(eState);
	float				actionPower = ES_CognitivGetCurrentActionPower(eState);
	int					intType = static_cast<int>(actionType);
	int					intPower = static_cast<int>(actionPower*100.0f);


	/*servo config*/
	int Base = 0;
	int Bicep = 1;
	int Elbow = 2;
	int Wrist = 3;
	int Gripper = 4;

	/*intType*/
	int Neutral = 1;
	int Push = 2;
	int Pull = 4;
	int Lift = 8;
	int Drop = 16;
	int Left = 32;
	int Right = 64;
	int RotateLeft = 128;
	int RotateRight = 256;
	int RotateClockwise = 512;
	int RotateCounterClockwise = 1024;
	int RotateForward = 2048;
	int RotateReverse = 4096;
	int Disappear = 8192;

		/*increse the values as that is called*/
	/*only if power is above threshold will it increment, prevents little querks*/
	if(intPower >= powerThreshold){
		if(intType == Right){
			i=0;
			if(angles[i]<=(maxS[i]-step)) angles[i]+=step;
			put(i,angles[i]);
			//doInverse();
		}
		if(intType == Left){
			i=0;
			if(angles[i]>=(minS[i]+step)) angles[i]-=step;
			put(i,angles[i]);
			//doInverse();
		}
		if(intType == Pull){
			i=1;
			if(angles[i]<=(maxS[i]-step)) angles[i]+=step;
			put(i,angles[i]);
			//doInverse();
		}
		if(intType == Push){
			i=1;
			if(angles[i]>=(minS[i]+step)) angles[i]-=step;
			put(i,angles[i]);
			//doInverse();
		}
		if(intType == Lift){
			i=2;
			if(angles[i]<=(maxS[i]-step)) angles[i]+=step;
			put(i,angles[i]);
			//doInverse();
		}
		if(intType == Drop){
			i=2;
			if(angles[i]>=(minS[i]+step)) angles[i]-=step;
			put(i,angles[i]);
			//doInverse();
		}
		if(intType == RotateRight){ 
			i=3;
			if(angles[i]<=(maxS[i]-step)) angles[i]+=step;
			put(i,angles[i]);
		}
		if(intType == RotateLeft){ 
			i=3;
			if(angles[i]>=(minS[i]+step)) angles[i]-=step;
			put(i,angles[i]);
		}
	}


	os << intType << "," << intPower;
	std::cout << os.str()<< std::endl;

}
Exemplo n.º 3
0
void emotiv::logEmoState(std::ostream& os, unsigned int userID, EmoStateHandle eState, bool withHeader) {

	ofNotifyEvent(elEventoEmo, eState);

	// Create the top header
	if (withHeader) {
		os << "Time,";
		os << "UserID,";
		os << "Wireless Signal Status,";
		os << "Blink,";
		os << "Wink Left,";
		os << "Wink Right,";
		os << "Look Left,";
		os << "Look Right,";
		os << "Eyebrow,";
		os << "Furrow,";
		os << "Smile,";
		os << "Clench,";
		os << "Smirk Left,";
		os << "Smirk Right,";
		os << "Laugh,";
		os << "Short Term Excitement,";
		os << "Long Term Excitement,";
		os << "Engagement/Boredom,";
		os << "Cognitiv Action,";
		os << "Cognitiv Power,";
		os << std::endl;
	}

	// Log the time stamp and user ID
	os << ES_GetTimeFromStart(eState) << ",";
	os << userID << ",";
	os << static_cast<int>(ES_GetWirelessSignalStatus(eState)) << ",";

	// Expressiv Suite results
	os << ES_ExpressivIsBlink(eState) << ",";
	os << ES_ExpressivIsLeftWink(eState) << ",";
	os << ES_ExpressivIsRightWink(eState) << ",";

	os << ES_ExpressivIsLookingLeft(eState) << ",";
	os << ES_ExpressivIsLookingRight(eState) << ",";

	std::map<EE_ExpressivAlgo_t, float> expressivStates;

	EE_ExpressivAlgo_t upperFaceAction = ES_ExpressivGetUpperFaceAction(eState);
	float			   upperFacePower  = ES_ExpressivGetUpperFaceActionPower(eState);

	EE_ExpressivAlgo_t lowerFaceAction = ES_ExpressivGetLowerFaceAction(eState);
	float			   lowerFacePower  = ES_ExpressivGetLowerFaceActionPower(eState);

	expressivStates[ upperFaceAction ] = upperFacePower;
	expressivStates[ lowerFaceAction ] = lowerFacePower;
	
	os << expressivStates[ EXP_EYEBROW     ] << ","; // eyebrow
	os << expressivStates[ EXP_FURROW      ] << ","; // furrow
	os << expressivStates[ EXP_SMILE       ] << ","; // smile
	os << expressivStates[ EXP_CLENCH      ] << ","; // clench
	os << expressivStates[ EXP_SMIRK_LEFT  ] << ","; // smirk left
	os << expressivStates[ EXP_SMIRK_RIGHT ] << ","; // smirk right
	os << expressivStates[ EXP_LAUGH       ] << ","; // laugh

	// Affectiv Suite results
	os << ES_AffectivGetExcitementShortTermScore(eState) << ",";
	os << ES_AffectivGetExcitementLongTermScore(eState) << ",";

	os << ES_AffectivGetEngagementBoredomScore(eState) << ",";

	// Cognitiv Suite results
	os << static_cast<int>(ES_CognitivGetCurrentAction(eState)) << ",";
	os << ES_CognitivGetCurrentActionPower(eState);

	os << std::endl;
};