Skip to content

Commit

Permalink
client側の設定
Browse files Browse the repository at this point in the history
  • Loading branch information
HansRobo committed Jan 7, 2025
1 parent e86f864 commit baf750e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions crane_simple_ai/src/crane_commander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,30 @@ void CraneCommander::postSkill(
const std::shared_ptr<const SkillExecution::Feedback> feedback) {
ui->logTextBrowser->append(QString::fromStdString(feedback->message));
};
goal_option.goal_response_callback =
[](rclcpp_action::ClientGoalHandle<SkillExecution>::SharedPtr goal_handle) {
// if (goal_handle->get_status() == rclcpp_action::GoalStatus::) {}
};
goal_option.result_callback =
[&](const rclcpp_action::ClientGoalHandle<SkillExecution>::WrappedResult result) {
auto & task = task_queue_execution.front();
auto task_result = result.result->result;
if (not task.retry()) {
task_queue_execution.pop_front();
if (task_queue_execution.empty()) {
onQueueToBeEmpty();
}
} else {
ui->logTextBrowser->append(QString::fromStdString(std::format(
"{}を再実行します。残り時間[s]:{}", task.name, std::to_string(task.getRestTime()))));
postSkill(name, parameters);
}
if (task_result == static_cast<uint16_t>(skills::Status::FAILURE)) {
ui->logTextBrowser->append(QString::fromStdString("Task " + task.name + " failed"));
} else if (task_result == static_cast<uint16_t>(skills::Status::SUCCESS)) {
ui->logTextBrowser->append(QString::fromStdString("Task " + task.name + " succeeded"));
}
};
}

CraneCommander::~CraneCommander()
Expand Down

0 comments on commit baf750e

Please sign in to comment.