Beispiel #1
0
void GraphicalRobotElement::setCurrentWIM (WorldInfo nwim) {
	currentWIM.Clear();

	if (teamColor == 1) {
		currentWIM = nwim;
	} else {
		WorldInfo MyWorld;
		MyWorld.Clear();
		MyWorld.CopyFrom (nwim);
		float value = (-1) * MyWorld.myposition().x();
		MyWorld.mutable_myposition()->set_x (value);
		value = (-1) * MyWorld.myposition().y();
		MyWorld.mutable_myposition()->set_y (value);
		value = MyWorld.myposition().phi() + Pi;
		MyWorld.mutable_myposition()->set_phi (value);
		currentWIM = MyWorld;
	}

	if (LWSTraceVisible) {
		setLWSTraceVisible (false);
		updateTraceRect();
		setLWSTraceVisible (true);
	} else {
		setLWSTraceVisible (false);
		updateTraceRect();
		setLWSTraceVisible (false);
	}
}
Beispiel #2
0
PhysicWorld::PhysicWorld(const WorldInfo info)
{

	m_collisionConfiguration = new btDefaultCollisionConfiguration();
	m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);

	m_overlappingPairCache = new btAxisSweep3(info.getMin()->toBtVector3(),info.getMax()->toBtVector3());

	#if SLIDER_DEMO_USE_ODE_SOLVER
	m_constraintSolver = new btOdeQuickstepConstraintSolver();
	#else
		m_constraintSolver = new btSequentialImpulseConstraintSolver();
	#endif
	m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_overlappingPairCache,m_constraintSolver,m_collisionConfiguration);
	//	wp->getSolverInfo().m_numIterations = 20; // default is 10
	this->m_gravite = info.getGravity()->toBtVector3();
	m_dynamicsWorld->setGravity(this->m_gravite);
}
Beispiel #3
0
int Localization::LocalizationData_Load(parts & Particles, vector<KObservationModel> & Observation, KMotionModel & MotionModel) {
	bool addnewptrs = false;
	//Fill the world with data!
	WorldInfo *WI = DebugData.mutable_world();


	//Setting my position
	WI->mutable_myposition()->set_x(AgentPosition.x);
	WI->mutable_myposition()->set_y(AgentPosition.y);
	WI->mutable_myposition()->set_phi(AgentPosition.theta);
	WI->mutable_myposition()->set_confidence(AgentPosition.confidence);


	//Setting robotPositionField X = DX, Y = DY, phi = DF

	//	DebugData.mutable_robotposition()->set_x(MotionModel.Distance.val);
	//	DebugData.mutable_robotposition()->set_y(MotionModel.Direction.val);
	//	DebugData.mutable_robotposition()->set_phi(MotionModel.Rotation.val);
	DebugData.mutable_robotposition()->set_x(TrackPointRobotPosition.x);
	DebugData.mutable_robotposition()->set_y(TrackPointRobotPosition.y);
	DebugData.mutable_robotposition()->set_phi(TrackPointRobotPosition.phi);


	//	DebugData.mutable_myposition()->set_confidence(AgentPosition.confidence );

	RobotPose prtcl;

	if (DebugData.particles_size() < Particles.size)
		addnewptrs = true;
	for (unsigned int i = 0; i < Particles.size; i++) {
		if (addnewptrs)
			DebugData.add_particles();
		DebugData.mutable_particles(i)->set_x(Particles.x[i]);
		DebugData.mutable_particles(i)->set_y(Particles.y[i]);
		DebugData.mutable_particles(i)->set_phi(Particles.phi[i]);
		DebugData.mutable_particles(i)->set_confidence(Particles.Weight[i]);
	}


	//	if(osbm!=null){
	//		DebugData.Observations = obsm;
	//	}
	return 1;
}
Beispiel #4
0
void SaveHandler::saveWorldInfoAndPlayer(WorldInfo worldinfo, List list) 
{
        NBTTagCompound nbttagcompound = worldinfo.getNBTTagCompoundWithPlayer(list);
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setTag("Data", nbttagcompound);
        try
        {
            File file = new File(saveDirectory, "level.dat_new");
            File file1 = new File(saveDirectory, "level.dat_old");
            File file2 = new File(saveDirectory, "level.dat");
            CompressedStreamTools.writeGzippedCompoundToOutputStream(nbttagcompound1, new FileOutputStream(file));
            if(file1.exists())
            {
                file1.delete();
            }
            file2.renameTo(file1);
            if(file2.exists())
            {
                file2.delete();
            }
Beispiel #5
0
QRectF KFieldScene::visionBallRect (BallObject bob, WorldInfo wim) {
	float xmiddle = (wim.myposition().x() + bob.dist() * cos ( (wim.myposition().phi() + bob.bearing() ) ) ) * 1000;
	float ymiddle = (wim.myposition().y() + bob.dist() * sin ( (wim.myposition().phi() + bob.bearing() ) ) ) * 1000;
	return rectFromFC ( xmiddle, ymiddle, 75, 75);
}
//////////////////////////////////////////////////////////////////////////////
// 클라이언트가 서버의 리스트를 달라고 요청해오면, 로그인 서버는 DB로부터
// 서버들의 정보를 로딩해서 LCWorldList 패킷에 담아서 전송한다.
//////////////////////////////////////////////////////////////////////////////
void CLGetWorldListHandler::execute (CLGetWorldList* pPacket , Player* pPlayer)
	 throw(ProtocolException , Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __LOGIN_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);
	//cout << "Start execute" << endl;

	LoginPlayer* pLoginPlayer = dynamic_cast<LoginPlayer*>(pPlayer);

	try 
	{
		int Num = g_pGameWorldInfoManager->getSize();

		//cout << "WorldNum : " << Num << endl;

		WorldInfo* aWorldInfo[Num];

		for(int i = 1 ; i < Num + 1; i++) 
		{
			WorldInfo* pWorldInfo = new WorldInfo();
			GameWorldInfo* pGameWorldInfo = g_pGameWorldInfoManager->getGameWorldInfo(i);
			pWorldInfo->setID(pGameWorldInfo->getID());
			pWorldInfo->setName(pGameWorldInfo->getName());

			// by bezz. 2002.12.20 
			pWorldInfo->setStat(pGameWorldInfo->getStatus());

			aWorldInfo[i] = pWorldInfo;

			// 트랜실(2) 빼기
			//if (i==2) pWorldInfo->setStat(WORLD_CLOSE);

			//cout << "AddWorld : " << pWorldInfo->getName() << endl;
		}

		LCWorldList lcWorldList;

		Statement * pStmt = NULL;

		BEGIN_DB
		{
			pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();

			Result * pResult = pStmt->executeQuery("SELECT CurrentWorldID FROM Player where PlayerID='%s'" , pLoginPlayer->getID().c_str());

			if(pResult->next() ) {
				lcWorldList.setCurrentWorldID(pResult->getInt(1));
			}

			SAFE_DELETE(pStmt); // by sigi
		}
		END_DB(pStmt) // by sigi

		for(int k = 1; k < Num + 1; k++) 
		{
			lcWorldList.addListElement(aWorldInfo[k]);
		}

		pLoginPlayer->sendPacket(&lcWorldList);
	
//		pLoginPlayer->setPlayerStatus(LPS_PC_MANAGEMENT);
	} 
	catch (Throwable & t) 
	{
		//cout << t.toString() << endl;
	}
	//cout << "End execute" << endl;

#endif

	__END_DEBUG_EX __END_CATCH
}