GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
result_file_exporter.h
[詳解]
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
8#ifndef DESIGNLAB_RESULT_FILE_EXPORTER_H_
9#define DESIGNLAB_RESULT_FILE_EXPORTER_H_
10
11#include <fstream>
12#include <memory>
13#include <string>
14#include <vector>
15
19#include "robot_state_node.h"
21
22
23namespace designlab {
24
25class ResultFileConst final {
26public:
28 static const std::string kDirectoryPath;
29
31 static const std::string kLegDirectoryName;
32
34 static const std::string kSuccessfulCount;
35
37 static const std::string kDetailFileName;
38
40 static const std::string kNodeListName;
41
43 static const std::string kMapStateName;
44
46 static const std::string kLegAngleName;
47};
48
49
53class ResultFileExporter final {
54public:
56 const std::shared_ptr<const IHexapodJointCalculator>& calculator_ptr,
57 const std::shared_ptr<const IHexapodCoordinateConverter>& converter_ptr);
58
61
64 void PushSimulationResult(const SimulationResultRecord& simulation_result);
65
67 void Export() const;
68
69private:
72 std::string MakeOutputDirectory() const;
73
76 void ExportEachNodeList(const std::string& path) const;
77
80 void ExportEachMapState(const std::string& path) const;
81
84 void ExportEachSimulationDetail(const std::string& path) const;
85
91 void ExportSuccessfulCount(const std::string& path) const;
92
95 void ExportEachLegPos(const std::string& path) const;
96
98 void ExportAllLegPos(const std::string& path) const;
99
102 void ExportEachLegPosAllSuccessfulSimulation(const std::string& path) const;
103
104 void ExportAllLegPosAllSuccessfulSimulation(const std::string& path) const;
105
106 void ExportAllLegAngle(const std::string& path) const;
107
108 std::string GetHeader() const;
109
110 std::string GetLegChangeStatus(
111 const std::optional<Vector3>& past, const Vector3& current) const;
112
114 std::vector<SimulationResultRecord> result_list_;
115
117 const std::shared_ptr<const IHexapodJointCalculator> calculator_ptr_;
118
119 const std::unique_ptr<const InterpolatedNodeCreator> interpolated_node_creator_ptr_;
120};
121
122} // namespace designlab
123
124
125#endif // DESIGNLAB_RESULT_FILE_EXPORTER_H_
static const std::string kLegDirectoryName
出力先ディレクトリ(フォルダ)名.
static const std::string kNodeListName
ノードリストのファイル名 (プログラムの読み込み用)
static const std::string kDetailFileName
ファイル名 ( 人間が見る用 )
static const std::string kSuccessfulCount
シミュレーションの成功回数をまとめたファイルの名前.
static const std::string kDirectoryPath
出力先ディレクトリ(フォルダ)名.
static const std::string kMapStateName
マップ状態のファイル名 (プログラムの読み込み用)
static const std::string kLegAngleName
角度データのファイル名 (人間が見る用)
結果をファイルに出力するクラス. シミュレーション結果をファイルに出力する処理を全てこのクラスにまとめた.
void PushSimulationResult(const SimulationResultRecord &simulation_result)
シミュレーション結果を追加する.
void Export() const
結果をファイルに出力する.
void CreateRootDirectory()
resultフォルダがなければ作成する.また,フォルダ名を指定する.
シミュレーションの結果を格納する構造体.
3次元の位置ベクトルを表す構造体.