src/wecook/TaskManager.cpp
/*!
 * addNewTask
 * accepts msg and construct a correcponding task data object
 * @param msg
 */
addNewTask
accepts msg and construct a correcponding task data object
@param msg
addNewTask accepts msg and construct a correcponding task data object @param msg
void TaskManager::addNewTask(const TaskMsg::ConstPtr &msg) {
  Task task = Task();
  for (const auto &objectMsg : msg->scene.objects) {
    Object object(objectMsg.name, objectMsg.url, objectMsg.pose);
    task.addObject(object);
  }
  for (const auto &actionMsg : msg->actions) {
    Action action(actionMsg.pid, actionMsg.location, actionMsg.ingredients, actionMsg.verb, actionMsg.tool);
    task.addSubgoal(action);
  }
  for (const auto &containingMsg : msg->scene.containingMap) {
    task.addContainingPair(containingMsg.pair[0], containingMsg.pair[1]);
  }
  task.addPDDLDomain(msg->PDDLDomain);
  task.addPDDLProblem(msg->PDDLProblem);
  for (const auto &agentMsg : msg->agents) {
    task.addAgent(agentMsg.pid, agentMsg.type, agentMsg.pose);
  }
  task.addTaskType(msg->type);
  task.addMotionPlannerType(msg->motionPlannerType);
  task.setSim(msg->ifSim);
  m_taskQueue.push(task);
}
void TaskManager :: addNewTask ( const TaskMsg :: ConstPtr & msg ) { Task task = Task ( ) ; for ( const auto & objectMsg : msg -> scene . objects ) { Object object ( objectMsg . name , objectMsg . url , objectMsg . pose ) ; task . addObject ( object ) ; } for ( const auto & actionMsg : msg -> actions ) { Action action ( actionMsg . pid , actionMsg . location , actionMsg . ingredients , actionMsg . verb , actionMsg . tool ) ; task . addSubgoal ( action ) ; } for ( const auto & containingMsg : msg -> scene . containingMap ) { task . addContainingPair ( containingMsg . pair [ 0 ] , containingMsg . pair [ 1 ] ) ; } task . addPDDLDomain ( msg -> PDDLDomain ) ; task . addPDDLProblem ( msg -> PDDLProblem ) ; for ( const auto & agentMsg : msg -> agents ) { task . addAgent ( agentMsg . pid , agentMsg . type , agentMsg . pose ) ; } task . addTaskType ( msg -> type ) ; task . addMotionPlannerType ( msg -> motionPlannerType ) ; task . setSim ( msg -> ifSim ) ; m_taskQueue . push ( task ) ; }
addNewTask
 accepts msg and construct a correcponding task data object
 @param msg
addNewTask accepts msg and construct a correcponding task data object @param msg