int SetIDSAction::executeCB(ros::Duration dt)
{
  set_feedback(RUNNING);

  std::string bin, ids_bin, old_arm, arm, task;

  fillParameter("/apc/task", task);

  if (task != "stow")
  {
      if (!fillParameter("/apc/task_manager/target_bin", bin))
      {
          set_feedback(FAILURE);
          return 1;
      }
  }
  else
  {
      bin = "tote";
  }

  ids_bin = bin + "_1";
  arm = left_arm;

  fillParameter("/apc/bt/ids", arm, old_arm); // get old ids arm, or use the current one, if not set

  setParameter("/apc/bt/old_ids", old_arm);
  setParameter("/apc/bt/ids", arm);
  setParameter("/apc/bt/ids_bin", ids_bin);

  set_feedback(SUCCESS);
  return 1;
}
int Condition::executeCB(ros::Duration dt)
{
  std::string object_name, ids_arm, ids_bin;
  bool has_memory;
  set_feedback(RUNNING);

  if (!isSystemActive())
  {
    return 1;
  }

  fillParameter("/apc/task_manager/target_object", object_name);
  fillParameter("/apc/task_manager/memory/" + object_name, false,  has_memory);

  if (has_memory)
  {
    fillParameter("/apc/task_manager/memory/ids_arm", ids_arm);
    fillParameter("/apc/task_manager/memory/ids_bin", ids_bin);

    setParameter("/apc/bt/ids", ids_arm);
    setParameter("/apc/bt/ids_bin", ids_bin);
    setParameter("/apc/task_manager/memory/" + object_name, false);
    set_feedback(SUCCESS);
    return 1;
  }

  set_feedback(FAILURE);
  return 1;
}
double BTMoveAction::getPreemptTimeoutValue()
{
  double timeout;
  fillParameter("/apc/bt/move_action/preempt_timeout", 3.0, timeout);

  return timeout;
}
double BTPlaceAction::getTimeoutValue()
{
  double timeout;
  fillParameter("/apc/bt/place_action/timeout", 30.0, timeout);

  return timeout;
}
Example #5
0
bool DeformAction::fillGoal(sarafun_msgs::DeformationKeyframeGoal &goal) {
  int idx;

  fillParameter("/sarafun/deform/idx", 0, idx);
  goal.idx = idx;

  return true;
}
bool BTPlaceAction::fillGoal(apc_manipulation::PlaceObjectGoal &goal)
{
  if (!fillParameter("/apc/task_manager/target_object", goal.targetObject))
  {
    return false;
  }
  if (!fillParameter("/apc/task_manager/target_bin", goal.bin_id))
  {
    return false;
  }
  if (!fillParameter("/apc/task_manager/arm", goal.arm))
  {
    return false;
  }
  // TODO : Fill in possible obstacles
  return true;
}
bool AssembledAction::fillGoal(sarafun_msgs::AssembledKeyframeGoal &goal) {
  int idx;

  fillParameter("/sarafun/assembled/idx", 0, idx);
  goal.idx = idx;

  return true;
}
int Condition::executeCB(ros::Duration dt)
{
  bool place_failure;
  set_feedback(RUNNING);

  if (!isSystemActive())
  {
    return 1;
  }

  fillParameter("/apc/task_manager/place_failure", false, place_failure);

  if(place_failure)
  {
      set_feedback(SUCCESS);
  }
  else
  {
      set_feedback(FAILURE);
  }

  return 1;
}
int Condition::executeCB(ros::Duration dt)
{
  Desperation desperation_mode;
  set_feedback(RUNNING);

  if (!isSystemActive())
  {
    return 1;
  }

  fillParameter("/apc/task_manager/desperation", desperation_mode);

  if (desperation_mode == level_4)
  {
    set_feedback(SUCCESS);
  }
  else
  {
    set_feedback(FAILURE);
  }

  return 1;
}
Example #10
0
double DeformAction::getTimeoutValue() {
  double timeout = 0;
  fillParameter("/sarafun/bt_action_nodes/deform/timeout", 30.0, timeout);

  return timeout;
}
double AssembledAction::getTimeoutValue() {
  double timeout = 0;
  fillParameter("/sarafun/bt_action_nodes/assembled/timeout", 30.0, timeout);

  return timeout;
}