bool SSLGamePlanner::update () { //if globalstate and refbox control didn't change, //don't do anything if (!isGlobalStateUptodate () && !update_refbox_control) { // ROS_INFO("waiting for global_state to be received"); return false; } if (!isPathPlannerConnected ()) { // ROS_INFO("global_state is received, waiting for a path planner"); return false; } if (isGlobalStateUptodate ()) { global_st = getGlobalState (); for (uint8_t i = 0; i < ssl::config::TEAM_CAPACITY; i++) { if (team_ == ssl::BLUE) { team_global_state[i] = global_st.blue_team[i]; opponent_global_state[i] = global_st.yellow_team[i]; } else { team_global_state[i] = global_st.yellow_team[i]; opponent_global_state[i] = global_st.blue_team[i]; } if (global_st.balls.size () > 0) ball_state = global_st.balls[0]; } } if (update_refbox_control) { ssl_game_state.transition (refbox_ctrl_.refbox_control, isBallKicked ()); update_refbox_control = false; } return true; }
generic_callback(lua_State *_L) { L = getGlobalState(_L); ref = lua_ref(L, true); }