Skip to content

Commit

Permalink
Run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
EtienneAr committed Feb 16, 2024
1 parent a972434 commit c0c100e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 23 deletions.
8 changes: 4 additions & 4 deletions include/qrw/Params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ struct Params {
bool mpc_in_rosnode; // Run the MPC on a separate rosnode

// General control parameters
VectorN q_init; // Initial articular positions
VectorN pose_init; //Initial base pose
Scalar dt_wbc; // Time step of the whole body control
Scalar dt_mpc; // Time step of the model predictive control
VectorN q_init; // Initial articular positions
VectorN pose_init; // Initial base pose
Scalar dt_wbc; // Time step of the whole body control
Scalar dt_mpc; // Time step of the model predictive control
int mpc_wbc_ratio;
uint N_periods; // Number of gait periods in the MPC prediction horizon
bool save_guess; // true to save the initial result of the mpc
Expand Down
1 change: 1 addition & 0 deletions python/quadruped_reactive_walking/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def compute(self, device, qc=None):
self.mpc.solve(self.k, x, self.target_footstep.copy(), self.target_base.copy())
except ValueError:
import traceback

self.error = True
traceback.print_exc()

Expand Down
4 changes: 2 additions & 2 deletions python/quadruped_reactive_walking/ocp_defs/walking.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def __init__(self, params: Params, footsteps, base_vel_refs):
self.rdata = self.rmodel.createData()

self.life_gait = params.gait
self.starting_gait = np.array([[1,1,0,0]] * params.starting_nodes, dtype=np.int32)
self.ending_gait = np.array([[1,1,0,0]] * params.starting_nodes, dtype=np.int32)
self.starting_gait = np.array([[1, 1, 0, 0]] * params.starting_nodes, dtype=np.int32)
self.ending_gait = np.array([[1, 1, 0, 0]] * params.starting_nodes, dtype=np.int32)
self.current_gait = np.append(
self.starting_gait,
self.ending_gait[0].reshape(1, -1),
Expand Down
4 changes: 2 additions & 2 deletions python/quadruped_reactive_walking/tools/pybullet_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ def __init__(self, pose_init, q_init, env_id, use_flat_plane, enable_pyb_GUI, dt
# Set base pose
pyb.resetBasePositionAndOrientation(
self.robotId,
[pose_init[0], pose_init[1], z_offset], # Ignore Z_height to put the robot on the ground by default
pose_init[3:] #pin.Quaternion(pin.rpy.rpyToMatrix(p_roll, p_pitch, 0.0)).coeffs(),
[pose_init[0], pose_init[1], z_offset], # Ignore Z_height to put the robot on the ground by default
pose_init[3:], # pin.Quaternion(pin.rpy.rpyToMatrix(p_roll, p_pitch, 0.0)).coeffs(),
)

# Fix the base in the world frame
Expand Down
2 changes: 0 additions & 2 deletions python/quadruped_reactive_walking/wb_mpc/task_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,3 @@ def __init__(self, params: Params):
self.xref = self.x0_reduced
# self.uref = self.u0
self.u0 = self.uref


18 changes: 6 additions & 12 deletions src/Joystick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ Joystick::Joystick(Params const& params)
gp_alpha_pos = 0.0;
p_ref_.head(3) = params_->pose_init.head(3);
p_ref_.tail(3) = pinocchio::rpy::matrixToRpy(
Eigen::Quaternion<double>(
params_->pose_init(3),
params_->pose_init(4),
params_->pose_init(5),
params_->pose_init(6)
).toRotationMatrix());
Eigen::Quaternion<double>(
params_->pose_init(3), params_->pose_init(4), params_->pose_init(5), params_->pose_init(6))
.toRotationMatrix());

lock_time_L1_ = std::chrono::system_clock::now();

Expand Down Expand Up @@ -160,12 +157,9 @@ void Joystick::update_v_ref(int k, bool gait_is_static) {
gp_alpha_vel = params_->gp_alpha_vel;
p_ref_.head(3) = params_->pose_init.head(3);
p_ref_.tail(3) = pinocchio::rpy::matrixToRpy(
Eigen::Quaternion<double>(
params_->pose_init(3),
params_->pose_init(4),
params_->pose_init(5),
params_->pose_init(6)
).toRotationMatrix());
Eigen::Quaternion<double>(
params_->pose_init(3), params_->pose_init(4), params_->pose_init(5), params_->pose_init(6))
.toRotationMatrix());
gp_alpha_pos = 0.0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Params::Params()
v_switch(),
fc_v_esti(0.0),

T_gait(0.0), // Period of the gait
T_gait(0.0), // Period of the gait
footsteps_under_shoulders(12) // Fill with zeros, will be filled with values later
{
Kp_main.setZero();
Expand Down

0 comments on commit c0c100e

Please sign in to comment.