Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for executing regular actions #319

Closed
Rezenders opened this issue Aug 30, 2024 · 1 comment
Closed

Support for executing regular actions #319

Rezenders opened this issue Aug 30, 2024 · 1 comment

Comments

@Rezenders
Copy link
Contributor

Rezenders commented Aug 30, 2024

It would be interesting to be able to execute regular actions (non durative-action).
Right now, the following error occurs when trying to execute regular actions:

[domain_expert_node-1] [WARN] [1725038660.536800793] [domain_expert]: Requesting a non-existing durative action [start_robot]
[executor_node-4] [ERROR] [1725038660.537287642] [executor]: /domain_expert/get_domain_durative_action_details: Durative action not found

If I understood correctly, this error comes from:

domain_client_->getDurativeAction(
get_action_name(plan_item.action), get_action_params(plan_item.action));

I am not sure what is the best way to implement this feature.
Extend the ActionExecutionInfo struct to support regular actions then check whether the action is a regular or durative action when constructing the action map?

Related to #317

@Rezenders
Copy link
Contributor Author

Rezenders commented Sep 16, 2024

I propose two possible solutions

1 - Simple hacky one. Convert Actions to DurativeActions, something like:

auto action = domain_client_->getAction(
      get_action_name(plan_item.action), get_action_params(plan_item.action));
plansys2_msgs::msg::DurativeAction::SharedPtr durative_action;
durative_action->name = action->name;
durative_action->over_all_requirements = action->preconditions;
durative_action->at_end_effects = action->effects;

Then everywhere in the action execution pipeline where getDurativeAction is called, we also try to call getAction and convert it to a durative action.

2 - In ActionExecutionInfo make durative_action_info a variant (something like #323 ):

struct ActionExecutionInfo
{
  std::shared_ptr<ActionExecutor> action_executor = {nullptr};
  bool at_start_effects_applied = {false};
  bool at_end_effects_applied = {false};
  rclcpp::Time at_start_effects_applied_time;
  rclcpp::Time at_end_effects_applied_time;
  std::variant<std::shared_ptr<plansys2_msgs::msg::Action>, std::shared_ptr<plansys2_msgs::msg::DurativeAction>> action_info = {nullptr};
  std::string execution_error_info;
  double duration;
  double duration_overrun_percentage = -1.0;
};

Then everywhere in the action execution pipeline where getDurativeAction is called, we also try to call getAction and initialize action_info accordingly.
Build the execution BT without CheckAtEndReq and ApplyAtStartEffect for regular actions.
Check action_info type when accessing elements in CheckOverAllReq and ApplyAtEndEffect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant