61 CmdIOUtil::SetOutputLimit(kSystem);
64 toml_directory_exporter.
Export();
70 const auto application_setting_record = std::make_shared<const ApplicationSettingRecord>(application_setting_importer.
ImportOrUseDefault(
"./settings.toml"));
74 CmdIOUtil::DoOutput(application_setting_record->do_cmd_output);
75 CmdIOUtil::SetOutputLimit(application_setting_record->cmd_output_detail);
78 CmdIOUtil::OutputTitle(
"Free Gait Planning for a Hexapod Walking Robot by Graph Search",
true);
86 boost::thread graphic_thread(&GraphicSystem::Main, &graphic_system);
93 BootMode boot_mode = application_setting_record->default_mode;
95 if (application_setting_record->ask_about_modes)
108 auto graphic_data_broker = std::make_shared<GraphicDataBroker>();
113 auto phantomx_mk2 = std::make_shared<PhantomXMkII>(parameter_record);
115 auto node_creator_builder_straight = std::make_unique<NodeCreatorBuilderStraightMove>(phantomx_mk2, phantomx_mk2, phantomx_mk2);
116 auto node_creator_builder_turn_spot = std::make_unique<NodeCreatorBuilderTurnSpot>(phantomx_mk2, phantomx_mk2, phantomx_mk2);
118 auto graph_tree_creator_straight = std::make_unique<GraphTreeCreator>(std::move(node_creator_builder_straight));
119 auto graph_tree_creator_turn_spot = std::make_unique<GraphTreeCreator>(std::move(node_creator_builder_turn_spot));
121 auto graph_searcher_straight = std::make_unique<GraphSearcherStraightMove>(phantomx_mk2);
122 auto graph_searcher_turn_spot = std::make_unique<GraphSearcherSpotTurn>(phantomx_mk2, phantomx_mk2);
124 std::unique_ptr<ISystemMain> system_main;
128 case BootMode::kSimulation:
132 auto gait_pattern_generator_straight = std::make_unique<GaitPatternGeneratorBasic>(std::move(graph_tree_creator_straight), std::move(graph_searcher_straight), 4, 20000000);
133 auto gait_pattern_generator_turn_spot = std::make_unique<GaitPatternGeneratorBasic>(std::move(graph_tree_creator_turn_spot), std::move(graph_searcher_turn_spot), 4, 20000000);
134 auto gait_pattern_generator_switch_move = std::make_unique<GaitPatternGeneratorSwitchMove>(std::move(gait_pattern_generator_straight), std::move(gait_pattern_generator_turn_spot));
138 auto map_creator = MapCreatorFactory::Create(simulation_setting_record);
139 auto simulation_end_checker = SimulationEndCheckerFactory::Create(simulation_setting_record);
140 auto robot_operator = RobotOperatorFactory::Create(simulation_setting_record);
141 auto node_initializer = std::make_unique<NodeInitializer>(simulation_setting_record.
initial_positions,
144 auto result_exporter = std::make_shared<ResultFileExporter>(phantomx_mk2);
146 system_main = std::make_unique<SystemMainSimulation>(
147 std::move(gait_pattern_generator_switch_move),
148 std::move(map_creator),
149 std::move(simulation_end_checker),
150 std::move(robot_operator),
151 std::move(node_initializer),
153 application_setting_record,
156 auto graphic_main = std::make_unique<GraphicMainBasic>(graphic_data_broker, phantomx_mk2, phantomx_mk2, phantomx_mk2, application_setting_record);
162 case BootMode::kViewer:
168 simulation_setting_importer.
ImportOrUseDefault(
"./simulation_condition/simulation_setting.toml");
170 auto map_creator = MapCreatorFactory::Create(simulation_setting_record);
172 system_main = std::make_unique<SystemMainGraphViewer>(
173 std::move(graph_tree_creator_straight),
174 std::move(map_creator),
176 application_setting_record);
178 std::unique_ptr<IGraphicMain> graphic_main_viewer =
179 std::make_unique<GraphicMainGraphViewer>(graphic_data_broker, phantomx_mk2, phantomx_mk2, phantomx_mk2, application_setting_record);
185 case BootMode::kDisplayModel:
187 std::unique_ptr<IGraphicMain> graphic_main_test =
188 std::make_unique<GraphicMainDisplayModel>(
192 application_setting_record);
198 case BootMode::kResultViewer:
201 system_main = std::make_unique<SystemMainResultViewer>(graphic_data_broker, application_setting_record, phantomx_mk2, phantomx_mk2);
203 std::unique_ptr<IGraphicMain> graphic_main = std::make_unique<GraphicMainBasic>(graphic_data_broker, phantomx_mk2, phantomx_mk2, phantomx_mk2, application_setting_record);
209 case BootMode::kRobotControl:
211 system_main = std::make_unique<SystemMainRobotControl>(graphic_data_broker);
213 std::unique_ptr<IGraphicMain> graphic_main_robot_control =
214 std::make_unique<GraphicMainRobotControl>(graphic_data_broker, phantomx_mk2, phantomx_mk2, phantomx_mk2, application_setting_record);
234 CmdIOUtil::OutputHorizontalLine(
"=", kSystem);
235 CmdIOUtil::OutputNewLine(1, kSystem);
237 if (!CmdIOUtil::InputYesNo(
"Continue?"))
242 CmdIOUtil::OutputNewLine(1, kSystem);
243 CmdIOUtil::OutputHorizontalLine(
"=", kSystem);
244 CmdIOUtil::OutputNewLine(1, kSystem);
247 CmdIOUtil::Output(
"Waiting for Dxlib to exit; press the X button on the GUI.", kSystem);
248 graphic_thread.join();