20 Bundle(
float _x,
float _y,
float _a,
float _w,
float _l): x(_x), y(_y), angle(_a), width(_w), length(_l){}
34 bool operator<(
const Bundle & bf);
41 return sqrt(pow(x,2)+pow(y,2));
52 float get_angle()
const{
56 float get_width()
const{
60 float get_length()
const{
65 float sum_squares()
const{
66 return pow(x, 2) + pow(y, 2)+pow(angle, 2) +pow(width, 2) +pow(length, 2);
69 std::vector <float> get_vector()
const{
70 return {x, y, angle, width, length};
75 T linear_rectify(T value){
96 Threshold(
float e,
float a,
float d,
float aff,
float d_dim):
97 endPosition(e), angle(a), dPosition(d), affordance(aff), D_dimensions(d_dim){}
99 float for_robot_position(){
103 float for_robot_angle(){
107 float for_affordance(){
125 void set_Dn(
const Bundle & b){
129 void set_Di(
const Bundle & b){
136 return Bundle(dPosition, dPosition, angle, D_dimensions, D_dimensions);
141 float endPosition=0.05;
143 float dPosition= 0.065;
145 float D_dimensions=0.03;
146 Bundle Di=
Bundle(dPosition, dPosition, angle, D_dimensions, D_dimensions), Dn=Di;
151 Bundle Di_weights, Dn_weights;
156 void set_learning_rate(
float f){
169 FILE *f= fopen(
"/tmp/threshold_weights.txt",
"a+");
170 fprintf(f,
"%f\t%f\t%f\t%f\t%f\t\t%f\t%f\t%f\t%f\t%f\n", Di_weights.get_x(),
172 Di_weights.get_angle(),
173 Di_weights.get_length(),
174 Di_weights.get_width(),
177 Dn_weights.get_angle(),
178 Dn_weights.get_length(),
179 Dn_weights.get_width()
185 FILE *f= fopen(
"/tmp/threshold_weights",
"w+");
207 result.set_Di(t.
for_Di()*Di_weights);
208 result.set_Dn(t.
for_Dn()*Dn_weights);
Definition: disturbance.h:45
Definition: threshold.h:10
Bundle operator*(const Bundle &b) const
Dot product between two bundles.
Definition: threshold.cpp:3
Definition: threshold.h:149
virtual void Di_tune(const Bundle &error, const Bundle &x)=0
Tune weights for Di.
virtual Bundle update_bundle(const Bundle &error, const Bundle &x)=0
Updates a threshold according to a custom learning rule.
Definition: threshold.h:91
Bundle for_Dn() const
Returns a bundle of thresholds for the initial disturbance.
Definition: threshold.h:121
Bundle for_Di() const
Returns a bundle of thresholds for the initial disturbance.
Definition: threshold.h:114
Bundle bundle_threshold()
Returns a bundle of parameters for disturbance matching.
Definition: threshold.h:135