def __actionArmEmpty(self): """ Action taken when arm is empty References ---------- armEmpty() -> putDown(?Z) | stack(?X, ?Y) """ Log.d(f"Arm is empty :: {self.__planningStack}") exit(1)
def getPlan(self, startState: str, goalState: str): """ Run the Goal Stack Planner and creates the final plan to achieve the Goal State Parameters ---------- startState : str starting state goalState : str goal state to achieve Returns ------- list list of actions to be taken to achieve the goal state """ self.__startState = startState.split(self.__sep) self.__goalState = goalState.split(self.__sep) self.__currentStack = self.__startState.copy() # creating the plan stack for predicate in self.__goalState: self.__planningStack.append(predicate) # running for the stack empty while len(self.__planningStack) > 0: if self.__verbose: Log.d(f"Planning Stack :: {self.__planningStack}") Log.d(f"Current Stack :: {self.__currentStack}") top = self.__planningStack.pop() temp = top.split() # if it is a predicate in current stack pop it if temp[0] in self.__predicates: if top in self.__currentStack: continue else: # if it is a predicate if temp[0] == Predicate.ON: self.__actionOn(temp[1], temp[2]) elif temp[0] == Predicate.ON_TABLE: self.__actionOnTable(temp[1]) elif temp[0] == Predicate.CLEAR: self.__actionClear(temp[1]) elif temp[0] == Predicate.HOLDING: self.__actionHolding(temp[1]) elif temp[0] == Predicate.ARM_EMPTY: self.__actionArmEmpty() if temp[0] in self.__actions: # if it is an action if temp[0] == Action.STACK: self.__effectStack(temp[1], temp[2]) elif temp[0] == Action.UNSTACK: self.__effectUnStack(temp[1], temp[2]) elif temp[0] == Action.PICKUP: self.__effectPickUp(temp[1]) elif temp[0] == Action.PUTDOWN: self.__effectPutDown(temp[1]) # add processed action self.__plan.append(top) if self.__verbose: Log.d(f"Final stack :: {self.__currentStack}") return self.__plan
from lib.logger import Log Log.setPrint(True) Log.d("Ok this function is working") Log.i("The video format suggested is .mp4") Log.e("Error parsing the video format") Log.w(f"Using mpeg4sc to parse the video : {10 ** 10}xdRG")