Skip to content

Commit 83928d0

Browse files
author
Zhaoyu Ji
committed
Current state
1 parent 4a88c7b commit 83928d0

5 files changed

Lines changed: 72 additions & 18 deletions

File tree

bitbots_motion/bitbots_quintic_walk/config/walking_wolfgang_simulator.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ walking:
1414
kick_put_down_phase: 0.8
1515
kick_rise_factor: 1.5
1616

17+
fast_kick_knee_offset: 0.05
18+
fast_kick_hip_offset: 0.288
19+
fast_kick_phase_start: 0.19
20+
fast_kick_phase_end: 0.5
21+
22+
23+
1724
double_support_ratio: 0.0264282002140171
1825
first_step_swing_factor: 2.9
1926
foot_distance: 0.179900277671633

bitbots_motion/bitbots_quintic_walk/include/bitbots_quintic_walk/walk_engine.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The original files can be found at:
1616
#include "bitbots_splines/abstract_engine.hpp"
1717
#include "bitbots_splines/pose_spline.hpp"
1818
#include "bitbots_splines/smooth_spline.hpp"
19+
#include "bitbots_splines/abstract_ik.hpp"
1920

2021
namespace bitbots_quintic_walk {
2122

@@ -61,6 +62,8 @@ class WalkEngine : public bitbots_splines::AbstractEngine<WalkRequest, WalkRespo
6162
*/
6263
[[nodiscard]] bool isLeftSupport() const;
6364

65+
void fastKick(bitbots_splines::JointGoals &JointGoals);
66+
6467
/**
6568
* Return true if both feet are currently on the ground
6669
*/

bitbots_motion/bitbots_quintic_walk/src/parameters.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,26 @@ walking:
151151
description: "Scales the step rise parameter, as the kick is a special case, where the foot is moved higher of the ground than in normal walking (ratio)"
152152
validation:
153153
bounds<>: [0.0, 5.0]
154+
fast_kick_knee_offset:
155+
type: double
156+
description: "Offset of knee for fast kick"
157+
validation:
158+
bounds<>: [0, 1.2]
159+
fast_kick_hip_offset:
160+
type: double
161+
description: "Offset of hip for fast kick"
162+
validation:
163+
bounds<>: [0, 1.2]
164+
fast_kick_phase_start:
165+
type: double
166+
description: "Offset of hip for fast kick"
167+
validation:
168+
bounds<>: [0, 1]
169+
fast_kick_phase_end:
170+
type: double
171+
description: "Offset of hip for fast kick"
172+
validation:
173+
bounds<>: [0, 1]
154174
node:
155175
engine_freq:
156176
type: double

bitbots_motion/bitbots_quintic_walk/src/walk_engine.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ void WalkEngine::buildTrajectories(WalkEngine::TrajectoryType type) {
472472
foot_pos_acc_at_foot_change_.x());
473473
foot_spline_.x()->addPoint(double_support_length, foot_pos_at_foot_change_.x());
474474
if (kick_step) {
475+
foot_spline_.x()->addPoint(t,x);
475476
foot_spline_.x()->addPoint(double_support_length + single_support_length * config_.kick_phase,
476477
support_to_next_.getOrigin().x() + config_.kick_length, config_.kick_vel);
477478
foot_spline_.x()->addPoint(double_support_length + single_support_length * config_.kick_put_down_phase,
@@ -804,6 +805,46 @@ double WalkEngine::getTrajsTime() const {
804805
return t;
805806
}
806807

808+
void WalkEngine::fastKick(bitbots_splines::JointGoals &motor_goals_) {
809+
// in this state we do a kick while doing a step
810+
if (engine_state_ == WalkState::KICK and is_left_support_foot_ && (phase_ > config_.fast_kick_phase_start && phase_ < config_.fast_kick_phase_end)) {
811+
RCLCPP_WARN(node_->get_logger(),
812+
"fastKick right");
813+
for (size_t i = 0; i < motor_goals_.first.size(); i++) {
814+
if (motor_goals_.first[i] == "RHipPitch") {
815+
motor_goals_.second[i] -= config_.fast_kick_hip_offset;
816+
}
817+
}
818+
819+
for (size_t i = 0; i < motor_goals_.first.size(); i++) {
820+
if (motor_goals_.first[i] == "RKnee") {
821+
motor_goals_.second[i] += config_.fast_kick_knee_offset;
822+
RCLCPP_WARN(node_->get_logger(),
823+
"change goal of joint %ld at %s", i, motor_goals_.first[i].c_str());
824+
}
825+
}
826+
}
827+
if (engine_state_ == WalkState::KICK and !is_left_support_foot_ && (phase_ > (config_.fast_kick_phase_start + 0.5) && phase_ < (config_.fast_kick_phase_end + 0.5))) {
828+
RCLCPP_WARN(node_->get_logger(),
829+
"fastKick left");
830+
831+
for (size_t i = 0; i < motor_goals_.first.size(); i++) {
832+
if (motor_goals_.first[i] == "LHipPitch") {
833+
motor_goals_.second[i] += config_.fast_kick_hip_offset;
834+
}
835+
}
836+
837+
for (size_t i = 0; i < motor_goals_.first.size(); i++) {
838+
if (motor_goals_.first[i] == "LKnee") {
839+
motor_goals_.second[i] -= config_.fast_kick_knee_offset;
840+
}
841+
}
842+
843+
}
844+
}
845+
846+
847+
807848
bool WalkEngine::isLeftSupport() const { return is_left_support_foot_; }
808849

809850
bool WalkEngine::isDoubleSupport() {

bitbots_motion/bitbots_quintic_walk/src/walk_node.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -198,24 +198,7 @@ bitbots_msgs::msg::JointCommand WalkNode::step(double dt) {
198198
// compute motor goals from IK
199199
motor_goals_ = ik_.calculate(current_stabilized_response_);
200200

201-
if (engine_state_ == WalkState::KICK) {
202-
// in this state we do a kick while doing a step
203-
if (left_kick_requested_ && !is_left_support_foot_) {
204-
for (int i = 0; i < motor_goal_.first.size() - 1; i++) {
205-
if (motor_goal.first[i].compare("LKnee")) {
206-
motor_goal.second[i] += 0.1;
207-
}
208-
}
209-
}
210-
if (right_kick_requested_ && is_left_support_foot_) {
211-
}
212-
213-
if (half_step_finished) {
214-
// kick step is finished, go on walking
215-
buildTrajectories(TrajectoryType::NORMAL);
216-
engine_state_ = WalkState::WALKING;
217-
}
218-
}
201+
walk_engine_.fastKick(motor_goals_);
219202

220203
command.header.stamp = node_->get_clock()->now();
221204
/*

0 commit comments

Comments
 (0)