10 #include <cap_gait/cap_gait_config.h>
11 #include <cap_gait/cap_com_filter.h>
14 #include <gait/gait_common.h>
15 #include <gait/gait_engine.h>
16 #include <gait/util/gait_joint_pose.h>
17 #include <gait/util/gait_inverse_pose.h>
18 #include <gait/util/gait_abstract_pose.h>
21 #include <plot_msgs/plot_manager.h>
22 #include <rc_utils/ew_integrator.h>
23 #include <rc_utils/mean_filter.h>
24 #include <rc_utils/wlbf_filter.h>
30 #include <cap_gait/contrib/RobotModel.h>
31 #include <cap_gait/contrib/RobotModelVis.h>
32 #include <cap_gait/contrib/LimpModel.h>
33 #include <cap_gait/contrib/Limp.h>
34 #include <cap_gait/contrib/ComFilter.h>
68 virtual void setOdometry(
double posX,
double posY,
double rotZ);
82 struct CommonMotionData
96 , doubleSupportPhase(0.1)
97 , swingStartPhase(0.0)
98 , swingStopPhase(M_PI)
99 , suppTransStartPhase(0.0)
100 , suppTransStopPhase(doubleSupportPhase)
101 , liftingPhaseLen(M_PI - doubleSupportPhase)
102 , suppPhaseLen(M_PI + doubleSupportPhase)
103 , nonSuppPhaseLen(M_2PI - suppPhaseLen)
104 , sinusoidPhaseLen(M_PI)
105 , linearPhaseLen(M_PI)
124 double doubleSupportPhase;
125 double swingStartPhase;
126 double swingStopPhase;
127 double suppTransStartPhase;
128 double suppTransStopPhase;
131 double liftingPhaseLen;
133 double nonSuppPhaseLen;
134 double sinusoidPhaseLen;
135 double linearPhaseLen;
146 void resetWalking(
bool walking,
const Eigen::Vector3d& gcvBias);
149 void processInputs();
150 void updateRobot(
const Eigen::Vector3d& gcvBias);
153 CommonMotionData calcCommonMotionData(
bool isFirst)
const;
166 void updateOutputs();
169 void resetBlending(
double b = USE_HALT_POSE);
170 void setBlendTarget(
double target,
double phaseTime);
171 double blendFactor();
174 void resetMotionStance();
181 const std::string CONFIG_PARAM_PATH;
182 static const double USE_HALT_POSE = 1.0;
183 static const double USE_CALC_POSE = 0.0;
197 Eigen::Vector3d m_gcv;
198 Eigen::Vector3d m_gcvInput;
199 rc_utils::GolayDerivative<Eigen::Vector3d, 1, 5, Eigen::aligned_allocator<Eigen::Vector3d> > m_gcvDeriv;
200 rc_utils::MeanFilter m_gcvAccSmoothX;
201 rc_utils::MeanFilter m_gcvAccSmoothY;
202 rc_utils::MeanFilter m_gcvAccSmoothZ;
203 Eigen::Vector3d m_gcvAcc;
219 double m_blendEndPhase;
222 double m_motionLegAngleXFact;
229 rc_utils::MeanFilter fusedXFeedFilter;
230 rc_utils::MeanFilter fusedYFeedFilter;
231 rc_utils::WLBFFilter dFusedXFeedFilter;
232 rc_utils::WLBFFilter dFusedYFeedFilter;
233 rc_utils::MeanFilter iFusedXFeedFilter;
234 rc_utils::MeanFilter iFusedYFeedFilter;
235 rc_utils::WLBFFilter gyroXFeedFilter;
236 rc_utils::WLBFFilter gyroYFeedFilter;
239 rc_utils::EWIntegrator iFusedXFeedIntegrator;
240 rc_utils::EWIntegrator iFusedYFeedIntegrator;
241 config_server::Parameter<bool> m_resetIntegrators;
242 config_server::Parameter<bool> m_saveIFeedToHaltPose;
243 bool m_savedLegIFeed;
244 bool m_savedArmIFeed;
245 double iFusedXLastTime;
246 double iFusedYLastTime;
247 bool haveIFusedXFeed;
248 bool haveIFusedYFeed;
251 void resetIntegrators();
252 void resetSaveIntegrals();
255 void resizeFusedFilters (
int numPoints) {
if(numPoints < 1) numPoints = 1; fusedXFeedFilter.resize(numPoints); fusedYFeedFilter.resize(numPoints); }
256 void resizeDFusedFilters(
int numPoints) {
if(numPoints < 1) numPoints = 1; dFusedXFeedFilter.resize(numPoints); dFusedYFeedFilter.resize(numPoints); }
257 void resizeIFusedFilters(
int numPoints) {
if(numPoints < 1) numPoints = 1; iFusedXFeedFilter.resize(numPoints); iFusedYFeedFilter.resize(numPoints); }
258 void resizeGyroFilters (
int numPoints) {
if(numPoints < 1) numPoints = 1; gyroXFeedFilter.resize(numPoints); gyroYFeedFilter.resize(numPoints); }
275 void resetCaptureSteps(
bool resetRobotModel);
278 margait_contrib::RobotModel rxRobotModel;
280 config_server::Parameter<bool> m_showRxVis;
281 void callbackShowRxVis();
284 margait_contrib::LimpModel rxModel;
285 margait_contrib::LimpModel mxModel;
286 margait_contrib::LimpModel txModel;
289 margait_contrib::Limp limp;
295 config_server::Parameter<float> m_gcvZeroTime;
296 margait_contrib::Vec2f adaptation;
297 double lastSupportOrientation;
298 double oldGcvTargetY;
300 double stepTimeCount;
301 double lastStepDuration;
303 int noCLStepsCounter;
318 config_server::Parameter<bool> m_plotData;
319 plot_msgs::PlotManagerFS m_PM;
320 void configurePlotManager();
321 void callbackPlotData();
329 PM_GCV_ACC_X = PM_GCV_ACC,
335 PM_HALT_BLEND_FACTOR,
338 PM_LEG_SWING_ANGLE_R,
339 PM_LEG_SWING_ANGLE_L,
346 PM_LEG_LAT_HIP_SWING_R,
347 PM_LEG_LAT_HIP_SWING_L,
352 PM_LEG_FEED_HIPANGLEX_R,
353 PM_LEG_FEED_HIPANGLEX_L,
354 PM_LEG_FEED_HIPANGLEY_R,
355 PM_LEG_FEED_HIPANGLEY_L,
356 PM_LEG_FEED_FOOTANGLEX_R,
357 PM_LEG_FEED_FOOTANGLEX_L,
358 PM_LEG_FEED_FOOTANGLEY_R,
359 PM_LEG_FEED_FOOTANGLEY_L,
360 PM_LEG_FEED_FOOTANGLECX_R,
361 PM_LEG_FEED_FOOTANGLECX_L,
362 PM_LEG_FEED_FOOTANGLECY_R,
363 PM_LEG_FEED_FOOTANGLECY_L,
366 PM_LEG_ABS_LEGANGLEX_R,
367 PM_LEG_ABS_LEGANGLEX_L,
368 PM_LEG_ABS_LEGANGLEY_R,
369 PM_LEG_ABS_LEGANGLEY_L,
370 PM_LEG_ABS_LEGANGLEZ_R,
371 PM_LEG_ABS_LEGANGLEZ_L,
372 PM_LEG_ABS_FOOTANGLEX_R,
373 PM_LEG_ABS_FOOTANGLEX_L,
374 PM_LEG_ABS_FOOTANGLEY_R,
375 PM_LEG_ABS_FOOTANGLEY_L,
376 PM_LEG_FEED_COMSHIFTX_R,
377 PM_LEG_FEED_COMSHIFTX_L,
378 PM_LEG_FEED_COMSHIFTY_R,
379 PM_LEG_FEED_COMSHIFTY_L,
380 PM_LEG_VIRTUAL_SLOPE_R,
381 PM_LEG_VIRTUAL_SLOPE_L,
382 PM_LEG_VIRTUAL_COMP_R,
383 PM_LEG_VIRTUAL_COMP_L,
384 PM_ARM_SWING_ANGLE_R,
385 PM_ARM_SWING_ANGLE_L,
388 PM_ARM_FEED_ARMANGLEX_R,
389 PM_ARM_FEED_ARMANGLEX_L,
390 PM_ARM_FEED_ARMANGLEY_R,
391 PM_ARM_FEED_ARMANGLEY_L,
394 PM_ARM_ABS_ARMANGLEX_R,
395 PM_ARM_ABS_ARMANGLEX_L,
396 PM_ARM_ABS_ARMANGLEY_R,
397 PM_ARM_ABS_ARMANGLEY_L,
398 PM_RXRMODEL_SUPPVEC_X,
399 PM_RXRMODEL_SUPPVEC_Y,
400 PM_RXRMODEL_SUPPVEC_Z,
401 PM_RXRMODEL_STEPVEC_X,
402 PM_RXRMODEL_STEPVEC_Y,
403 PM_RXRMODEL_STEPVEC_Z,
404 PM_RXRMODEL_STEPVEC_FYAW,
416 PM_RXMODEL_TIMETOSTEP,
422 PM_MXMODEL_TIMETOSTEP,
430 PM_TXMODEL_TIMETOSTEP,
431 PM_TXMODEL_STEPSIZEX,
432 PM_TXMODEL_STEPSIZEY,
433 PM_TXMODEL_STEPSIZEZ,
442 PM_FEEDBACK_DFUSED_X,
443 PM_FEEDBACK_DFUSED_Y,
444 PM_FEEDBACK_IFUSED_X,
445 PM_FEEDBACK_IFUSED_Y,
448 PM_TIMING_FEED_WEIGHT,
449 PM_TIMING_FREQ_DELTA,
459 PM_LAST_STEP_DURATION,
Base implementation of a gait engine, made to work with the Gait motion module.
Definition: gait_engine.h:30
A capture step gait, implemented as a GaitEngine plugin for the Gait motion module.
Definition: cap_gait.h:48
virtual void setOdometry(double posX, double posY, double rotZ)
Set the CoM odometry to a particular 2D position and orientation.
Definition: cap_gait.cpp:238
virtual void step()
Main step function of the gait engine.
Definition: cap_gait.cpp:269
Data struct that encompasses the joint representation of a robot pose.
Definition: gait_joint_pose.h:242
virtual void updateHaltPose()
Update the halt pose desired by the gait engine.
Definition: cap_gait.cpp:979
Data struct that encompasses the abstract representation of an arm pose.
Definition: gait_abstract_pose.h:136
CapGait()
Default constructor.
Definition: cap_gait.cpp:33
Encapsulates a visualisation of the state of a RobotModel object.
Definition: RobotModelVis.h:29
virtual void handleJoystickButton(int button)
Notify the gait engine that a particular joystick button has been pressed and released by the user...
Definition: cap_gait.cpp:262
Configuration struct for the capture step gait.
Definition: cap_gait_config.h:21
Data struct that encompasses the inverse representation of a robot pose.
Definition: gait_inverse_pose.h:188
virtual void updateOdometry()
Force an update of the CoM odometry in terms of 3D position and orientation.
Definition: cap_gait.cpp:245
Data struct that encompasses the abstract representation of a robot pose.
Definition: gait_abstract_pose.h:214
Data struct that encompasses the abstract representation of a leg pose.
Definition: gait_abstract_pose.h:35
virtual void reset()
Reset the gait engine.
Definition: cap_gait.cpp:84
Data struct that encompasses the inverse representation of a leg pose.
Definition: gait_inverse_pose.h:36