Moving Symbols
v1.0
Like Moving MNIST, but way more flexible
|
Public Member Functions | |
def | __init__ (self, id, label, image, image_path, scale_fn) |
Constructor. More... | |
def | get_render_image_and_position (self, screen_size) |
Get the PyGame Surface and center coordinate of the scaled, rotated symbol. More... | |
def | set_scale (self, step) |
Set the scale of the symbol to the scaling function at the given time step. More... | |
def | get_state_message (self, step) |
Produce a message about the state of the symbol at the given time step. More... | |
def | get_init_message (self) |
Produce a message about fixed properties of the symbol, i.e. image data. More... | |
Public Attributes | |
id | |
label | |
image | |
image_path | |
pg_image | |
body | |
shape | |
scale_fn | |
scale | |
angular_velocity | |
def moving_symbols.moving_symbols.Symbol.__init__ | ( | self, | |
id, | |||
label, | |||
image, | |||
image_path, | |||
scale_fn | |||
) |
Constructor.
id | A numerical ID for this symbol |
label | The class label of this symbol |
image | The base PIL image for this symbol |
image_path | The path to the (unprocessed) image file |
scale_fn | A function that returns the scale of the symbol at any given time t |
def moving_symbols.moving_symbols.Symbol.get_init_message | ( | self | ) |
Produce a message about fixed properties of the symbol, i.e. image data.
Return a message containing information required to reconstruct the appearance and shape of the symbol. The returned meta information includes the symbol ID, the image as a HxWx4 np.uint8 array, the path to the source image, and the vertices of the symbol shape, in PyMunk coordinates, as a Vx2 np.float array.
message | A dict describing the symbol's initial state. Its key-value pairs are:
|
def moving_symbols.moving_symbols.Symbol.get_render_image_and_position | ( | self, | |
screen_size | |||
) |
Get the PyGame Surface and center coordinate of the scaled, rotated symbol.
screen_size | (width, height) of the PyGame screen |
rotated_image | pygame.Surface of the scaled, rotated image |
pg_image_pos | PyGame coordinates of the scaled, rotated image |
def moving_symbols.moving_symbols.Symbol.get_state_message | ( | self, | |
step | |||
) |
Produce a message about the state of the symbol at the given time step.
Return a message containing information about the current pose and motion of the symbol. Everything is a float except for id (int), position (np.float array with shape (2,)), and velocity (np.float array with shape (2,)).
step | The time step of the MovingSymbolEnvironment |
message | A dict describing the symbol's state. Its key-value pairs are:
|
def moving_symbols.moving_symbols.Symbol.set_scale | ( | self, | |
step | |||
) |
Set the scale of the symbol to the scaling function at the given time step.
step | The current time step of the environment |