Пример #1
0
void ISitableRoom::onPlayerEnterRoom(stEnterRoomData* pEnterRoomPlayer,int8_t& nSubIdx )
{
	IRoom::onPlayerEnterRoom(pEnterRoomPlayer, nSubIdx);
	auto pp = getSitdownPlayerByUID(pEnterRoomPlayer->nUserUID);
	if (pp)
	{
		auto pStandPlayer = getPlayerByUserUID(pEnterRoomPlayer->nUserUID);
		if (pStandPlayer->nCoin >= pp->getCoin())
		{
			if (pStandPlayer->nCoin != pp->getCoin())
			{
				LOGFMTD("uid = %u reenter room coin is not the same . stand = %u , sit = %u", pp->getUserUID(), pStandPlayer->nCoin, pp->getCoin());
			}
			pStandPlayer->nCoin -= pp->getCoin();
		}
		else
		{
			LOGFMTE("uid = %u stand coin is few then sit , why ? but stand = %u , sit = %u", pp->getUserUID(), pStandPlayer->nCoin, pp->getCoin());
			pStandPlayer->nCoin = 0;
		}
		pp->reactive(pEnterRoomPlayer->nUserSessionID);
	}
}
Пример #2
0
//we want the boat to stay within 350-425 range finders for sensors
//Get feedback from fanboat
void mapping::sensorFilter_callback(const fanboat_ll::fanboatLL::ConstPtr& f_ll)
{
	fll = *f_ll;
	lab2::angle_msg boat;

	//ROS_INFO("mapping");
	leftS = fll.a0;
	rightS = fll.a1;
	if (initLeftS == -100){
		initLeftS = 300;
	}
	if (initRightS == -100){
		initRightS = 300;
	}

	if(state == 0){
		doMapping();
		ROS_INFO("MAPPING");
	} else if (state == 1){
		angle = yawClose;
		turn(yawClose);
		ROS_INFO("TURN CLOSE");
	} else if (state == 2){
		angle = yawFar;
		turn(yawFar);
		ROS_INFO("TURN FAR");
	} else if (state == 3){
		reactive();
		ROS_INFO("GO TO THERE");
	}

	boat.angle = angle;
	boat.thrust = thrust;
	ROS_INFO("angle: %f", angle);
	angles_pub_.publish(boat);
}