File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,10 @@ double PredefinedCosts::cost() const {
4646 return c;
4747}
4848
49- GeneratorMockup::GeneratorMockup (PredefinedCosts&& costs)
50- : Generator{ " GEN" + std::to_string (++id_) }, costs_{ std::move (costs) } {}
49+ GeneratorMockup::GeneratorMockup (PredefinedCosts&& costs, std::size_t solutions_per_compute)
50+ : Generator{ " GEN" + std::to_string (++id_) }
51+ , costs_{ std::move (costs) }
52+ , solutions_per_compute_{ solutions_per_compute } {}
5153
5254void GeneratorMockup::init (const moveit::core::RobotModelConstPtr& robot_model) {
5355 ps_.reset (new planning_scene::PlanningScene (robot_model));
@@ -63,7 +65,8 @@ bool GeneratorMockup::canCompute() const {
6365void GeneratorMockup::compute () {
6466 ++runs_;
6567
66- spawn (InterfaceState (ps_), costs_.cost ());
68+ for (std::size_t i = 0 ; canCompute () && i < solutions_per_compute_; ++i)
69+ spawn (InterfaceState (ps_), costs_.cost ());
6770}
6871
6972MonitoringGeneratorMockup::MonitoringGeneratorMockup (Stage* monitored, PredefinedCosts&& costs)
Original file line number Diff line number Diff line change @@ -40,11 +40,13 @@ struct GeneratorMockup : public Generator
4040
4141 PredefinedCosts costs_;
4242 size_t runs_{ 0 };
43+ std::size_t solutions_per_compute_;
4344
4445 static unsigned int id_;
4546
4647 // default to one solution to avoid infinity loops
47- GeneratorMockup (PredefinedCosts&& costs = PredefinedCosts{ std::list<double >{ 0.0 }, true });
48+ GeneratorMockup (PredefinedCosts&& costs = PredefinedCosts{ std::list<double >{ 0.0 }, true },
49+ std::size_t solutions_per_compute = 1 );
4850 GeneratorMockup (std::initializer_list<double > costs)
4951 : GeneratorMockup{ PredefinedCosts{ std::list<double >{ costs }, true } } {}
5052
You can’t perform that action at this time.
0 commit comments