state.h
Go to the documentation of this file.
1 //=================================================================================================
2 // Copyright (c) 2017, Alexander Stumpf, TU Darmstadt
3 // Based on http://wiki.ros.org/footstep_planner by Johannes Garimort and Armin Hornung
4 // All rights reserved.
5 
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are met:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of the Simulation, Systems Optimization and Robotics
14 // group, TU Darmstadt nor the names of its contributors may be used to
15 // endorse or promote products derived from this software without
16 // specific prior written permission.
17 
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
22 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 //=================================================================================================
29 
30 #ifndef FOOTSTEP_PLANNER_STATE_H__
31 #define FOOTSTEP_PLANNER_STATE_H__
32 
33 #include <geometry_msgs/Pose.h>
34 #include <geometry_msgs/Vector3.h>
35 
36 #include <vigir_footstep_planning_msgs/footstep_planning_msgs.h>
37 
39 
40 
41 
43 {
49 class State
50 {
51 public:
52  State();
53  State(double x, double y, double z, double roll, double pitch, double yaw, Leg leg);
54  State(const geometry_msgs::Vector3& position, double roll, double pitch, double yaw, Leg leg);
55  State(const geometry_msgs::Vector3& position, const geometry_msgs::Vector3& normal, double yaw, Leg leg);
56  State(const geometry_msgs::Pose& pose, Leg leg);
57  State(const tf::Transform& t, Leg leg);
58  State(const msgs::Foot foot);
59  State(const msgs::Step step);
60 
61  ~State();
62 
67  bool operator==(const State& s2) const;
68 
73  bool operator!=(const State& s2) const;
74 
75  void setX(double x) { ivPose.getOrigin().setX(x); }
76  void setY(double y) { ivPose.getOrigin().setY(y); }
77  void setZ(double z) { ivPose.getOrigin().setZ(z); }
78  void setPosition(const geometry_msgs::Point& position);
79  void setRoll(double roll) { setRPY(roll, ivPitch, ivYaw); }
80  void setPitch(double pitch) { setRPY(ivRoll, pitch, ivYaw); }
81  void setYaw(double yaw) { setRPY(ivRoll, ivPitch, yaw); }
82  void setRPY(double roll, double pitch, double yaw);
83  void setOrientation(const geometry_msgs::Quaternion& q);
84  void setNormal(const geometry_msgs::Vector3 &normal);
85  void setNormal(double x, double y, double z);
86  void setSwingHeight(double swing_height) { ivSwingHeight = swing_height; }
87  void setSwayDuration(double sway_duration) { ivSwayDuration = sway_duration; }
88  void setStepDuration(double step_duration) { ivStepDuration = step_duration; }
89  void setSwayDistance(double sway_distance) { this->sway_distance = sway_distance; }
90  void setSwingDistance(double swing_distance) { this->swing_distance = swing_distance; }
91  void setLeg(Leg leg) { ivLeg = leg; }
92  void setGroundContactSupport(double ground_contact_support) { ivGroundContactSupport = ground_contact_support; }
93  void setBodyVelocity(const geometry_msgs::Vector3& body_vel) { this->body_vel = body_vel; }
94  void setCost(double cost) { this->cost = cost; }
95  void setRisk(double risk) { this->risk = risk; }
96 
97  double getX() const { return ivPose.getOrigin().getX(); }
98  double getY() const { return ivPose.getOrigin().getY(); }
99  double getZ() const { return ivPose.getOrigin().getZ(); }
100  double getRoll() const { return ivRoll; }
101  double getPitch() const { return ivPitch; }
102  double getYaw() const { return ivYaw; }
103  const geometry_msgs::Vector3& getNormal() const { return ivNormal; }
104  double getNormalX() const { return ivNormal.x; }
105  double getNormalY() const { return ivNormal.y; }
106  double getNormalZ() const { return ivNormal.z; }
107  double getSwingHeight() const { return ivSwingHeight; }
108  double getSwayDuration() const { return ivSwayDuration; }
109  double getStepDuration() const { return ivStepDuration; }
110  double getSwayDistance() const { return sway_distance; }
111  double getSwingDistance() const { return swing_distance; }
112  Leg getLeg() const { return ivLeg; }
114  const geometry_msgs::Vector3& getBodyVelocity() const { return body_vel; }
115  double getCost() const { return cost; }
116  double getRisk() const { return risk; }
117 
118  const tf::Pose &getPose() const { return ivPose; }
119  tf::Pose &getPose() { return ivPose; }
120  void getFoot(msgs::Foot& foot) const;
121  void getStep(msgs::Step& step) const;
122 
123 private:
124  void recomputeNormal();
125 
127 
130 
132  double ivRoll;
133  double ivPitch;
134  double ivYaw;
136  geometry_msgs::Vector3 ivNormal;
140 
143 
144  geometry_msgs::Vector3 body_vel;
145 
148 
149  double cost;
150  double risk;
151 };
152 }
153 #endif
double getNormalZ() const
Definition: state.h:106
double getSwayDistance() const
Definition: state.h:110
const geometry_msgs::Vector3 & getNormal() const
Definition: state.h:103
void setRisk(double risk)
Definition: state.h:95
double getSwingHeight() const
Definition: state.h:107
void getFoot(msgs::Foot &foot) const
Definition: state.cpp:206
geometry_msgs::Vector3 body_vel
Definition: state.h:144
double getNormalY() const
Definition: state.h:105
TFSIMD_FORCE_INLINE void setX(tfScalar x)
void setOrientation(const geometry_msgs::Quaternion &q)
Definition: state.cpp:146
double getYaw() const
Definition: state.h:102
void getStep(msgs::Step &step) const
Definition: state.cpp:195
void setNormal(const geometry_msgs::Vector3 &normal)
Definition: state.cpp:165
void setPosition(const geometry_msgs::Point &position)
Definition: state.cpp:139
TFSIMD_FORCE_INLINE void setY(tfScalar y)
double getY() const
Definition: state.h:98
void setBodyVelocity(const geometry_msgs::Vector3 &body_vel)
Definition: state.h:93
void setPitch(double pitch)
Definition: state.h:80
TFSIMD_FORCE_INLINE void setZ(tfScalar z)
TFSIMD_FORCE_INLINE const tfScalar & getY() const
double getStepDuration() const
Definition: state.h:109
TFSIMD_FORCE_INLINE const tfScalar & y() const
TFSIMD_FORCE_INLINE const tfScalar & getZ() const
void setY(double y)
Definition: state.h:76
void setRPY(double roll, double pitch, double yaw)
Definition: state.cpp:155
bool operator!=(const State &s2) const
Inequality operator for two states (negates the equality operator).
Definition: state.cpp:134
void setCost(double cost)
Definition: state.h:94
double getGroundContactSupport() const
Definition: state.h:113
void setZ(double z)
Definition: state.h:77
double getPitch() const
Definition: state.h:101
A class representing the robot&#39;s pose (i.e. position and orientation) in the (continuous) world view...
Definition: state.h:49
void setSwingDistance(double swing_distance)
Definition: state.h:90
double getSwingDistance() const
Definition: state.h:111
void setRoll(double roll)
Definition: state.h:79
void setSwayDistance(double sway_distance)
Definition: state.h:89
double getNormalX() const
Definition: state.h:104
double ivRoll
The robot&#39;s orientation.
Definition: state.h:132
Leg ivLeg
The robot&#39;s supporting leg.
Definition: state.h:129
double getRisk() const
Definition: state.h:116
TFSIMD_FORCE_INLINE const tfScalar & x() const
double getX() const
Definition: state.h:97
TFSIMD_FORCE_INLINE Vector3 & getOrigin()
TFSIMD_FORCE_INLINE const tfScalar & z() const
void setSwayDuration(double sway_duration)
Definition: state.h:87
const geometry_msgs::Vector3 & getBodyVelocity() const
Definition: state.h:114
bool operator==(const State &s2) const
Compare two states on equality of x, y, theta, leg upon a certain degree of float precision...
Definition: state.cpp:123
unsigned int step
const tf::Pose & getPose() const
Definition: state.h:118
void setGroundContactSupport(double ground_contact_support)
Definition: state.h:92
geometry_msgs::Vector3 ivNormal
The normal of foot in world.
Definition: state.h:136
double getCost() const
Definition: state.h:115
void setSwingHeight(double swing_height)
Definition: state.h:86
void setStepDuration(double step_duration)
Definition: state.h:88
TFSIMD_FORCE_INLINE const tfScalar & getX() const
double getZ() const
Definition: state.h:99
double ivGroundContactSupport
percentage of ground contact support (0.0 - 1.0 = 100%)
Definition: state.h:142
void setYaw(double yaw)
Definition: state.h:81
double getSwayDuration() const
Definition: state.h:108
double getRoll() const
Definition: state.h:100
void setX(double x)
Definition: state.h:75
void setLeg(Leg leg)
Definition: state.h:91


vigir_footstep_planning_lib
Author(s): Alexander Stumpf
autogenerated on Mon Jun 10 2019 15:47:33