ARCS6 AR6-REV.24062600
読み取り中…
検索中…
一致する文字列を見つけられません
MotorSimulators.hh
1
8//
9// Copyright (C) 2011-2020 Yokokura, Yuki
10// This program is free software;
11// you can redistribute it and/or modify it under the terms of the FreeBSD License.
12// For details, see the License.txt file.
13
14#ifndef MOTORSIMULATORS
15#define MOTORSIMULATORS
16
17#include <cassert>
18#include <array>
19#include "Matrix.hh"
20#include "MotorParamDef.hh"
21#include "MotorSimulator.hh"
22
23// ARCS組込み用マクロ
24#ifdef ARCS_IN
25 // ARCSに組み込まれる場合
26 #include "ARCSassert.hh"
27 #include "ARCSeventlog.hh"
28#else
29 // ARCSに組み込まれない場合
30 #define arcs_assert(a) (assert(a))
31 #define PassedLog()
32 #define EventLog(a)
33 #define EventLogVar(a)
34#endif
35
36namespace ARCS { // ARCS名前空間
39template <size_t N>
41 public:
45 MotorSimulators(const std::array<struct MotorParamDef, N>& Params, const double SmplTime)
46 : PlantSyss()
47 {
48 PassedLog();
49 // 各軸数分のモータシミュレータのパラメータ設定
50 for(size_t i = 0; i < N; ++i){
51 PlantSyss.at(i).SetParameters(Params.at(i).Kt, Params.at(i).Jm, Params.at(i).Dm, SmplTime);
52 }
53 }
54
58 : PlantSyss(std::move(r.PlantSyss))
59 {
60
61 }
62
67
71 void SetCurrentAndLoadTorque(const std::array<double, N> Current, const std::array<double, N> LoadTorque){
72 // 各軸の電流と負荷トルクを設定
73 for(size_t i = 0; i < N; ++i){
74 PlantSyss.at(i).SetCurrentAndLoadTorque(Current.at(i), LoadTorque.at(i));
75 }
76 }
77
81 void GetVelocityAndPosition(std::array<double, N>& Velocity, std::array<double, N>& Position){
82 // 各軸の応答計算
83 for(size_t i = 0; i < N; ++i){
84 PlantSyss.at(i).GetVelocityAndPosition(Velocity.at(i), Position.at(i));
85 }
86 }
87
88
89 private:
90 MotorSimulators(const MotorSimulators&) = delete;
91 const MotorSimulators& operator=(const MotorSimulators&) = delete;
92
93 std::array<MotorSimulator, N> PlantSyss;
94};
95}
96
97#endif
98
ARCS イベントログクラス
#define PassedLog()
イベントログ用マクロ(ファイルと行番号のみ記録版)
Definition ARCSeventlog.hh:26
ARCS用ASSERTクラス
モータのパラメータ定義ファイル
行列/ベクトル計算クラス(テンプレート版)
モータシミュレータ
モータシミュレータ(ベクトル対応版)
Definition MotorSimulators.hh:40
MotorSimulators(const std::array< struct MotorParamDef, N > &Params, const double SmplTime)
コンストラクタ
Definition MotorSimulators.hh:45
void SetCurrentAndLoadTorque(const std::array< double, N > Current, const std::array< double, N > LoadTorque)
予め電流と負荷トルクを設定する関数
Definition MotorSimulators.hh:71
~MotorSimulators()
デストラクタ
Definition MotorSimulators.hh:64
void GetVelocityAndPosition(std::array< double, N > &Velocity, std::array< double, N > &Position)
予めセットされたモータ電流と負荷トルクから速度と位置を計算する関数
Definition MotorSimulators.hh:81
MotorSimulators(MotorSimulators &&r)
ムーブコンストラクタ
Definition MotorSimulators.hh:57