concepts.simulator.pymunk.default_env.PymunkDefaultEnv#
- class PymunkDefaultEnv[source]#
Bases:
object
A basic 2D physics environment based on pymunk.
The main function to be implemented by subclasses is reset_scene.
Methods
add_additional_drawing_region_circle
(center, ...)add_additional_drawing_region_rect
(top_left, ...)can_control
(body)Check if the body can be controlled by the user.
get_jittered_velocity
(velocity)Get an observation dict of the current state of the environment.
Run a mainloop so that the user can control the objects in the environment.
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
(**kwargs)set_current_selection
(body)step
(steps[, render_mode, callback])Step the simulation for a number of steps.
Attributes
- __init__(damping=0.0, gravity=(0., 0.), world_width=800, world_height=800, fps=60, action_velocity=100, velocity_jitter=0.0, direction_jitter=0.0, display=True, render_fps=None)[source]#
- __new__(**kwargs)#
- can_control(body)[source]#
Check if the body can be controlled by the user. This function can be overridden by subclasses.
- Return type:
- humanplay_mainloop()[source]#
Run a mainloop so that the user can control the objects in the environment.
- non_physical_execute_trajectory(body_name, trajectory)[source]#
Execute a trajectory without physical simulation. This is done by manually setting the positions of the bodies.
- render()[source]#
Render the environment. If recording is enabled, the rendered frames will be stored in the recorded_frames list. Use
start_recording()
andstop_recording()
to control the recording process.The rendering is done by calling the debug_draw method of the PymunkWorld object.
- Return type:
None
- set_additional_step_callable(fn)[source]#
- Parameters:
fn (Callable[[PymunkDefaultEnv], None])
- step(steps, render_mode='image', callback=None)[source]#
Step the simulation for a number of steps.
- Parameters:
- Return type:
- RENDER_MODES = ['image', 'human', 'pose', 'state']#
- SCREENSHOT_TITLE = 'screenshot'#
- TITLE = 'Pymunk Default'#