-
Notifications
You must be signed in to change notification settings - Fork 5
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
Rework #16
Conversation
Signed-off-by: Willian Galvani <williangalvani@gmail.com>
TCCR1B |= (0 << CS11); | ||
TCCR1B |= (1 << CS12); | ||
TIMSK1 |= (1 << OCIE1A); // enable timer compare interrupt | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opened issue #19
Please, change all class variables with a prefix, like m_variable in Controller |
this->td = td; | ||
this->ts = ts; | ||
this->taw = ti; | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
@Williangalvani, news ? |
|
||
u_total = up + ui + ud; | ||
|
||
u_sat = min(umax,max(u_total,umin)); //saturação |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
identation
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; | ||
} |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maxValue[ Space ]>[ Space ]200
09bbf46
to
20da6aa
Compare
float IRArray::estimateLinePosition() | ||
{ | ||
float sumOfMassXdistance = 0; | ||
float sumOfMass=0; |
There was a problem hiding this comment.
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>
No description provided.