Main Page · Modules · All Classes · Class Hierarchy
MALeg.hpp
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 #pragma once
23 
24 #include "core/MANum.hpp"
25 #include "MARobotStateUpdater.hpp"
26 
27 #include <MCTypes.hpp>
28 
34 namespace MA
35 {
37 typedef enum
38 {
39  LegJoint1 = 0,
40  LegJoint2,
41  LegJoint3,
42 } LegJointsType;
43 
44 namespace Leg
45 {
47 typedef enum
48 {
49  LF = 0,
50  LH,
51  RF,
52  RH,
53 } LegTypes;
54 
55 extern const MC::StringList LegTypeStrs;
56 }
57 
59 typedef enum
60 {
61  ForBackward = 0,
62  UpDownward,
63  Sidelong,
64  BentStretched,
65 } LegMovingType;
66 }
67 
71 struct MALeg : public MARobotStateUpdater
72 {
74  MALeg();
75 
76  bool IsOnLeftSide() const;
77  bool IsOnRightSide() const;
78  bool IsOnFrontSide() const;
79  bool IsOnHindSide() const;
80  bool IsBackwardNearBody() const;
81  bool IsForwardNearBody() const;
82 
83 private:
84  virtual void UpdateRobotState(MARobotState& state) override;
85 
86  void GenerateLegStopped(int cycle_time);
87 
88 public:
90  MA::Leg::LegTypes Type;
105  /*
106  * Number of joints powered on
107  * 0 - Off 1..3 - Number of joints switched on
108  */
109  MANum<int> PoweredJoints;
110  /*
111  * Forward-backward direction
112  * -100 - backward 100 - forward
113  */
114  MANum<int> ForeBack;
115  /*
116  * Upward-downward direction
117  * -100 - downward 100 - upward
118  */
119  MANum<int> UpDown;
120  /*
121  * Sidelong direction
122  * 0 - least 100 - full
123  */
124  MANum<int> Sidelong;
125  /*
126  * Bent-stretched state
127  * 0 - full stretched 100 - full bent
128  */
129  MANum<int> BentStretched;
130  /*
131  * The leg is stopped
132  * 0 - Not stopped 100 - Stopped
133  */
134  MANum<int> Stopped;
135  /*
136  * The leg is overloaded
137  * 0 - Not overloaded 1 - Overloaded
138  */
139  MANum<int> Overloaded;
140  /*
141  * The leg is moving
142  * 0 - Not moving 1 - Moving
143  */
144  MANum<int> Moving;
145  /*
146  * The leg is in motion
147  * 0 - Not moved 1 - In motion
148  */
149  MANum<int> InMotion;
150  /*
151  * The leg is being in lying position
152  * 0 - Not lying position 1 - Lying position
153  */
154  MANum<int> IsLyingPosition;
155  /*
156  * The leg is being in standing position
157  * 0 - Not standing position 1 - Standing position
158  */
159  MANum<int> IsStandingPosition;
160  /*
161  * The leg is being in sitting position
162  * 0 - Not sitting position 1 - Sitting position
163  */
164  MANum<int> IsSittingPosition;
165 private:
166  MAIntervalNum<int> StoppedFactor;
167 };
168 
MANum< int > Force2
Joint2 force.
Definition: MALeg.hpp:100
MA::Leg::LegTypes Type
The leg type.
Definition: MALeg.hpp:90
MANum< int > Joint1
Joint1.
Definition: MALeg.hpp:94
MANum< int > Force1
Joint1 force.
Definition: MALeg.hpp:96
Robot state updater base class.
MANum< int > Joint2
Joint2.
Definition: MALeg.hpp:98
A leg class.
Definition: MALeg.hpp:71
MANum< int > Joint3
Joint3.
Definition: MALeg.hpp:102
Robot state.
MANum< int > Force3
Joint3 force.
Definition: MALeg.hpp:104
MANum< int > Paw
Paw button.
Definition: MALeg.hpp:92