void CLoopFunctions::SetOnlineControlParameters(UInt32 un_num_params, const Real* pf_params) { CSpace::TAnyEntityMap cEntities = m_cSpace.GetEntitiesByType("controllable_entity"); for(CSpace::TAnyEntityMap::iterator it = cEntities.begin(); it != cEntities.end(); ++it) { CControllableEntity* pcEntity = any_cast<CControllableEntity*>(it->second); pcEntity->GetController().SetOnlineParameters(un_num_params,pf_params); } }
void CQTOpenGLLuaMainWindow::PopulateLuaControllers() { /* Get list of controllable entities */ CSpace& cSpace = CSimulator::GetInstance().GetSpace(); CSpace::TMapPerType& tControllables = cSpace.GetEntitiesByType("controller"); /* Go through them and keep a pointer to each Lua controller */ for(CSpace::TMapPerType::iterator it = tControllables.begin(); it != tControllables.end(); ++it) { /* Try to convert the controller into a Lua controller */ CControllableEntity* pcControllable = any_cast<CControllableEntity*>(it->second); CLuaController* pcLuaController = dynamic_cast<CLuaController*>(&(pcControllable->GetController())); if(pcLuaController) { /* Conversion succeeded, add to indices */ m_vecControllers.push_back(pcLuaController); m_vecRobots.push_back(&pcControllable->GetParent()); } else { LOGERR << "[WARNING] Entity \"" << pcControllable->GetParent().GetId() << "\" does not have a Lua controller associated" << std::endl; } } }
void CPointMass3DEngine::AddControllableEntity(CControllableEntity& c_entity) { m_tControllableEntities[c_entity.GetId()] = &c_entity; }
void CKinematics2DEngine::AddControllableEntity(CControllableEntity& c_entity) { m_tControllableEntities[c_entity.GetId()] = &c_entity; }
void CDynamics3DEngine::AddControllableEntity(CControllableEntity& c_entity) { m_tControllableEntities[c_entity.GetId()] = &c_entity; }