Main Page · Modules · All Classes · Class Hierarchy
MABodyAdjustStandingPosture.cpp
1 /*
2  * This file is part of the AiBO+ project
3  *
4  * Copyright (C) 2005-2016 Csaba Kertész (csaba.kertesz@gmail.com)
5  *
6  * AiBO+ is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * AiBO+ is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #include "MABodyAdjustStandingPosture.hpp"
23 
24 #include "types/MAComplexIndicators.hpp"
25 #include "types/MAGoals.hpp"
26 #include "types/MARobotState.hpp"
27 #include "controllers/MALegController.hpp"
28 
29 #include "MABodyStateMaster.hpp"
30 
31 MABodyAdjustStandingPosture::MABodyAdjustStandingPosture() : MABehavior(MCGetClassName(this))
32 {
33  DesiredConnections[MCGetClassName<MABodyStateMaster>()] = -1.0;
34 }
35 
36 
38 {
40 }
41 
42 
44 {
45  StartTransition(*MA::LegLF, MA::LegLF->AdjustStandingPostureStr);
46  StartTransition(*MA::LegLH, MA::LegLH->AdjustStandingPostureStr);
47  StartTransition(*MA::LegRF, MA::LegRF->AdjustStandingPostureStr);
48  StartTransition(*MA::LegRH, MA::LegRH->AdjustStandingPostureStr);
49 }
50 
51 
53 {
54  // Reset the left/right turn and walk durations here because the movement is finished when the
55  // dog is back in standing position
56  MA::RobotState->ComplexIndicators->ElapsedRightTurnTime = 0;
57  MA::RobotState->Goals->DesiredRightTurnDuration = 0;
58  MA::RobotState->ComplexIndicators->ElapsedLeftTurnTime = 0;
59  MA::RobotState->Goals->DesiredLeftTurnDuration = 0;
60  MA::RobotState->ComplexIndicators->ElapsedBackwardWalkTime = 0;
61  MA::RobotState->Goals->DesiredBackwardWalkDuration = 0;
62  MA::RobotState->ComplexIndicators->ElapsedForwardWalkTime = 0;
63  MA::RobotState->Goals->DesiredForwardWalkDuration = 0;
64 }
MA::DesiredConnectionMap DesiredConnections
Desired connection map to other behaviors.
Definition: MABehavior.hpp:766
Behavior base class.
Definition: MABehavior.hpp:157
std::string MCGetClassName(T *instance=nullptr, const std::string &name_suffix="")
Get a class name.
Definition: MCDefs.hpp:627
virtual MABehavior::StimulusLevelType GetCurrentStimulus() override
Get the current behavior stimulus.
void StartTransition(MAController &controller, const std::string &transition_name)
Start a transition.
Definition: MABehavior.cpp:793
virtual void FinishingActions() override
Perform actions when the behavior is being finished.
virtual void ActivatingActions() override
Perform actions when the behavior is being activated.