Util

Helpful Utilities

Functions

convert_unicode(value) Resolves python 2 issue with json loading in unicode instead of string
draw_arrow(env, start, end[, color, thickness]) Draws a debug arrow in the world
draw_box(env, center, extent[, color, thickness]) Draws a debug box in the world
draw_line(env, start, end[, color, thickness]) Draws a debug line in the world
draw_point(env, loc[, color, thickness]) Draws a debug point in the world
get_holodeck_path() Gets the path of the holodeck environment
get_holodeck_version() Gets the current version of holodeck
get_os_key() Gets the key for the OS.
human_readable_size(size_bytes) Gets a number of bytes as a human readable string.
holodeck.util.convert_unicode(value)

Resolves python 2 issue with json loading in unicode instead of string

Parameters:value (str) – Unicode value to be converted
Returns:Converted string
Return type:(str)
holodeck.util.draw_arrow(env, start, end, color=None, thickness=10.0)

Draws a debug arrow in the world

Parameters:
  • env (HolodeckEnvironment) – Environment to draw in.
  • start (list of float) – The start [x, y, z] location of the line. (see Coordinate System)
  • end (list of float) – The end [x, y, z] location of the arrow
  • color (list) – [r, g, b] color value
  • thickness (float) – thickness of the arrow
holodeck.util.draw_box(env, center, extent, color=None, thickness=10.0)

Draws a debug box in the world

Parameters:
  • env (HolodeckEnvironment) – Environment to draw in.
  • center (list of float) – The start [x, y, z] location of the box. (see Coordinate System)
  • extent (list of float) – The [x, y, z] extent of the box
  • color (list) – [r, g, b] color value
  • thickness (float) – thickness of the lines
holodeck.util.draw_line(env, start, end, color=None, thickness=10.0)

Draws a debug line in the world

Parameters:
  • env (HolodeckEnvironment) – Environment to draw in.
  • start (list of float) – The start [x, y, z] location of the line. (see Coordinate System)
  • end (list of float) – The end [x, y, z] location of the line
  • color (list`) – [r, g, b] color value
  • thickness (float) – thickness of the line
holodeck.util.draw_point(env, loc, color=None, thickness=10.0)

Draws a debug point in the world

Parameters:
  • env (HolodeckEnvironment) – Environment to draw in.
  • loc (list of float) – The [x, y, z] start of the box. (see Coordinate System)
  • color (list of float) – [r, g, b] color value
  • thickness (float) – thickness of the point
holodeck.util.get_holodeck_path()

Gets the path of the holodeck environment

Returns:path to the current holodeck environment
Return type:(str)
holodeck.util.get_holodeck_version()

Gets the current version of holodeck

Returns:the current version
Return type:(str)
holodeck.util.get_os_key()

Gets the key for the OS.

Returns:Linux or Windows. Throws NotImplementedError for other systems.
Return type:str
holodeck.util.human_readable_size(size_bytes)

Gets a number of bytes as a human readable string.

Parameters:size_bytes (int) – The number of bytes to get as human readable.
Returns:The number of bytes in a human readable form.
Return type:str