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 28, 2024
1 parent cbe2322 commit 3a7a6c2
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
1 change: 1 addition & 0 deletions examples/run_jump_ocp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import crocoddyl # noqa
import aligator
import numpy as np
import pinocchio as pin
import matplotlib.pyplot as plt

from quadruped_reactive_walking import Params
Expand Down
1 change: 1 addition & 0 deletions examples/simple_ocp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
import pinocchio as pin
import quadruped_reactive_walking as qrw
from quadruped_reactive_walking.controller import Controller
import time
Expand Down
14 changes: 7 additions & 7 deletions include/qrw/Estimator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ class Estimator {
Vector4 feetStancePhaseDuration_; //< Number of loops during which each foot has been in contact
Vector4 feetStatus_; //< Contact status of the four feet

pinocchio::Model model_; //< Pinocchio models for frame computations and forward kinematics
pinocchio::Data data_; //< Pinocchio datas for frame computations and forward kinematics
Vector19 q_FK_; //< Configuration vector for Forward Kinematics
Vector18 v_FK_; //< Velocity vector for Forward Kinematics
Vector3 baseVelocityFK_; //< Base linear velocity estimated by Forward Kinematics
Vector3 basePositionFK_; //< Base position estimated by Forward Kinematics
Vector3 b_baseVelocity_; //< Filtered estimated velocity at center base (base frame)
pinocchio::Model model_; //< Pinocchio models for frame computations and forward kinematics
pinocchio::Data data_; //< Pinocchio datas for frame computations and forward kinematics
Vector19 q_FK_; //< Configuration vector for Forward Kinematics
Vector18 v_FK_; //< Velocity vector for Forward Kinematics
Vector3 baseVelocityFK_; //< Base linear velocity estimated by Forward Kinematics
Vector3 basePositionFK_; //< Base position estimated by Forward Kinematics
Vector3 b_baseVelocity_; //< Filtered estimated velocity at center base (base frame)

ComplementaryFilter positionFilter_; //< Complementary filter for base position
ComplementaryFilter velocityFilter_; //< Complementary filter for base velocity
Expand Down
5 changes: 2 additions & 3 deletions python/quadruped_reactive_walking/ocp_defs/walking.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pinocchio as pin
import crocoddyl

from typing import List, Optional
from typing import Optional
from quadruped_reactive_walking import Params, ResidualModelFlyHigh
from ..wb_mpc import task_spec
from ..tools.utils import no_copy_roll, no_copy_roll_insert
Expand Down Expand Up @@ -361,7 +361,6 @@ def update_model(
self.update_tracking_costs(model.differential.costs, base_vel_ref, support_feet)

def update_tracking_costs(self, costs, base_vel_ref: pin.Motion, support_feet):
index = 0
for i in self.task.feet_ids:
name = "{}_forceReg".format(self.rmodel.frames[i].name)
costs.changeCostStatus(name, i in support_feet)
Expand All @@ -379,4 +378,4 @@ def update_tracking_costs(self, costs, base_vel_ref: pin.Motion, support_feet):

if base_vel_ref is not None and self.has_base_vel_cost:
name = "base_velocity_tracking"
costs.costs[name].cost.residual.reference = base_vel_ref
costs.costs[name].cost.residual.reference = base_vel_ref
1 change: 1 addition & 0 deletions python/quadruped_reactive_walking/tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
except ImportError:
from multiprocessing.shared_memory import SharedMemory


def quaternionToRPY(quat):
"""
Quaternion (4 x 0) to Roll Pitch Yaw (3 x 1)
Expand Down
1 change: 1 addition & 0 deletions python/quadruped_reactive_walking/wb_mpc/ocp_crocoddyl.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from . import task_spec
from ..ocp_defs.walking import WalkingOCPBuilder


class CrocOCP(OCPAbstract):
"""
Generate a Crocoddyl OCP for the control task.
Expand Down
13 changes: 6 additions & 7 deletions tests/ros/test_ros_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def _trigger_solve(self, msg):
)



if __name__ == "__main__":
# Parsing arguments
parser = argparse.ArgumentParser()
Expand All @@ -59,24 +58,24 @@ def _trigger_solve(self, msg):
parser.add_argument("--service", help="Name of the service to test", default="qrw_wbmpc/test")
args = parser.parse_args()

start_client = (args.client or not args.server)
start_server = (args.server or not args.client)
start_client = args.client or not args.server
start_server = args.server or not args.client

# Starintg ros node
rospy.init_node("qrw_wbmpc" + ("_client" if start_client else "") + ("_server" if start_server else ""))

# Running client and/or server
if(start_server):
if start_server:
server = TestServer(args.service)

if(start_client):
if start_client:
client = TestClient(args.service)
client.solve()

# Simple test that everything went fine
assert not rospy.is_shutdown()

# If the client is not started, let the server running
if(not start_client):
if not start_client:
print(f"Server running ({args.service})...")
rospy.spin()
rospy.spin()

0 comments on commit 3a7a6c2

Please sign in to comment.