Skip to content

Commit

Permalink
hubero_core - Actor: FSM events filled up based on i.a. animation fin…
Browse files Browse the repository at this point in the history
…ish, added SitDown transition handlers, fixed LieDown TH related to animations
  • Loading branch information
rayvburn committed Feb 20, 2022
1 parent beb2b30 commit 49b22ee
Showing 1 changed file with 58 additions and 4 deletions.
62 changes: 58 additions & 4 deletions hubero_core/src/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,27 @@ void Actor::executeTaskMoveAround() {

void Actor::executeTaskLieDown() {
auto event = prepareTaskFsmUpdate<EventFsmLieDown>(task_lie_down_ptr_);
event.setLiedDown(animation_control_ptr_->getActiveAnimation() == AnimationType::ANIMATION_LIE_DOWN);
event.setStoodUp(animation_control_ptr_->getActiveAnimation() == AnimationType::ANIMATION_STAND);
event.setLiedDown(
animation_control_ptr_->getActiveAnimation() == AnimationType::ANIMATION_LIE_DOWN
&& animation_control_ptr_->isFinished()
);
event.setStoodUp(
animation_control_ptr_->getActiveAnimation() == AnimationType::ANIMATION_STAND_UP
&& animation_control_ptr_->isFinished()
);
task_lie_down_ptr_->execute(event);
}

void Actor::executeTaskSitDown() {
auto event = prepareTaskFsmUpdate<EventFsmSitDown>(task_sit_down_ptr_);
event.setSatDown(animation_control_ptr_->getActiveAnimation() == AnimationType::ANIMATION_SITTING);
event.setStoodUp(animation_control_ptr_->getActiveAnimation() == AnimationType::ANIMATION_STAND);
event.setSatDown(
animation_control_ptr_->getActiveAnimation() == AnimationType::ANIMATION_SIT_DOWN
&& animation_control_ptr_->isFinished()
);
event.setStoodUp(
animation_control_ptr_->getActiveAnimation() == AnimationType::ANIMATION_STAND_UP
&& animation_control_ptr_->isFinished()
);
task_sit_down_ptr_->execute(event);
}

Expand Down Expand Up @@ -465,9 +477,51 @@ void Actor::addTasksFsmTransitionHandlers() {
TaskLieDown::State::LYING_DOWN,
std::bind(&Actor::thSetupAnimationLieDown, this)
);
task_lie_down_ptr_->addStateTransitionHandler(
TaskLieDown::State::LYING_DOWN,
TaskLieDown::State::LYING,
std::bind(&Actor::thSetupAnimationLying, this)
);
task_lie_down_ptr_->addStateTransitionHandler(
TaskLieDown::State::LYING,
TaskLieDown::State::STANDING_UP,
std::bind(&Actor::thSetupAnimationStandUp, this)
);
task_lie_down_ptr_->addStateTransitionHandler(
TaskLieDown::State::STANDING_UP,
TaskLieDown::State::STANDING,
std::bind(&Actor::thSetupAnimationStand, this)
);

// sit down
task_sit_down_ptr_->addStateTransitionHandler(
TaskSitDown::State::STANDING,
TaskSitDown::State::MOVING_TO_GOAL,
std::bind(&Actor::thSetupNavigation, this)
);
task_sit_down_ptr_->addStateTransitionHandler(
TaskSitDown::State::STANDING,
TaskSitDown::State::MOVING_TO_GOAL,
std::bind(&Actor::thSetupAnimationWalk, this)
);
task_sit_down_ptr_->addStateTransitionHandler(
TaskSitDown::State::MOVING_TO_GOAL,
TaskSitDown::State::SITTING_DOWN,
std::bind(&Actor::thSetupAnimationSitDown, this)
);
task_sit_down_ptr_->addStateTransitionHandler(
TaskSitDown::State::SITTING_DOWN,
TaskSitDown::State::SITTING,
std::bind(&Actor::thSetupAnimationSitting, this)
);
task_sit_down_ptr_->addStateTransitionHandler(
TaskSitDown::State::SITTING,
TaskSitDown::State::STANDING_UP,
std::bind(&Actor::thSetupAnimationStandUp, this)
);
task_sit_down_ptr_->addStateTransitionHandler(
TaskSitDown::State::STANDING_UP,
TaskSitDown::State::STANDING,
std::bind(&Actor::thSetupAnimationStand, this)
);

Expand Down

0 comments on commit 49b22ee

Please sign in to comment.