-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1570c8
commit c4b915a
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright 2024 Inria | ||
|
||
"""Load Upkie in Pinocchio and display its visual model in MeshCat.""" | ||
|
||
import argparse | ||
import time | ||
|
||
import pinocchio as pin | ||
import upkie_description | ||
from pinocchio.visualize import MeshcatVisualizer | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description=__doc__) | ||
parser.add_argument( | ||
"--variant", | ||
help="variant of the robot description to load", | ||
) | ||
args = parser.parse_args() | ||
|
||
label = "robot" | ||
if args.variant: | ||
label = f"'{args.variant}' variant of the robot" | ||
robot = upkie_description.load_in_pinocchio( | ||
# NB: we add a free-flyer so that the torso mass is included | ||
root_joint=pin.JointModelFreeFlyer(), | ||
variant=args.variant, | ||
) | ||
robot.setVisualizer(MeshcatVisualizer()) | ||
robot.initViewer(open=True) | ||
robot.loadViewerModel() | ||
robot.display(robot.q0) | ||
|
||
time.sleep(1.0) # wait long enough for MeshCat to fire up |