Commit db5298d7 authored by Mederic Fourmy's avatar Mederic Fourmy
Browse files

Add visualization script

parent 7116f099
import pinocchio as pin
SOLO12_URDF = 'solo12.urdf'
SOLO12_POINTED_FEET_URDF = 'solo12_pointed_feet.urdf'
def create_solo(urdf_name):
path = '/opt/openrobots/share/example-robot-data/robots/solo_description'
urdf = path + '/robots/' + urdf_name
srdf = path + '/srdf/solo.srdf'
robot = pin.RobotWrapper.BuildFromURDF(urdf, path, pin.JointModelFreeFlyer())
pin.loadReferenceConfigurations(robot.model, srdf, False)
robot.initViewer(loadModel=True, sceneName='world/'+urdf_name.split('.')[0])
return robot
def color_robot(gv, urdf_name, color):
name = urdf_name.split('.')[0]
for node in gv.getNodeList():
if name in node:
# normal solo
r = create_solo(SOLO12_URDF)
q0 = r.model.referenceConfigurations['standing']
gv = r.viewer.gui
color_robot(gv, SOLO12_URDF, [1,1,1,0.5])
# pointed feet
r_pointed = create_solo(SOLO12_POINTED_FEET_URDF)
color_robot(gv, SOLO12_POINTED_FEET_URDF, [1,0,0,1])
# display variations next to each other
q0[1] += 0.8
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment