rayli commited on
Commit
b246c3b
·
verified ·
1 Parent(s): 73fb7a2

Restore joint-type colors for exported axes

Browse files
instruct_particulate/utils/visualization_utils.py CHANGED
@@ -32,6 +32,8 @@ def _hex_to_rgb(color: str) -> tuple[int, int, int]:
32
 
33
 
34
  COLORS = tuple(_hex_to_rgb(color) for color in LINK_COLOR_HEX)
 
 
35
 
36
 
37
  def create_textured_mesh_parts(mesh_parts, part_ids=None, colors=COLORS, tex_res=256):
@@ -274,12 +276,10 @@ def create_motion_axis_meshes(
274
  is_part_prismatic: np.ndarray,
275
  revolute_plucker: np.ndarray,
276
  prismatic_axis: np.ndarray,
277
- colors=COLORS,
278
  ):
279
  """Create arrow/ring meshes visualizing predicted joint motion."""
280
  axes = []
281
  for mesh_part, part_id in zip(mesh_parts, unique_part_ids, strict=True):
282
- axis_color = colors[int(part_id) % len(colors)][:3]
283
  if is_part_revolute[part_id]:
284
  axis_direction, axis_point = plucker_to_axis_point(revolute_plucker[part_id])
285
  arrow_start, arrow_end = get_3D_arrow_on_points(
@@ -292,7 +292,7 @@ def create_motion_axis_meshes(
292
  create_arrow(
293
  arrow_start,
294
  arrow_end,
295
- color=axis_color,
296
  radius=0.01,
297
  radius_tip=0.018,
298
  )
@@ -304,7 +304,7 @@ def create_motion_axis_meshes(
304
  arrow_direction,
305
  major_radius=0.03,
306
  minor_radius=0.006,
307
- color=axis_color,
308
  )
309
  )
310
  axes.append(
@@ -313,7 +313,7 @@ def create_motion_axis_meshes(
313
  arrow_direction,
314
  major_radius=0.03,
315
  minor_radius=0.006,
316
- color=axis_color,
317
  )
318
  )
319
  elif is_part_prismatic[part_id]:
@@ -326,7 +326,7 @@ def create_motion_axis_meshes(
326
  create_arrow(
327
  arrow_start,
328
  arrow_end,
329
- color=axis_color,
330
  radius=0.01,
331
  radius_tip=0.018,
332
  )
 
32
 
33
 
34
  COLORS = tuple(_hex_to_rgb(color) for color in LINK_COLOR_HEX)
35
+ ARROW_COLOR_REVOLUTE = (255, 0, 0)
36
+ ARROW_COLOR_PRISMATIC = (255, 255, 0)
37
 
38
 
39
  def create_textured_mesh_parts(mesh_parts, part_ids=None, colors=COLORS, tex_res=256):
 
276
  is_part_prismatic: np.ndarray,
277
  revolute_plucker: np.ndarray,
278
  prismatic_axis: np.ndarray,
 
279
  ):
280
  """Create arrow/ring meshes visualizing predicted joint motion."""
281
  axes = []
282
  for mesh_part, part_id in zip(mesh_parts, unique_part_ids, strict=True):
 
283
  if is_part_revolute[part_id]:
284
  axis_direction, axis_point = plucker_to_axis_point(revolute_plucker[part_id])
285
  arrow_start, arrow_end = get_3D_arrow_on_points(
 
292
  create_arrow(
293
  arrow_start,
294
  arrow_end,
295
+ color=ARROW_COLOR_REVOLUTE,
296
  radius=0.01,
297
  radius_tip=0.018,
298
  )
 
304
  arrow_direction,
305
  major_radius=0.03,
306
  minor_radius=0.006,
307
+ color=ARROW_COLOR_REVOLUTE,
308
  )
309
  )
310
  axes.append(
 
313
  arrow_direction,
314
  major_radius=0.03,
315
  minor_radius=0.006,
316
+ color=ARROW_COLOR_REVOLUTE,
317
  )
318
  )
319
  elif is_part_prismatic[part_id]:
 
326
  create_arrow(
327
  arrow_start,
328
  arrow_end,
329
+ color=ARROW_COLOR_PRISMATIC,
330
  radius=0.01,
331
  radius_tip=0.018,
332
  )