Skip to content
Snippets Groups Projects
Commit 1acdb927 authored by Paloma de la Puente's avatar Paloma de la Puente
Browse files

alphas instead of indices

parent d532e9ea
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ void Constraint::SetType(int t)
type = t;
}
Values Constraint::ApplyConstraint(int* indices, double* params)
Values Constraint::ApplyConstraint(double alphas[], double params[])
{
Values v;
double err = 0;
......@@ -27,6 +27,7 @@ Values Constraint::ApplyConstraint(int* indices, double* params)
case EQUAL_TO_EITHER:
{
break;
}
case LOCK_DIFF:
......
......@@ -29,7 +29,7 @@ protected:
int type;
// class methods
public:
Values ApplyConstraint(int* indices, double* params = NULL);
Values ApplyConstraint(double alphas[], double params[] = NULL);
void SetType(int t);
};
......
......@@ -41,6 +41,7 @@ void ConstraintManager::ApplyConstraints()
int n = laser_data->nrays;
// select the types of constraints we want to apply
for (int i=0;i< constraint_types_to_apply.size();i++)
{
if (equal_to_either_active && constraint_types_to_apply[i] == EQUAL_TO_EITHER)
......@@ -70,9 +71,11 @@ void ConstraintManager::ApplyConstraints()
for (int j=0; j< mb;j++)
{
Constraint* c = new Constraint(EQUAL_TO_EITHER);
int* ind;
ind[0] = i-j; ind[1] =i; ind[2] =i+j;
Values v = c->ApplyConstraint(ind);
double* alpha_values;
alpha_values[0]= laser_data->alpha[i-j];
alpha_values[1]= laser_data->alpha[i];
alpha_values[2]= laser_data->alpha[i+j];
Values v = c->ApplyConstraint(alpha_values);
constraints.push_back(c);
e += v.error;
......@@ -88,15 +91,18 @@ void ConstraintManager::ApplyConstraints()
{
int* ind;
ind[0] = i; ind[1]=i+1;
double* alpha_values;
alpha_values[0]= laser_data->alpha[i];
alpha_values[1]= laser_data->alpha[i+1];
double* p;
p[0] = PI/2; p[1] = lock_diff_threshold;
Constraint* c1 = new Constraint(LOCK_DIFF);
Values v = c1->ApplyConstraint(ind,p);
Values v = c1->ApplyConstraint(alpha_values,p);
constraints.push_back(c1);
e += v.error;
p[0] = -PI/2;
Constraint* c2 = new Constraint(LOCK_DIFF);
v = c2->ApplyConstraint(ind,p);
v = c2->ApplyConstraint(alpha_values,p);
constraints.push_back(c2);
e += v.error;
......
......@@ -24,6 +24,7 @@ int main(int argc, const char** argv)
}
// the types of constraints we want to apply (i.e. depending on the environment...)
std::vector<int> cons_types;
cons_types.push_back(EQUAL_TO_EITHER);
//cons_types.push_back(LOCK_DIFF);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment