Tetrapod Project
robot_controller.cpp
Go to the documentation of this file.
2 
3 RobotController::RobotController(int _controller_freq, double _gait_period) : RobotController::Controller(_controller_freq)
4 {
5  this->gait_duration = _gait_period;
6 
7  stance_period = 0.5 * _gait_period * stance_phase_duration_percentage;
8 
9  swing_period = 0.5 * (1.0 - stance_phase_duration_percentage) * _gait_period;
10 
12 
14 
15  this->final_iteration = this->stance_iterations;
16 
17  this->base_pose_commands(2) = hip_height;
18 
19  //double number_of_gait_iterations = _gait_period * _controller_freq;
20 
21  //this->_lin_body_vel_x_history.resize(number_of_gait_iterations, 0.0);
22 
23  //this->_lin_body_vel_y_history.resize(number_of_gait_iterations, 0.0);
24 
25  //this->_ang_body_vel_z_history.resize(number_of_gait_iterations, 0.0);
26 }
27 
28 /*
29 void RobotController::UpdateFeetReferences()
30 {
31  if(this->super_state == SuperState::kIdle)
32  {
33  UpdateFeetReferencesPoseControl();
34  }
35  else if(this->super_state == SuperState::kMoving)
36  {
37  UpdateFeetReferencesGaitControl();
38  }
39 }
40 */
41 
43 {
44  double step_duration = 2.0 * stance_period + swing_period;
45 
46  this->step_distance_x_linear = step_duration*_lin_vel_x_command;
47 
48  this->step_distance_y_linear = step_duration*_lin_vel_y_command;
49 
50  Eigen::Matrix<double, 3, 1> base_to_hip_distance; // = kinematics.GetDistanceFromBaseToFrontLeftHipInB();
51 
52  double rotation_radius = sqrt(2*LEG_OFFSET_LENGTH*LEG_OFFSET_LENGTH)
53  + sqrt(base_to_hip_distance(0)*base_to_hip_distance(0) + base_to_hip_distance(1)*base_to_hip_distance(1));
54 
55  double step_distance_rotation = _ang_vel_z_command*rotation_radius*step_duration;
56 
57  this->step_distance_x_rotational = step_distance_rotation/sqrt(2.0);
58 
59  this->step_distance_y_rotational = step_distance_rotation/sqrt(2.0);
60 }
61 
63 {
64  if(this->iteration == this->final_iteration - 1)
65  {
66 
67  iteration = 0;
68 
69  switch (this->motion_state)
70  {
71  case MotionState::kStancePreSwingFlRr:
72  {
73  this->motion_state = MotionState::kSwingFlRr;
74  this->final_iteration = this->swing_iterations;
75  break;
76  }
77  case MotionState::kSwingFlRr:
78  {
79  this->motion_state = MotionState::kStancePreSwingFrRl;
80  this->final_iteration = this->stance_iterations;
81  break;
82  }
83  case MotionState::kStancePreSwingFrRl:
84  {
85  this->motion_state = MotionState::kSwingFrRl;
86  this->final_iteration = this->swing_iterations;
87  break;
88  }
89  case MotionState::kSwingFrRl:
90  {
91  this->motion_state = MotionState::kStancePreSwingFlRr;
92  this->final_iteration = this->stance_iterations;
93  break;
94  }
95  default:
96  break;
97  }
98 
99  return true;
100  }
101  else
102  {
103  iteration++;
104 
105  return false;
106  }
107 }
108 
110 {
111  switch (this->motion_state)
112  {
113  case MotionState::kStancePreSwingFlRr:
114  {
115  this->fl_position_body = this->UpdateStanceFootPosition(Kinematics::LegType::frontLeft, double(iteration + stance_iterations + swing_iterations)/double(swing_iterations + 2*stance_iterations));
116  this->rr_position_body = this->UpdateStanceFootPosition(Kinematics::LegType::rearRight, double(iteration + stance_iterations + swing_iterations)/double(swing_iterations + 2*stance_iterations));
117 
118  this->fr_position_body = this->UpdateStanceFootPosition(Kinematics::LegType::frontRight, double(iteration)/double(swing_iterations + 2*stance_iterations));
119  this->rl_position_body = this->UpdateStanceFootPosition(Kinematics::LegType::rearLeft, double(iteration)/double(swing_iterations + 2*stance_iterations));
120 
121  break;
122  }
123  case MotionState::kSwingFlRr:
124  {
125  this->fr_position_body = this->UpdateStanceFootPosition(Kinematics::LegType::frontRight, double(iteration + stance_iterations)/double(2*stance_iterations + swing_iterations));
126  this->rl_position_body = this->UpdateStanceFootPosition(Kinematics::LegType::rearLeft, double(iteration + stance_iterations)/double(2*stance_iterations + swing_iterations));
127 
128  this->fl_position_body = this->UpdateSwingFootPosition(Kinematics::LegType::frontLeft, double(iteration)/double(swing_iterations));
129  this->rr_position_body = this->UpdateSwingFootPosition(Kinematics::LegType::rearRight, double(iteration)/double(swing_iterations));
130  // Swing
131  break;
132  }
133  case MotionState::kStancePreSwingFrRl:
134  {
135  this->fl_position_body = this->UpdateStanceFootPosition(Kinematics::LegType::frontLeft, double(iteration)/double(swing_iterations + 2*stance_iterations));
136  this->rr_position_body = this->UpdateStanceFootPosition(Kinematics::LegType::rearRight, double(iteration)/double(swing_iterations + 2*stance_iterations));
137 
138  this->fr_position_body = this->UpdateStanceFootPosition(Kinematics::LegType::frontRight, double(iteration + stance_iterations + swing_iterations)/double(swing_iterations + 2*stance_iterations));
139  this->rl_position_body = this->UpdateStanceFootPosition(Kinematics::LegType::rearLeft, double(iteration + stance_iterations + swing_iterations)/double(swing_iterations + 2*stance_iterations));
140  break;
141  }
142  case MotionState::kSwingFrRl:
143  {
144  this->fl_position_body = this->UpdateStanceFootPosition(Kinematics::LegType::frontLeft, double(iteration + stance_iterations)/double(2*stance_iterations + swing_iterations));
145  this->rr_position_body = this->UpdateStanceFootPosition(Kinematics::LegType::rearRight, double(iteration + stance_iterations)/double(2*stance_iterations + swing_iterations));
146 
147  this->fr_position_body = this->UpdateSwingFootPosition(Kinematics::LegType::frontRight, double(iteration)/double(swing_iterations));
148  this->rl_position_body = this->UpdateSwingFootPosition(Kinematics::LegType::rearLeft, double(iteration)/double(swing_iterations));
149  // Swing
150  break;
151  }
152  default:
153  break;
154  }
155 }
156 
158 {
159 
160  switch (this->motion_state)
161  {
162  case MotionState::kStancePreSwingFlRr:
163  {
164  double fl_rr_progress = double(iteration + swing_iterations + stance_iterations)/double(swing_iterations + 2 * stance_iterations);
165  double fr_rl_progress = double(iteration)/double(swing_iterations + 2 * stance_iterations);
166 
167  this->UpdateStanceFootPosition(Kinematics::LegType::frontLeft, fl_rr_progress);
168  this->UpdateStanceFootPosition(Kinematics::LegType::rearRight, fl_rr_progress);
169 
170  this->UpdateStanceFootPosition(Kinematics::LegType::frontRight, fr_rl_progress);
171  this->UpdateStanceFootPosition(Kinematics::LegType::rearLeft, fr_rl_progress);
172 
173  break;
174  }
175  case MotionState::kSwingFlRr:
176  {
177  double fl_rr_progress = double(iteration)/double(swing_iterations);
178  double fr_rl_progress = double(iteration + stance_iterations)/double(swing_iterations + 2 * stance_iterations);
179 
180  this->UpdateSwingFootTrajectory(Kinematics::LegType::frontLeft, fl_rr_progress);
181  this->UpdateSwingFootTrajectory(Kinematics::LegType::rearRight, fl_rr_progress);
182 
183  this->UpdateStanceFootPosition(Kinematics::LegType::frontRight, fr_rl_progress);
184  this->UpdateStanceFootPosition(Kinematics::LegType::rearLeft, fr_rl_progress);
185 
186  break;
187  }
188  case MotionState::kStancePreSwingFrRl:
189  {
190  double fl_rr_progress = double(iteration)/double(swing_iterations + 2 * stance_iterations);
191  double fr_rl_progress = double(iteration + swing_iterations + stance_iterations)/double(swing_iterations + 2 * stance_iterations);
192 
193  this->UpdateStanceFootPosition(Kinematics::LegType::frontLeft, fl_rr_progress);
194  this->UpdateStanceFootPosition(Kinematics::LegType::rearRight, fl_rr_progress);
195 
196  this->UpdateStanceFootPosition(Kinematics::LegType::frontRight, fr_rl_progress);
197  this->UpdateStanceFootPosition(Kinematics::LegType::rearLeft, fr_rl_progress);
198  break;
199  }
200  case MotionState::kSwingFrRl:
201  {
202  double fl_rr_progress = double(stance_iterations + iteration)/double(swing_iterations + 2 * stance_iterations);
203  double fr_rl_progress = double(iteration)/double(swing_iterations);
204 
205  this->UpdateStanceFootPosition(Kinematics::LegType::frontLeft, fl_rr_progress);
206  this->UpdateStanceFootPosition(Kinematics::LegType::rearRight, fl_rr_progress);
207 
208  this->UpdateSwingFootTrajectory(Kinematics::LegType::frontRight, fr_rl_progress);
209  this->UpdateSwingFootTrajectory(Kinematics::LegType::rearLeft, fr_rl_progress);
210 
211  break;
212  }
213  default:
214  break;
215  }
216 }
217 
218 
219 Eigen::Matrix<double, 3, 1> RobotController::UpdateStanceFootPosition(Kinematics::LegType _leg_type, double _progress)
220 {
221  Eigen::Matrix<double, 3, 1> foot_pos;
222 
223  foot_pos(0) = (_progress - 0.5)*(- step_distance_x_linear);
224  foot_pos(1) = (_progress - 0.5)*(- step_distance_y_linear);
225  foot_pos(2) = - hip_height;
226 
227  double ground_period = swing_period + 2.0 * stance_period;
228 
229  switch (_leg_type)
230  {
231  case Kinematics::LegType::frontLeft:
232  {
233  foot_pos(0) += (_progress - 0.5)*step_distance_x_rotational;
234  foot_pos(1) -= (_progress - 0.5)*step_distance_y_rotational;
235 
236  foot_pos += fl_offset;
237 
238  this->fl_position_body = foot_pos;
239 
242  this->fl_velocity_body(2) = 0.0;
243 
244  this->fl_acceleration_body = Eigen::Matrix<double, 3, 1>::Zero();
245 
246  break;
247  }
248  case Kinematics::LegType::frontRight:
249  {
250  foot_pos(0) -= (_progress - 0.5)*step_distance_x_rotational;
251  foot_pos(1) -= (_progress - 0.5)*step_distance_y_rotational;
252 
253  foot_pos += fr_offset;
254 
255  this->fr_position_body = foot_pos;
256 
259  this->fr_velocity_body(2) = 0.0;
260 
261  this->fr_acceleration_body = Eigen::Matrix<double, 3, 1>::Zero();
262 
263  break;
264  }
265  case Kinematics::LegType::rearLeft:
266  {
267  foot_pos(0) += (_progress - 0.5)*step_distance_x_rotational;
268  foot_pos(1) += (_progress - 0.5)*step_distance_y_rotational;
269 
270  foot_pos += rl_offset;
271 
272  this->rl_position_body = foot_pos;
273 
276  this->rl_velocity_body(2) = 0.0;
277 
278  this->rl_acceleration_body = Eigen::Matrix<double, 3, 1>::Zero();
279 
280  break;
281  }
282  case Kinematics::LegType::rearRight:
283  {
284  foot_pos(0) -= (_progress - 0.5)*step_distance_x_rotational;
285  foot_pos(1) += (_progress - 0.5)*step_distance_y_rotational;
286 
287  foot_pos += rr_offset;
288 
289  this->rr_position_body = foot_pos;
290 
293  this->rr_velocity_body(2) = 0.0;
294 
295  this->rr_acceleration_body = Eigen::Matrix<double, 3, 1>::Zero();
296 
297  break;
298  }
299  default:
300  ROS_WARN("RobotController::UpdateStanceFootPosition - Invalid leg type selected");
301  break;
302  }
303 
304  return foot_pos;
305 }
306 
307 Eigen::Matrix<double, 3, 1> RobotController::UpdateSwingFootPosition(Kinematics::LegType _leg_type, double _progress)
308 {
309  Eigen::Matrix<double, 3, 1> foot_pos;
310 
311  foot_pos(0) = (_progress - 0.5)*step_distance_x_linear;
312  foot_pos(1) = (_progress - 0.5)*step_distance_y_linear;
313  foot_pos(2) = -0.28; // Temp
314 
315  switch (_leg_type)
316  {
317  case Kinematics::LegType::frontLeft:
318  {
319  //ROS_WARN("FL Progress: %f\tSDX: %f", _progress, foot_pos(0));
320  foot_pos(0) -= (_progress - 0.5)*step_distance_x_rotational;
321  foot_pos(1) += (_progress - 0.5)*step_distance_y_rotational;
322 
323  foot_pos += fl_offset;
324  break;
325  }
326  case Kinematics::LegType::frontRight:
327  {
328  foot_pos(0) += (_progress - 0.5)*step_distance_x_rotational;
329  foot_pos(1) += (_progress - 0.5)*step_distance_y_rotational;
330 
331  foot_pos += fr_offset;
332  break;
333  }
334  case Kinematics::LegType::rearLeft:
335  {
336  foot_pos(0) -= (_progress - 0.5)*step_distance_x_rotational;
337  foot_pos(1) -= (_progress - 0.5)*step_distance_y_rotational;
338 
339  foot_pos += rl_offset;
340  break;
341  }
342  case Kinematics::LegType::rearRight:
343  {
344  //ROS_WARN("RR Progress: %f\tSDX: %f", _progress, foot_pos(0));
345  foot_pos(0) += (_progress - 0.5)*step_distance_x_rotational;
346  foot_pos(1) -= (_progress - 0.5)*step_distance_y_rotational;
347 
348  foot_pos += rr_offset;
349  break;
350  }
351  default:
352  ROS_WARN("RobotController::UpdateSwingFootPosition - Invalid leg type selected");
353  break;
354  }
355 
356  return foot_pos;
357 }
358 
360 {
361  double swing_time = progress * swing_period;
362 
363  double center_percentage = progress - 0.5;
364 
365  Eigen::Matrix<double, 3, 1> foot_default;
366  Eigen::Matrix<double, 3, 1> foot_pos;
367  Eigen::Matrix<double, 3, 1> foot_vel;
368  Eigen::Matrix<double, 3, 1> foot_acc;
369  Eigen::Matrix<double, 3, 1> foot_jerk;
370 
371  //ROS_INFO("Swing Time: %f, Swing Period: %f, Stance Period: %f, Progress: %f", swing_time, swing_period, stance_period, progress);
372 
373  switch (_leg_type)
374  {
375  case Kinematics::LegType::frontLeft:
376  {
377  //ROS_INFO("SW-FL");
378  double foot_step_distance_x = step_distance_x_linear - step_distance_x_rotational;
379  double foot_step_distance_y = step_distance_y_linear + step_distance_y_rotational;
380 
381  double foot_velocity_x = foot_step_distance_x/(swing_period + 2.0 * stance_period);
382  double foot_velocity_y = foot_step_distance_y/(swing_period + 2.0 * stance_period);
383 
384  CalculatePolynomialTrajectory(swing_time, swing_period, swing_rise_percentage, foot_step_distance_x, foot_velocity_x, foot_pos(0), foot_vel(0), foot_acc(0), foot_jerk(0));
385  CalculatePolynomialTrajectory(swing_time, swing_period, swing_rise_percentage, foot_step_distance_y, foot_velocity_y, foot_pos(1), foot_vel(1), foot_acc(1), foot_jerk(1));
386  CalculateFourthOrderPolynomialTrajectory(swing_time, swing_period, max_step_height, foot_pos(2), foot_vel(2), foot_acc(2));
387 
388  fl_position_body(0) = fl_offset(0) + foot_pos(0) - foot_step_distance_x / 2.0;
389  fl_position_body(1) = fl_offset(1) + foot_pos(1) - foot_step_distance_y / 2.0;
390  fl_position_body(2) = - hip_height + foot_pos(2);
391 
392  fl_velocity_body = foot_vel;
393 
394  fl_acceleration_body = foot_acc;
395 
396  //ROS_INFO("FSDX: %f, FVX: %f", foot_step_distance_x, foot_velocity_x);
397  //ROS_INFO("FL_OFFSET_X: %f, CP: %f, FPX: %f", fl_offset(0), center_percentage, foot_pos_x);
398  //ROS_INFO("FLPX: %f, FLPY: %f, FLPZ: %f", fl_position_body(0), fl_position_body(1), fl_position_body(2));
399 
400  break;
401  }
402  case Kinematics::LegType::frontRight:
403  {
404  //ROS_INFO("SW-FR");
405  double foot_step_distance_x = step_distance_x_linear + step_distance_x_rotational;
406  double foot_step_distance_y = step_distance_y_linear + step_distance_y_rotational;
407 
408  double foot_velocity_x = foot_step_distance_x/(swing_period + 2.0 * stance_period);
409  double foot_velocity_y = foot_step_distance_y/(swing_period + 2.0 * stance_period);
410 
411  CalculatePolynomialTrajectory(swing_time, swing_period, swing_rise_percentage, foot_step_distance_x, foot_velocity_x, foot_pos(0), foot_vel(0), foot_acc(0), foot_jerk(0));
412  CalculatePolynomialTrajectory(swing_time, swing_period, swing_rise_percentage, foot_step_distance_y, foot_velocity_y, foot_pos(1), foot_vel(1), foot_acc(1), foot_jerk(1));
413  CalculateFourthOrderPolynomialTrajectory(swing_time, swing_period, max_step_height, foot_pos(2), foot_vel(2), foot_acc(2));
414 
415  fr_position_body(0) = fr_offset(0) + foot_pos(0) - foot_step_distance_x / 2.0;
416  fr_position_body(1) = fr_offset(1) + foot_pos(1) - foot_step_distance_y / 2.0;
417  fr_position_body(2) = - hip_height + foot_pos(2);
418 
419  fr_velocity_body = foot_vel;
420  fr_acceleration_body = foot_acc;
421 
422  break;
423  }
424  case Kinematics::LegType::rearLeft:
425  {
426  //ROS_INFO("SW-RL");
427  double foot_step_distance_x = step_distance_x_linear - step_distance_x_rotational;
428  double foot_step_distance_y = step_distance_y_linear - step_distance_y_rotational;
429 
430  double foot_velocity_x = foot_step_distance_x/(swing_period + 2.0 * stance_period);
431  double foot_velocity_y = foot_step_distance_y/(swing_period + 2.0 * stance_period);
432 
433  CalculatePolynomialTrajectory(swing_time, swing_period, swing_rise_percentage, foot_step_distance_x, foot_velocity_x, foot_pos(0), foot_vel(0), foot_acc(0), foot_jerk(0));
434  CalculatePolynomialTrajectory(swing_time, swing_period, swing_rise_percentage, foot_step_distance_y, foot_velocity_y, foot_pos(1), foot_vel(1), foot_acc(1), foot_jerk(1));
435  CalculateFourthOrderPolynomialTrajectory(swing_time, swing_period, max_step_height, foot_pos(2), foot_vel(2), foot_acc(2));
436 
437  rl_position_body(0) = rl_offset(0) + foot_pos(0) - foot_step_distance_x / 2.0;
438  rl_position_body(1) = rl_offset(1) + foot_pos(1) - foot_step_distance_y / 2.0;
439  rl_position_body(2) = - hip_height + foot_pos(2);
440 
441  rl_velocity_body = foot_vel;
442  rl_acceleration_body = foot_acc;
443 
444  break;
445  }
446  case Kinematics::LegType::rearRight:
447  {
448  //ROS_INFO("SW-RR");
449  double foot_step_distance_x = step_distance_x_linear + step_distance_x_rotational;
450  double foot_step_distance_y = step_distance_y_linear - step_distance_y_rotational;
451 
452  double foot_velocity_x = foot_step_distance_x/(swing_period + 2.0 * stance_period);
453  double foot_velocity_y = foot_step_distance_y/(swing_period + 2.0 * stance_period);
454 
455  CalculatePolynomialTrajectory(swing_time, swing_period, swing_rise_percentage, foot_step_distance_x, foot_velocity_x, foot_pos(0), foot_vel(0), foot_acc(0), foot_jerk(0));
456  CalculatePolynomialTrajectory(swing_time, swing_period, swing_rise_percentage, foot_step_distance_y, foot_velocity_y, foot_pos(1), foot_vel(1), foot_acc(1), foot_jerk(1));
457  CalculateFourthOrderPolynomialTrajectory(swing_time, swing_period, max_step_height, foot_pos(2), foot_vel(2), foot_acc(2));
458 
459  rr_position_body(0) = rr_offset(0) + foot_pos(0) - foot_step_distance_x / 2.0;
460  rr_position_body(1) = rr_offset(1) + foot_pos(1) - foot_step_distance_y / 2.0;
461  rr_position_body(2) = - hip_height + foot_pos(2);
462 
463  rr_velocity_body = foot_vel;
464  rr_acceleration_body = foot_acc;
465 
466  break;
467  }
468  default:
469  ROS_WARN("RobotController::UpdateSwingFootTrajectory - Invalid leg type selected");
470  break;
471  }
472 
473  //ROS_INFO("Pos: %f, %f, %f\tVel: %f, %f, %f\tAcc: %f, %f, %f", foot_pos(0), foot_pos(1), foot_pos(2), foot_vel(0), foot_vel(1), foot_vel(2), foot_acc(0), foot_acc(1), foot_acc(2));
474 
475 }
476 
478 {
479  ROS_INFO("SwI: %d\tStI: %d", swing_iterations, stance_iterations);
480 }
481 
483 {
484  ROS_INFO("LinX: %f\tLinY: %f\tAngZ: %f", lin_vel_x, lin_vel_y, ang_vel_z);
485 }
486 
488 {
489  ROS_INFO("State: %d\tIteration: %d\tVlx: %f\tVly: %f\tVax: %f\tVay: %f\tFeet: %f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t",
496 }
497 
499 {
500  if((this->lin_vel_x == 0.0) && (this->lin_vel_y == 0.0) && (this->ang_vel_z == 0.0))
501  {
502  this->_lin_vel_x_command = 0.0;
503  this->_lin_vel_y_command = 0.0;
504  this->_ang_vel_z_command = 0.0;
505  }
506  else
507  {
508  this->_lin_vel_x_command = this->lin_vel_x + this->_guidance_lin_vel_gain * (this->lin_vel_x - this->_lin_vel_x_estimated);
509  this->_lin_vel_y_command = this->lin_vel_y + this->_guidance_lin_vel_gain * (this->lin_vel_y - this->_lin_vel_y_estimated);
511  }
512 }
513 
515 {
516  this->_lin_vel_x_command = this->lin_vel_x;
517 
518  this->_lin_vel_y_command = this->lin_vel_y;
519 
520  this->_ang_vel_z_command = this->ang_vel_z;
521 }
Eigen::Vector3d fr_offset
Definition: controller.h:137
Eigen::Vector3d fl_acceleration_body
Definition: controller.h:159
double _lin_vel_x_estimated
Definition: controller.h:194
double _lin_vel_y_estimated
Definition: controller.h:196
Eigen::Vector3d fl_offset
Definition: controller.h:135
double lin_vel_y
The desired linear robot velocity in the body frame's y direction.
Definition: controller.h:189
Eigen::Vector3d fl_velocity_body
Definition: controller.h:151
Eigen::Vector3d rr_offset
Definition: controller.h:141
Eigen::Vector3d rl_position_body
Definition: controller.h:147
Eigen::Vector3d rl_acceleration_body
Definition: controller.h:163
Eigen::Matrix< double, 6, 1 > base_pose_commands
Definition: controller.h:183
Eigen::Vector3d fl_position_body
Definition: controller.h:143
double _ang_vel_z_estimated
Definition: controller.h:198
int controller_freq
Definition: controller.h:110
Eigen::Vector3d rr_position_body
Definition: controller.h:149
double ang_vel_z
The desired angular robot velocity around the robot's z axis.
Definition: controller.h:192
Eigen::Vector3d fr_acceleration_body
Definition: controller.h:161
Eigen::Vector3d fr_position_body
Definition: controller.h:145
double lin_vel_x
The desired linear robot velocity in the body frame's x direction.
Definition: controller.h:186
Eigen::Vector3d rr_velocity_body
Definition: controller.h:157
Eigen::Vector3d rl_offset
Definition: controller.h:139
Eigen::Vector3d rr_acceleration_body
Definition: controller.h:165
Eigen::Vector3d rl_velocity_body
Definition: controller.h:155
Eigen::Vector3d fr_velocity_body
Definition: controller.h:153
LegType
Leg type enumerator.
Definition: kinematics.h:56
double step_distance_x_linear
double step_distance_y_linear
double swing_rise_percentage
void UpdateFeetReferences()
A function updating the foot positions of the robot in the hip frames.
double _guidance_lin_vel_gain
MotionState motion_state
A variable deciding which of the four motion states we are currently in.
void UpdateNonGuidanceCommands()
double stance_phase_duration_percentage
Eigen::Matrix< double, 3, 1 > UpdateSwingFootPosition(Kinematics::LegType _leg_type, double _progress)
Eigen::Matrix< double, 3, 1 > UpdateStanceFootPosition(Kinematics::LegType _leg_type, double _progress)
double _guidance_ang_vel_gain
double step_distance_x_rotational
double step_distance_y_rotational
RobotController(int controller_freq, double gait_period)
void UpdateSwingFootTrajectory(Kinematics::LegType _leg_type, double progress)
#define LEG_OFFSET_LENGTH
Definition: controller.h:25
void CalculateFourthOrderPolynomialTrajectory(double t, double swing_period, double distance, double &_pos, double &_vel, double _acc)
Definition: gaits.cpp:277
void CalculatePolynomialTrajectory(double t, double swing_period, double rise_percentage, double distance, double vel_cmd, double &_pos, double &_vel, double &_acc, double &_jerk)
Definition: gaits.cpp:196