Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This packages contains generic controllers that can be used for a biped, quadrup
- BulletUtils (Optional, needed to run demos)
- Robot_Properties_Solo (Optional, needed to run demos)
- Robot_Properties_Bolt (Optional, needed to run demos)
- Robot_Properties_Go1 (Optional, needed to run demos)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we miss something in the CMakeLists.txt to check if those optional dependencies are installed or not...
It is not needed per say but would be nice IMHO.

```
#### Download the package

Expand Down
23 changes: 21 additions & 2 deletions demos/demo_robot_com_ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from mim_control.robot_centroidal_controller import RobotCentroidalController
from bullet_utils.env import BulletEnvWithGround
from robot_properties_solo.solo12wrapper import Solo12Robot, Solo12Config
from robot_properties_go1.go1wrapper import Go1Robot, Go1Config
from robot_properties_bolt.bolt_wrapper import BoltRobot, BoltConfig


Expand All @@ -32,6 +33,19 @@ def demo(robot_name):
db = [1.0, 1.0, 1.0]
qp_penalty_lin = 3 * [1e6]
qp_penalty_ang = 3 * [1e6]
x_com = [0.0, 0.0, 0.18]
elif robot_name == "go1":
robot = Go1Robot()
robot = env.add_robot(robot)
robot_config = Go1Config()
mu = 0.2
kc=[0, 0, 200]
dc=[10, 10, 10]
kb=[25, 25, 25.]
db=[22.5, 22.5, 22.5]
qp_penalty_lin = 3 * [1e6]
qp_penalty_ang = 3 * [1e6]
x_com = [0.0, 0.0, 0.35]
elif robot_name == "bolt":
robot = env.add_robot(BoltRobot)
robot_config = BoltConfig()
Expand All @@ -42,10 +56,11 @@ def demo(robot_name):
db = [10.0, 10.0, 10.0]
qp_penalty_lin = [1, 1, 1e6]
qp_penalty_ang = [1e6, 1e6, 1]
x_com = [0.0, 0.0, 0.18]
else:
raise RuntimeError(
"Robot name [" + str(robot_name) + "] unknown. "
"Try 'solo' or 'bolt'"
"Try 'solo', 'bolt' or 'go1'"
)

# Initialize control
Expand All @@ -58,7 +73,6 @@ def demo(robot_name):
robot.reset_state(q0, dq0)

# Desired center of mass position and velocity.
x_com = [0.0, 0.0, 0.18]
xd_com = [0.0, 0.0, 0.0]
# The base should be flat.
x_ori = [0.0, 0.0, 0.0, 1.0]
Expand Down Expand Up @@ -116,9 +130,14 @@ def demo(robot_name):
parser.add_argument(
"--bolt", help="Demonstrate Bolt.", action="store_true"
)
parser.add_argument(
"--go1", help="Demonstrate Go1.", action="store_true"
)
args = parser.parse_args()
if args.solo:
robot_name = "solo"
elif args.go1:
robot_name = "go1"
elif args.bolt:
robot_name = "bolt"
else:
Expand Down
10 changes: 10 additions & 0 deletions demos/demo_robot_impedance.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from mim_control.robot_impedance_controller import RobotImpedanceController
from bullet_utils.env import BulletEnvWithGround
from robot_properties_solo.solo12wrapper import Solo12Robot, Solo12Config
from robot_properties_go1.go1wrapper import Go1Robot, Go1Config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to add a try catch here for the optional dependencies?

for example one wants to run on solo but not on go1 and still need to install go1 to run the demo...
It would be nice to allow the users to run it without solo if you run go1 and the other way around.

WDYT?

from robot_properties_bolt.bolt_wrapper import BoltRobot, BoltConfig


Expand All @@ -29,6 +30,10 @@ def demo(robot_name):
robot = BoltRobot()
robot = env.add_robot(robot)
robot_config = BoltConfig()
elif robot_name == "go1":
robot = Go1Robot()
robot = env.add_robot(robot)
robot_config = Go1Config()
else:
raise RuntimeError(
"Robot name [" + str(robot_name) + "] unknown. "
Expand Down Expand Up @@ -83,11 +88,16 @@ def demo(robot_name):
parser.add_argument(
"--bolt", help="Demonstrate Bolt.", action="store_true"
)
parser.add_argument(
"--go1", help="Demonstrate Bolt.", action="store_true"
)
args = parser.parse_args()
if args.solo:
robot_name = "solo"
elif args.bolt:
robot_name = "bolt"
elif args.go1:
robot_name = "go1"
else:
robot_name = "solo"

Expand Down