Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework #16

Merged
merged 19 commits into from
Aug 5, 2016
Merged

Rework #16

merged 19 commits into from
Aug 5, 2016

Conversation

Williangalvani
Copy link
Contributor

No description provided.

Signed-off-by: Willian Galvani <williangalvani@gmail.com>
TCCR1B |= (0 << CS11);
TCCR1B |= (1 << CS12);
TIMSK1 |= (1 << OCIE1A); // enable timer compare interrupt
}
Copy link
Member

@patrickelectric patrickelectric Jun 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I Think that controllerSetup need to be a singleton that will be parent of Controller,
in that case the setup will only run once and it will be integrated in Controller class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I Disagree, since this actually only setups a 20ms interruption, this should be handled by some kind of scheduler, along with other periodic tasks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right. Maybe a scheduler is really a better place to do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened issue #19

@patrickelectric
Copy link
Member

patrickelectric commented Jun 25, 2016

Please, change all class variables with a prefix, like m_variable in Controller

this->td = td;
this->ts = ts;
this->taw = ti;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1º use a standard like:
tc,ti,td,ta
or
kc,ki,kd,ts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be the most common standard in industry, as seen here.
But I'll add the equations as comments to be clearer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, do that and use this as example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, out of scope, opened issue #21

@patrickelectric
Copy link
Member

@Williangalvani, news ?


u_total = up + ui + ud;

u_sat = min(umax,max(u_total,umin)); //saturação
Copy link
Member

@patrickelectric patrickelectric Aug 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use sat function [not now].
Its necessary to create a generec file with some util functions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#24 created

Signed-off-by: Willian Galvani <williangalvani@gmail.com>
@@ -51,6 +51,11 @@ void HBridge::setWheelPWM(uint8_t wheel, float speed)
digitalWrite(pin_f,HIGH);
digitalWrite(pin_b,LOW);
}
else if(speed ==0)
{
digitalWrite(pin_f,HIGH);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

identation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Signed-off-by: Willian Galvani <williangalvani@gmail.com>
…ollers gains accordingly

Fix robotadasufsc#11

Signed-off-by: Willian Galvani <williangalvani@gmail.com>
- Made it start turned on by default;
- New sensor reading function;
- Called readSensors during calibration phase, so the calibration actually happens

Signed-off-by: Willian Galvani <williangalvani@gmail.com>
Signed-off-by: Willian Galvani <williangalvani@gmail.com>
Signed-off-by: Willian Galvani <williangalvani@gmail.com>
int size = sizeof(m_sensor)/sizeof(m_sensor[0]);
for(int i=0;i<size;i++)
{
sumOfMass += m_sensor[i];
sumOfMassXdistance += m_sensor[i] *i;
maxValue = max(m_sensor[i],maxValue);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

identation

Signed-off-by: Willian Galvani <williangalvani@gmail.com>
}
else
{
return nullptr;
return 0;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If i < sizeof(m_sensor) and typ != NORMAL, MAX, MIN. It will return something crazy, as a default behaviour I think that it's better to return NORMAL.

case NORMAL:
default:
     return m_sensor[i]
break;

@@ -119,7 +119,7 @@ float IRArray::estimateLinePosition()
maxValue = max(m_sensor[i],maxValue);

}
if (maxValue>150)
if (maxValue>200) //TODO: Should not be hardcoded
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxValue[ Space ]>[ Space ]200

float IRArray::estimateLinePosition()
{
float sumOfMassXdistance = 0;
float sumOfMass=0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sumOfMass = 0;

Signed-off-by: Willian Galvani <williangalvani@gmail.com>
Signed-off-by: Willian Galvani <williangalvani@gmail.com>
Signed-off-by: Willian Galvani <williangalvani@gmail.com>
… place

Signed-off-by: Willian Galvani <williangalvani@gmail.com>
Signed-off-by: Willian Galvani <williangalvani@gmail.com>
Signed-off-by: Willian Galvani <williangalvani@gmail.com>
…sensor

Signed-off-by: Willian Galvani <williangalvani@gmail.com>
Signed-off-by: Willian Galvani <williangalvani@gmail.com>
Signed-off-by: Willian Galvani <williangalvani@gmail.com>
Signed-off-by: Willian Galvani <williangalvani@gmail.com>
Signed-off-by: Willian Galvani <williangalvani@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants