concepts.benchmark.namo.namo_polygon.namo_polygon_env.NamoPolygonEnv#

class NamoPolygonEnv[source]#

Bases: PymunkDefaultEnv

Methods

add_additional_drawing_region_circle(center, ...)

add_additional_drawing_region_rect(top_left, ...)

attach_object(body)

can_control(body)

Check if the body can be controlled by the user.

detach_object()

distance_to_body(body)

get_jittered_velocity(velocity)

get_observation()

Get an observation dict of the current state of the environment.

humanplay_mainloop()

Run a mainloop so that the user can control the objects in the environment.

move_cfree_trajectory(trajectory)

move_cfree_trajectory_with_attached_object(...)

non_physical_execute_trajectory(body_name, ...)

Execute a trajectory without physical simulation.

render()

Render the environment.

render_and_display([render_mode, trajectory])

reset(**kwargs)

reset_scene()

reset_world()

set_additional_step_callable(fn)

set_agent_pos(pos)

set_current_attached_body(body)

set_current_selection(body)

start_recording()

step(steps[, render_mode, callback])

Step the simulation for a number of steps.

stop_recording()

Attributes

__init__(scene_json, **kwargs)[source]#
__new__(**kwargs)#
add_additional_drawing_region_circle(center, radius, color)#
Parameters:
add_additional_drawing_region_rect(top_left, bottom_right, color)#
Parameters:
attach_object(body)[source]#
Parameters:

body (Body)

can_control(body)#

Check if the body can be controlled by the user. This function can be overridden by subclasses.

Return type:

bool

detach_object()[source]#
distance_to_body(body)[source]#
Parameters:

body (Body)

Return type:

float

get_jittered_velocity(velocity)#
Parameters:

velocity (Tuple[float, float])

Return type:

Tuple[float, float]

get_observation()#

Get an observation dict of the current state of the environment.

humanplay_mainloop()#

Run a mainloop so that the user can control the objects in the environment.

move_cfree_trajectory(trajectory)[source]#
Return type:

NamoPolygonExecutionResult

move_cfree_trajectory_with_attached_object(trajectory)[source]#
Return type:

NamoPolygonExecutionResult

non_physical_execute_trajectory(body_name, trajectory)#

Execute a trajectory without physical simulation. This is done by manually setting the positions of the bodies.

Parameters:
  • body_name (str) – the name of the body to be moved.

  • trajectory (List[Tuple[float, float]]) – a list of positions to be set to the body.

Return type:

None

render()#

Render the environment. If recording is enabled, the rendered frames will be stored in the recorded_frames list. Use start_recording() and stop_recording() to control the recording process.

The rendering is done by calling the debug_draw method of the PymunkWorld object.

Return type:

None

render_and_display(render_mode='image', trajectory=None)#
Parameters:
  • render_mode (str | None)

  • trajectory (List[Any] | None)

Return type:

None

reset(**kwargs)#
reset_scene()[source]#
reset_world()#
Return type:

PymunkWorld

set_additional_step_callable(fn)#
Parameters:

fn (Callable[[PymunkDefaultEnv], None])

set_agent_pos(pos)[source]#
Parameters:

pos (Tuple[float, float])

set_current_attached_body(body)[source]#
Parameters:

body (Body | None)

set_current_selection(body)#
Parameters:

body (Body)

start_recording()#
step(steps, render_mode='image', callback=None)#

Step the simulation for a number of steps.

Parameters:
  • steps (int) – the number of steps to be executed.

  • render_mode (str | None) – the mode of rendering. Can be one of [‘image’, ‘human’, ‘pose’, ‘state’]. Set to None to disable any rendering.

  • callback (Callable[[], bool] | None) – a callback function that returns False to stop the simulation.

Return type:

List[Any]

stop_recording()#
RENDER_MODES = ['image', 'human', 'pose', 'state']#
SCREENSHOT_TITLE = 'screenshot'#
TITLE = 'Pymunk Default'#
property agent#
property agent_goal: Tuple[float, float]#
property agent_pos#
property agent_start: Tuple[float, float]#
property obstacles: Sequence[Body]#