Commit b216c189 authored by Pierre Gergondet's avatar Pierre Gergondet
Browse files

Add some ostream operators for walkgen structures

Not all structures (especially private ones) have an ostream operator because I
did not need them this time, not for any technical reason
parent 61c5f034
......@@ -61,6 +61,16 @@ namespace PatternGeneratorJRL
};
inline std::ostream & operator<<(std::ostream & os, const COMPosition_s & aCp)
{
for(size_t i = 0; i < 3; ++i)
{
os << "x[" << i << "] " << aCp.x[i] << " y[" << i << "] " << aCp.y[i] << " z[" << i << "] " << aCp.z[i] << std::endl;
}
os << "yaw " << aCp.yaw << " pitch " << aCp.pitch << " roll " << aCp.roll;
return os;
}
typedef struct COMPosition_s COMPosition;
typedef struct COMPosition_s WaistState;
......@@ -98,6 +108,13 @@ namespace PatternGeneratorJRL
};
typedef struct RelativeFootPosition_s RelativeFootPosition;
inline std::ostream & operator<<(std::ostream & os, const RelativeFootPosition_s & rfp)
{
os << "sx " << rfp.sx << " sy " << rfp.sy << " theta " << rfp.theta << std::endl;
os << "SStime " << rfp.SStime << " DStime " << rfp.DStime << " stepType " << rfp.stepType << " DeviationHipHeight " << rfp.DeviationHipHeight;
return os;
}
/** Structure to store each of the ZMP value, with a given
direction at a certain time. */
struct ZMPPosition_s
......@@ -112,6 +129,13 @@ namespace PatternGeneratorJRL
};
typedef struct ZMPPosition_s ZMPPosition;
inline std::ostream & operator<<(std::ostream & os, const ZMPPosition_s & zmp)
{
os << "px " << zmp.px << " py " << zmp.pz << " pz " << zmp.pz << " theta " << zmp.theta << std::endl;
os << "time " << zmp.time << " stepType " << zmp.stepType;
return os;
}
/// Structure to store the absolute foot position.
struct FootAbsolutePosition_t
{
......@@ -131,6 +155,15 @@ namespace PatternGeneratorJRL
};
typedef struct FootAbsolutePosition_t FootAbsolutePosition;
inline std::ostream & operator<<(std::ostream & os, const FootAbsolutePosition & fap)
{
os << "x " << fap.x << " y " << fap.y << " z " << fap.z << " theta " << fap.theta << " omega " << fap.omega << " omega2 " << fap.omega2 << std::endl;
os << "dx " << fap.dx << " dy " << fap.dy << " dz " << fap.dz << " dtheta " << fap.dtheta << " domega " << fap.domega << " domega2 " << fap.domega2 << std::endl;
os << "ddx " << fap.ddx << " ddy " << fap.ddy << " ddz " << fap.ddz << " ddtheta " << fap.ddtheta << " ddomega " << fap.ddomega << " ddomega2 " << fap.ddomega2 << std::endl;
os << "time " << fap.time << " stepType " << fap.stepType;
return os;
}
// Linear constraint.
struct LinearConstraintInequality_s
{
......@@ -162,6 +195,13 @@ namespace PatternGeneratorJRL
typedef struct SupportFeet_s
SupportFeet_t;
inline std::ostream & operator<<(std::ostream & os, const SupportFeet_s & sf)
{
os << "x " << sf.x << " y " << sf.y << " theta " << sf.theta << std::endl;
os << " StartTime " << sf.StartTime << " SupportFoot " << sf.SupportFoot;
return os;
}
/// Structure to store the absolute reference.
struct ReferenceAbsoluteVelocity_t
{
......@@ -175,5 +215,11 @@ namespace PatternGeneratorJRL
};
typedef struct ReferenceAbsoluteVelocity_t ReferenceAbsoluteVelocity;
inline std::ostream & operator<<(std::ostream & os, const ReferenceAbsoluteVelocity_t & rav)
{
os << "x " << rav.x << " y " << rav.y << " z " << rav.z << " dYaw " << rav.dYaw;
return os;
}
}
#endif
......@@ -377,4 +377,5 @@ namespace PatternGeneratorJRL
reference_t::frame_t::frame_t(const frame_t & F):
X(F.X), Y(F.X), Yaw(F.Yaw), X_vec(F.X_vec), Y_vec(F.Y_vec), Yaw_vec(F.Yaw_vec)
{}
}
......@@ -49,11 +49,37 @@ namespace PatternGeneratorJRL
LEFT, RIGHT
};
inline std::ostream & operator<<(std::ostream & out, const foot_type_e & ft)
{
switch(ft)
{
case LEFT:
out << "LEFT";
break;
default:
out << "RIGHT";
}
return out;
}
enum PhaseType
{
SS, DS
};
inline std::ostream & operator<<(std::ostream & out, const PhaseType & pt)
{
switch(pt)
{
case SS:
out << "SingleSupport";
break;
default:
out << "DoubleSupport";
}
return out;
}
enum ineq_e
{
INEQ_COP, INEQ_COM, INEQ_FEET
......@@ -169,6 +195,13 @@ namespace PatternGeneratorJRL
reference_t(const reference_t &);
};
inline std::ostream & operator<<(std::ostream & out, const reference_t & Ref)
{
out << "Global: (" << Ref.Global.X << ", " << Ref.Global.Y << ", " << Ref.Global.Yaw << ")" << std::endl;
out << "Local: (" << Ref.Local.X << ", " << Ref.Local.Y << ", " << Ref.Local.Yaw << ")";
return out;
}
/// \brief Convex hull
struct convex_hull_t
{
......@@ -286,6 +319,23 @@ namespace PatternGeneratorJRL
support_state_t();
};
inline std::ostream & operator<<(std::ostream & out, const support_state_t & st)
{
out << "SupportState" << std::endl;
out << "PhaseType " << st.Phase << std::endl;
out << "Foot " << st.Foot << std::endl;
out << "NbStepsLeft " << st.NbStepsLeft << std::endl;
out << "StepNumber " << st.StepNumber << std::endl;
out << "NbInstants " << st.NbInstants << std::endl;
out << "TimeLimit " << st.TimeLimit << std::endl;
out << "StartTime " << st.StartTime << std::endl;
out << "X " << st.X << std::endl;
out << "Y " << st.Y << std::endl;
out << "Yaw " << st.Yaw << std::endl;
out << "StateChanged " << st.StateChanged;
return out;
}
/// \brief Solution
struct solution_t
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment