forked from JustinSi/ROCIN_prototype
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVirtualActuatorSet.cpp
92 lines (77 loc) · 2.12 KB
/
VirtualActuatorSet.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include "VirtualActuatorSet.h"
using namespace OpenSim;
VirtualActuator::VirtualActuator()
{
constructProperties();
}
VirtualActuator::VirtualActuator(const std::string& coord, double weight, double minVal, double maxVal)
{
constructProperties();
updProperty_coordinate() = coord;
updProperty_weight() = weight;
updProperty_min_control() = minVal;
updProperty_max_control() = maxVal;
}
void VirtualActuator::constructProperties()
{
constructProperty_coordinate("");
constructProperty_weight(1.0);
constructProperty_min_control(-200.0);
constructProperty_max_control(200.0);
}
VirtualActuatorSet::~VirtualActuatorSet()
{
}
VirtualActuatorSet::VirtualActuatorSet() :
Set<VirtualActuator>()
{
}
VirtualActuatorSet::VirtualActuatorSet(const std::string& aFileName) :
Set<VirtualActuator>(aFileName,false)
{
updateFromXMLDocument();
}
void VirtualActuatorSet::getCoordinateArray(Array<std::string>& coord_array) const
{
int size = getSize();
coord_array.setSize(size);
for(int i=0;i<size;i++)
{
VirtualActuator& act = get(i);
coord_array[i] = act.getProperty_coordinate().getValue();
}
}
void VirtualActuatorSet::getWeightArray(Array<double>& weight_array) const
{
int size = getSize();
weight_array.setSize(size);
for(int i=0;i<size;i++)
{
VirtualActuator& act = get(i);
weight_array[i] = act.getProperty_weight().getValue();
}
}
void VirtualActuatorSet::getCoordAndWeightArray(Array<std::string>& coord_array, Array<double>& weight_array) const
{
int size = getSize();
coord_array.setSize(size);
weight_array.setSize(size);
for(int i=0;i<size;i++)
{
VirtualActuator& act = get(i);
coord_array[i] = act.getProperty_coordinate().getValue();
weight_array[i] = act.getProperty_weight().getValue();
}
}
void VirtualActuatorSet::getMinAndMaxControlArray(SimTK::Vector& min_control_array, SimTK::Vector& max_control_array) const
{
int size = getSize();
min_control_array.resize(size);
max_control_array.resize(size);
for(int i=0;i<size;i++)
{
VirtualActuator& act = get(i);
min_control_array[i] = act.getProperty_min_control().getValue();
max_control_array[i] = act.getProperty_max_control().getValue();
}
}