GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
robot_operator_factory.cpp
[詳解]
1
3
4// Copyright(c) 2023-2025 Design Engineering Laboratory, Saitama University
5// Released under the MIT license
6// https://opensource.org/licenses/mit-license.php
7
9
10#include "cassert_define.h"
11#include "robot_operation.h"
15#include "toml_file_importer.h"
17
18
19namespace designlab
20{
21
22std::unique_ptr<IRobotOperator> RobotOperatorFactory::Create(const SimulationSettingRecord& setting)
23{
24 using enum enums::RobotOperateMode;
25
26 if (setting.operate_mode == kForGloabalPathGenerate)
27 {
28 return std::make_unique<RobotOperatorForGpg>();
29 }
30 else if (setting.operate_mode == kFixed)
31 {
33
34 const auto operation = importer.ImportOrUseDefault(
36
37 return std::make_unique<RobotOperatorFixed>(operation);
38 }
39 else if (setting.operate_mode == kForPath)
40 {
41 return std::make_unique<RobotOperatorForPath>(setting.path_points);
42 }
43 else
44 {
45 assert(false);
46
47 return nullptr;
48 }
49}
50
51} // namespace designlab
static std::unique_ptr< IRobotOperator > Create(const SimulationSettingRecord &setting)
設定ファイルからTargetUpdaterを生成する.
static const char kTomlFileDirPath[]
TOMLファイルを入れるディレクトリのパス.
tomlファイルを読み込んで構造体に変換するテンプレートクラス.
T ImportOrUseDefault(const std::string &file_path) const
指定したファイルパスのファイルを読み込み,構造体に変換する. 読込に失敗した場合は,デフォルトの構造体を返す. また,読込に失敗した場合には, デフォルトの構造体をファイルに出力するかどうかをユーザに問...