pymoveit_mtc.core.MonitoringGenerator¶
- class MonitoringGenerator(self: pymoveit_mtc.core.MonitoringGenerator, name: str = 'generator')¶
Bases:
Generator
Base class for monitoring generator stages
To implement a generator stage that draws on some previously computed solution, you need to derive from
MonitoringGenerator
- monitoring the solutions produced by another stage. Each time, the monitored stage produces a new solution, the methodonNewSolution()
of the MonitoringGenerator is called. Usually, you schedule this solution for later processing incompute()
:class PyMonitoringGenerator(core.MonitoringGenerator): """ Implements a custom 'MonitoringGenerator' stage.""" solution_multiplier = 2 def __init__(self, name="MonitoringGenerator"): core.MonitoringGenerator.__init__(self, name) self.reset() def reset(self): core.MonitoringGenerator.reset(self) self.pending = [] def onNewSolution(self, sol): self.pending.append(sol) def canCompute(self): return bool(self.pending) def compute(self): # fetch first pending upstream solution ... scene = self.pending.pop(0).end.scene # ... and generate new solutions derived from it for i in range(self.solution_multiplier): self.spawn(core.InterfaceState(scene), i)
Upon creation of the stage, assign the monitored stage as follows:
jointspace = core.JointInterpolationPlanner() task = core.Task() current = stages.CurrentState("current") task.add(current) connect = stages.Connect(planners=[('panda_arm', jointspace)]) task.add(connect) mg = PyMonitoringGenerator("generator") mg.setMonitoredStage(task["current"]) task.add(mg)
Methods
Return
True
if the stage can still produce solutions.Compute an actual solution and
spawn
anInterfaceState
Initialize the stage once before planning.
Reset the Stage.
Overloaded function.
Set the monitored
Stage
Spawn an
InterfaceState
to both, start and end interfaceAttributes
Failed Solutions of the stage (read-only)
set of properties forwarded from input to output InterfaceState
Namespace for any markers that are associated to the stage
name of the stage displayed e.g.
PropertyMap of the stage (read-only)
Successful Solutions of the stage (read-only)
Maximally allowed time [s] per computation step
- class PropertyInitializerSource(self: pymoveit_mtc.core.Stage.PropertyInitializerSource, value: int)¶
Bases:
pybind11_object
OR-combinable flags defining a source to initialize a specific property from. Used in pymoveit_mtc.core.PropertyMap
configureInitFrom()
.Members:
PARENT : Inherit properties from parent stage
INTERFACE : Inherit properties from the input InterfaceState
- property name¶
- canCompute(self: pymoveit_mtc.core.Generator) bool ¶
Return
True
if the stage can still produce solutions.
- compute(self: pymoveit_mtc.core.Generator) None ¶
Compute an actual solution and
spawn
anInterfaceState
- property forwarded_properties¶
set of properties forwarded from input to output InterfaceState
- Type:
- init(self: pymoveit_mtc.core.Stage, robot_model: moveit::core::RobotModel) None ¶
Initialize the stage once before planning. Will setup properties configured for initialization from parent.
- property properties¶
PropertyMap of the stage (read-only)
- Type:
- reset(self: pymoveit_mtc.core.Stage) None ¶
Reset the Stage. Clears all solutions, interfaces and inherited properties
- setCostTerm(*args, **kwargs)¶
Overloaded function.
setCostTerm(self: pymoveit_mtc.core.Stage, arg0: pymoveit_mtc.core.CostTerm) -> None
Specify a CostTerm for calculation of stage costs
setCostTerm(self: pymoveit_mtc.core.Stage, arg0: Callable[[pymoveit_mtc.core.SubTrajectory, str], float]) -> None
Specify a function to calculate trajectory costs
setCostTerm(self: pymoveit_mtc.core.Stage, arg0: Callable[[pymoveit_mtc.core.SubTrajectory], float]) -> None
Specify a function to calculate trajectory costs
- setMonitoredStage(self: pymoveit_mtc.core.MonitoringGenerator, stage: pymoveit_mtc.core.Stage) None ¶
Set the monitored
Stage
- property solutions¶
Successful Solutions of the stage (read-only)
- spawn(self: pymoveit_mtc.core.Generator, state: pymoveit_mtc.core.InterfaceState, cost: float) None ¶
Spawn an
InterfaceState
to both, start and end interface