PDDLViz.Animation
— TypeAnimation
Displayable animation which wraps a VideoStream
object. Can be displayed with show(io, MIME"text/html"(), anim)
, or saved with save(path, anim)
.
PDDLViz.BasicGraphic
— TypeBasicGraphic(shape; attributes...)
Basic graphic type, containing a primitive shape and a dictionary of attributes.
PDDLViz.Canvas
— TypePDDLViz.Controller
— TypeController
Abstract supertype for all controllers. When attached to a canvas, a controller interprets user input as PDDL actions and updates the canvas accordingly.
Can be attached to a canvas using add_controller!
, and removed using remove_controller
.
PDDLViz.GraphworldRenderer
— TypeGraphworldRenderer(; options...)
Customizable renderer for domains with fixed locations connected in a graph.
Options
graph_layout::Union{Function, NetworkLayout.AbstractLayout}
: Function orAbstractLayout
that maps a graph to node locations.is_directed::Bool
: Whether the graph edges are directed.location_types::Vector{Symbol}
: PDDL object types that correspond to fixed locations.movable_types::Vector{Symbol}
: PDDL object types that correspond to movable objects.edge_fn::Function
: Function(dom, state, a, b) -> Bool
that checks if(a, b)
is present.edge_label_fn::Function
: Function(dom, state, a, b) -> String
that returns a label for(a, b)
.at_loc_fn::Function
: Function(dom, state, x, loc) -> Bool
that returns ifx
is atloc
.loc_renderers::Dict{Symbol, Function}
: Per-type location renderers, of the form(domain, state, loc) -> Graphic
.obj_renderers::Dict{Symbol, Function}
: Per-type object renderers, of the form(domain, state, obj) -> Graphic
.state_options::Dict{Symbol, Any}
: Default options for state rendering.graph_options::Dict{Symbol, Any}
: Default options for graph rendering, passed to thegraphplot
recipe.
PDDLViz.GridworldRenderer
— TypeGridworldRenderer(; options...)
Customizable renderer for 2D gridworld domains.
Options
grid_fluents::Vector{Julog.Term}
: PDDL fluents that represent the grid layers (walls, etc).grid_colors::Vector
: Colors for each grid layer.has_agent::Bool
: Whether the domain has an agent not associated with a PDDL object.get_agent_x::Function
: Function that returns the PDDL fluent for the agent's x position.get_agent_y::Function
: Function that returns the PDDL fluent for the agent's y position.get_obj_x::Function
: Takes an object constant and returns the PDDL fluent for its x position.get_obj_y::Function
: Takes an object constant and returns the PDDL fluent for its y position.agent_renderer::Function
: Agent renderer, of the form(domain, state) -> Graphic
.obj_renderers::Dict{Symbol, Function}
: Per-type object renderers, of the form(domain, state, obj) -> Graphic
.obj_type_z_order::Vector{Symbol}
: Z-order for object types, from bottom to top.locations::Vector{Tuple}
: List of(x, y, label, color)
tuples to label locations on the grid.show_inventory::Bool
: Whether to show an object inventory for each function ininventory_fns
.inventory_fns::Vector{Function}
: Inventory indicator functions of the form(domain, state, obj) -> Bool
.inventory_types::Vector{Symbol}
: Types of objects that can be each inventory.inventory_labels::Vector{String}
: Axis titles / labels for each inventory.state_options::Dict{Symbol, Any}
: Default options for state rendering.trajectory_options::Dict{Symbol, Any}
: Default options for trajectory rendering.
PDDLViz.KeyboardController
— TypeKeyboardController(options...)
KeyboardController(
key1 => act1, key2 => act2, ...,
extra_key1, extra_key2, ...;
exclusive=true, callback=nothing
)
A controller that maps keyboard input to PDDL actions.
Options
keymap
: A dictionary mapping keyboard keys to PDDL actions.extrakeys
: Keys mapped to remaining available actions (default: number keys).extraprocess
: Function(state, acts) -> acts
that filters/processes remaining actions.restart_key
: Restart button if an initial state is specified.exclusive
: Whether an action is executed only if no other keys are pressed.callback
: Post-action callbackf(canvas, domain, state, act, next_state)
.obsfunc
PDDLViz.MarkerGraphic
— TypeMarkerGraphic(marker, x, y, [w=1.0, h=w]; attributes...)
A marker graphic with a given position and size, rendered using scatter
with the corresponding marker type.
PDDLViz.MultiGraphic
— TypeMultiGraphic(graphics; attributes...)
Composite graphic type, containing a tuple of graphics in depth-order and a dictionary of attributes.
PDDLViz.Renderer
— TypeRenderer
A Renderer
defines how a PDDL State
for a specific Domain
should be rendered. A concrete sub-type of Renderer
should be implemented for a PDDL domain (or family of PDDL domains, e.g. 2D gridworlds) for users who wish to visualize that domain.
(r::Renderer)(domain::Domain, args...; options...)
(r::Renderer)(canvas::Canvas, domain::Domain, args...; options...)
Once a Renderer
has been constructed, it can be used to render PDDL states and other entities by calling it with the appropriate arguments.
GeometryBasics.coordinates
— MethodReturn the coordinates of a graphic.
PDDLViz.CircleShape
— MethodConstruct a circle centered at x
and y
with radius r
.
PDDLViz.CityGraphic
— FunctionCity prefab graphic, made of three rectangles.
PDDLViz.GemGraphic
— FunctionGem prefab graphic, consisting of a N-gon and a smaller N-gon inside it.
PDDLViz.HeptagonShape
— MethodConstruct a heptagon centered at x
and y
with radius r
.
PDDLViz.HexagonShape
— MethodConstruct a hexagon centered at x
and y
with radius r
.
PDDLViz.HumanGraphic
— FunctionHuman prefab graphic, made of a oval head and triangle body.
PDDLViz.KeyGraphic
— FunctionKey prefab graphic, consisting of a key with a handle and two teeth.
PDDLViz.LockedDoorGraphic
— FunctionLocked door prefab graphic, consisting of square with a keyhole in it.
PDDLViz.NgonShape
— MethodConstruct a n
-sided regular polygon centered at x
and y
with radius 1
.
PDDLViz.OctagonShape
— MethodConstruct an octagon centered at x
and y
with radius r
.
PDDLViz.PentagonShape
— MethodConstruct a pentagon centered at x
and y
with radius r
.
PDDLViz.PolygonShape
— MethodConstruct a polygon from a list of vertices.
PDDLViz.RectShape
— MethodConstruct a rectangle centered at x
and y
with width w
and height h
.
PDDLViz.RobotGraphic
— FunctionRobot prefab graphic
PDDLViz.SquareShape
— MethodConstruct a square centered at x
and y
with side length l
.
PDDLViz.TrapezoidShape
— FunctionConstruct a trapezoid at x
and y
with top and bottom width a
, bottom width b
, and height h
. The top can be shifted by an offset
(zero by default).
PDDLViz.TriangleShape
— MethodConstruct a triangle centered at x
and y
with radius r
.
PDDLViz.add_controller!
— Functionadd_controller!(canvas, controller, domain, [init_state];
show_controls::Bool=false)
Adds a controller
to a canvas
for a given PDDL domain
. An initial state init_state
can be specified to enable restart functionality.
PDDLViz.anim_plan!
— Functionanim_plan([path], renderer, domain, state, actions;
format="mp4", framerate=5, show=false, options...)
anim_plan!([path], canvas, renderer, domain, state, actions;
format="mp4", framerate=5, show=is_displayed(canvas), options...)
Uses renderer
to animate a series of actions
in a PDDL domain
starting from state
(updating the canvas
if one is provided). If a path
is specified, the animation is saved to that file, and the path
is returned. Otherwise, a Animation
object is returned, which can be saved or displayed.
PDDLViz.anim_plan
— Methodanim_plan([path], renderer, domain, state, actions;
format="mp4", framerate=5, show=false, options...)
anim_plan!([path], canvas, renderer, domain, state, actions;
format="mp4", framerate=5, show=is_displayed(canvas), options...)
Uses renderer
to animate a series of actions
in a PDDL domain
starting from state
(updating the canvas
if one is provided). If a path
is specified, the animation is saved to that file, and the path
is returned. Otherwise, a Animation
object is returned, which can be saved or displayed.
PDDLViz.anim_trajectory!
— Functionanim_trajectory([path], renderer, domain, trajectory;
format="mp4", framerate=5, show=false, options...)
anim_trajectory!([path], canvas, renderer, domain, trajectory;
format="mp4", framerate=5, show=is_displayed(canvas),
options...)
Uses renderer
to animate a trajectory
in a PDDL domain
(updating the canvas
if one is provided). If a path
is specified, the animation is saved to that file, and the path
is returned. Otherwise, a Animation
object is returned, which can be saved or displayed.
PDDLViz.anim_trajectory
— Methodanim_trajectory([path], renderer, domain, trajectory;
format="mp4", framerate=5, show=false, options...)
anim_trajectory!([path], canvas, renderer, domain, trajectory;
format="mp4", framerate=5, show=is_displayed(canvas),
options...)
Uses renderer
to animate a trajectory
in a PDDL domain
(updating the canvas
if one is provided). If a path
is specified, the animation is saved to that file, and the path
is returned. Otherwise, a Animation
object is returned, which can be saved or displayed.
PDDLViz.boundingbox
— MethodReturn the bounding box of a graphic.
PDDLViz.centroid
— MethodReturn the centroid of a graphic.
PDDLViz.darken
— MethodDarken a RGB(A) color by a given amount.
PDDLViz.lighten
— MethodLighten a RGB(A) color by a given amount.
PDDLViz.new_canvas
— Methodnew_canvas(renderer::Renderer)
new_canvas(renderer::Renderer, figure::Figure)
new_canvas(renderer::Renderer, axis::Axis)
new_canvas(renderer::Renderer, gridpos::GridPosition)
Creates a new Canvas
to be used by renderer
. An existing figure
, axis
, or gridpos
can be specified to use as the base for the new canvas.
PDDLViz.remove_controller!
— Methodremove_controller!(canvas, controller)
Removes a controller
from a canvas
.
PDDLViz.render_controls!
— Methodrender_controls!(canvas, controller, domain)
Renders controls for a controller
to a canvas
.
PDDLViz.render_plan!
— Methodrender_plan!(canvas, renderer, domain, state, actions)
Uses renderer
to render a series of actions
in a PDDL domain
starting from state
. Renders to a canvas
on top of any existing content.
PDDLViz.render_plan
— Methodrender_plan(renderer, domain, state, actions; options...)
Uses renderer
to render a series of actions
in a PDDL domain
starting from state
. Constructs and returns a new Canvas
.
PDDLViz.render_sol!
— Methodrender_sol!(canvas::Canvas, renderer::Renderer,
domain::Domain, state::State, sol::Solution)
Uses renderer
to render a planning solution sol
starting from a state
in a PDDL domain
. Renders to a canvas
on top of any existing content.
PDDLViz.render_sol
— Methodrender_sol(renderer::Renderer,
domain::Domain, state::State, sol::Solution)
Uses renderer
to render a planning solution sol
starting from a state
in a PDDL domain
. Constructs and returns a new Canvas
.
PDDLViz.render_state!
— Methodrender_state!(canvas, renderer, domain, state; options...)
Uses renderer
to render a state
of a PDDL domain
to an existing canvas
, rendering over any existing content.
PDDLViz.render_state
— Methodrender_state(renderer, domain, state)
Uses renderer
to render a state
of a PDDL domain
. Constructs and returns a new Canvas
.
PDDLViz.render_trajectory!
— Methodrender_trajectory!(canvas::Canvas, renderer::Renderer,
domain::Domain, trajectory::AbstractVector{<:State})
Uses renderer
to render a trajectory
of PDDL domain
states. Renders to a canvas
on top of any existing content.
PDDLViz.render_trajectory
— Methodrender_trajectory(renderer::Renderer,
domain::Domain, trajectory::AbstractVector{<:State})
Uses renderer
to render a trajectory
of PDDL domain
states. Constructs and returns a new Canvas
.
PDDLViz.rotate
— FunctionRotate a graphic by θ radians around a point c
.
PDDLViz.scale
— FunctionScale by a horizontal factor x
and vertical factor y
around a point c
.
PDDLViz.translate
— MethodTranslate a graphic by x
and y
units.