void CPFA_qt_user_functions::DrawOnRobot(CFootBotEntity& entity) { CPFA_controller& c = dynamic_cast<CPFA_controller&>(entity.GetControllableEntity().GetController()); if(c.IsHoldingFood() == true) { DrawCylinder(CVector3(0.0, 0.0, 0.3), CQuaternion(), loopFunctions.FoodRadius, 0.025, CColor::BLACK); } if(loopFunctions.DrawIDs == 1) { /* Disable lighting, so it does not interfere with the chosen text color */ glDisable(GL_LIGHTING); /* Disable face culling to be sure the text is visible from anywhere */ glDisable(GL_CULL_FACE); /* Set the text color */ CColor cColor(CColor::BLACK); glColor3ub(cColor.GetRed(), cColor.GetGreen(), cColor.GetBlue()); /* The position of the text is expressed wrt the reference point of the footbot * For a foot-bot, the reference point is the center of its base. * See also the description in * $ argos3 -q foot-bot */ // Disable for now //GetOpenGLWidget().renderText(0.0, 0.0, 0.5, // position // entity.GetId().c_str()); // text /* Restore face culling */ glEnable(GL_CULL_FACE); /* Restore lighting */ glEnable(GL_LIGHTING); } }
// draw function for adding graphics to a foot-bot void iAnt_qt_user_functions::DrawFood(CFootBotEntity& entity) { iAnt_controller& c = dynamic_cast<iAnt_controller&> (entity.GetControllableEntity().GetController()); UpdateDrawInWorldData(c); if(c.IsHoldingFood() == true) { //#ifdef __APPLE__ //Edit here for drawing trails DrawCylinder(CVector3(0.0f, 0.0f, 0.3f), CQuaternion(), 0.05f, 0.025f, CColor::BLACK); //#else // DrawCylinder(0.05f, 0.025f, CVector3(0.0f, 0.0f, 0.3f), CColor::BLACK); //#endif } }
bool CLandmarks::InChain(CFootBotEntity& c_fb) { /* Return value: true = robot is part of a chain, false otherwise */ bool bRetVal = false; /* Get reference to robot controller */ CLuaController& cContr = dynamic_cast<CLuaController&>(c_fb.GetControllableEntity().GetController()); /* Get 'robot' table */ lua_getglobal(cContr.GetLuaState(), "robot"); /* Get 'in_chain' variable */ lua_getfield(cContr.GetLuaState(), -1, "in_chain"); if((! lua_isnil(cContr.GetLuaState(), -1)) && // 'in_chain' variable found (lua_isnumber(cContr.GetLuaState(), -1))) { // its value is a number /* Get value as a real number */ Real fInChain = lua_tonumber(cContr.GetLuaState(), -1); /* If not zero, robot is in a chain */ if(fInChain != 0.0) { bRetVal = true; } } /* Clean up Lua stack */ lua_pop(cContr.GetLuaState(), 2); /* Return result */ return bRetVal; }
void CBuzzQT::Draw(CFootBotEntity& c_entity) { Draw(dynamic_cast<CBuzzController&>(c_entity.GetControllableEntity().GetController())); }
void CRecruitmentQTUserFunctions::Draw(CFootBotEntity& c_entity) { CBTFootbotRandomForagingController& cController = dynamic_cast<CBTFootbotRandomForagingController&>(c_entity.GetControllableEntity().GetController()); }