in bullet/bullet_render.py [0:0]
def render_model(pb_client,
model,
draw_link=True,
draw_link_info=True,
draw_joint=False,
draw_joint_geom=True,
ee_indices=None,
color=None,
link_info_scale=1.0,
link_info_color=[0, 0, 0, 1],
link_info_line_width=1.0,
lighting=True,
):
if draw_link or draw_link_info:
data_visual = pb_client.getVisualShapeData(model)
for d in data_visual:
if lighting:
glEnable(GL_LIGHTING)
else:
glDisable(GL_LIGHTING)
link_id = d[1]
if link_id == -1:
p, Q = pb_client.getBasePositionAndOrientation(model)
else:
link_state = pb_client.getLinkState(model, link_id)
p, Q = link_state[4], link_state[5]
p, Q = np.array(p), np.array(Q)
R = conversions.Q2R(Q)
T_joint = conversions.Rp2T(R, p)
T_visual_from_joint = conversions.Qp2T(np.array(d[6]),np.array(d[5]))
glPushMatrix()
gl_render.glTransform(T_joint)
gl_render.glTransform(T_visual_from_joint)
# if color is None: color = d[7]
# alpha = 0.5 if draw_joint else color[3]
if color is None:
color = [d[7][0], d[7][1], d[7][2], d[7][3]]
if draw_link:
render_geom(geom_type=d[2], geom_size=d[3], color=color)
if draw_link_info:
render_geom_info(geom_type=d[2], geom_size=d[3], color=link_info_color, scale=link_info_scale, line_width=link_info_line_width)
# if ee_indices is not None and link_id in ee_indices:
# render_geom_bounding_box(geom_type=d[2], geom_size=d[3], color=[0, 0, 0, 1])
glPopMatrix()
if draw_joint_geom:
render_joint_geoms(pb_client, model)
glDisable(GL_DEPTH_TEST)
if draw_joint:
render_joints(pb_client, model)
render_links(pb_client, model)
glEnable(GL_DEPTH_TEST)